On 2012/11/21 22:09:41, dewittj wrote:
> On 2012/11/20 23:58:08, kalman wrote:
> > I like this idea. We should make it happen for all extension actions
(except
> for
> > script badges - they should always get the permission - but that's
another
> > story).
> >
> > Note that we were going to build this into the Features system but
that didn't
> > quite happen.
> Will add to the rest of the _actions in a separate CL. What is the
state of
> Features, is it still being developed?
Ok.
The status of the Feature system is partially in this change:
https://codereview.chromium.org/10025007/ but mostly in Aaron's brain.
On 2012/11/21 22:09:41, dewittj wrote:
> On 2012/11/20 23:58:08, kalman wrote:
> > Why not just implement it now?
> I still have doubts about what the final format will look like, since
> system_indicator will need to support more resolutions than just
19x19@1x and
> 19x19@2x. But for now, I have just reused the manifest parser from
the other
> extension_actions and will update once I get a strategy together for
that.
Yep sounds good, but I hope that any improvements you need to make here
would (may need to) also apply to the other types of extension actions.
https://codereview.chromium.org/11361189/diff/20064/chrome/browser/extensions/api/extension_action/extension_actions_api.cc
File
chrome/browser/extensions/api/extension_action/extension_actions_api.cc
(right):
https://codereview.chromium.org/11361189/diff/20064/chrome/browser/extensions/api/extension_action/extension_actions_api.cc#newcode303
chrome/browser/extensions/api/extension_action/extension_actions_api.cc:303:
// part of the Feature system.
This can be convered to a EXTENSION_FUNCTION_VALIDATE when you change
all extension actions to be like the system indicator one in
extension.cc.
https://codereview.chromium.org/11361189/diff/20064/chrome/browser/extensions/api/extension_action/extension_actions_api.cc#newcode309
chrome/browser/extensions/api/extension_action/extension_actions_api.cc:309:
return false;
EXTENSION_FUNCTION_VALIDATE(ValidateArguments())
https://codereview.chromium.org/11361189/diff/20064/chrome/browser/extensions/api/extension_action/extension_actions_api.cc#newcode315
chrome/browser/extensions/api/extension_action/extension_actions_api.cc:315:
extensions::ExtensionActionManager::Get(profile_);
nit: do this at top, then re-use is everywhere else above given
extensions::ExtensionActionManager::Get.
also, the abbr is a bit unnecessary, just "manager" is fine.
https://codereview.chromium.org/11361189/diff/20064/chrome/browser/extensions/api/extension_action/extension_actions_api.cc#newcode320
chrome/browser/extensions/api/extension_action/extension_actions_api.cc:320:
EXTENSION_FUNCTION_VALIDATE(mgr->GetSystemIndicator(*GetExtension()));
actually... a more sensible check here is probably just
EXTENSION_FUNCTION_VALIDATE(type == BROWER ||
type == SYSTEM_INDICATOR)
since we've already validated there is an action associated with that
value.
https://codereview.chromium.org/11361189/diff/20064/chrome/browser/extensions/api/extension_action/extension_actions_api.cc#newcode340
chrome/browser/extensions/api/extension_action/extension_actions_api.cc:340:
EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &first_arg));
let's push up the call to EXTENSION_FUNCTION_VALIDATE to the caller, and
just return bools from here.
https://codereview.chromium.org/11361189/diff/20064/chrome/browser/extensions/api/extension_action/extension_actions_api.cc#newcode411
chrome/browser/extensions/api/extension_action/extension_actions_api.cc:411:
void ExtensionActionFunction::NotifyStatusTrayChange() {
TODO(dewittj): implement (see
http://crbug.com/142450).
or whatever
https://codereview.chromium.org/11361189/diff/20064/chrome/browser/extensions/api/system_indicator/system_indicator_api.cc
File
chrome/browser/extensions/api/system_indicator/system_indicator_api.cc
(right):
https://codereview.chromium.org/11361189/diff/20064/chrome/browser/extensions/api/system_indicator/system_indicator_api.cc#newcode17
chrome/browser/extensions/api/system_indicator/system_indicator_api.cc:17:
return true;
oh I didn't realise the reason for the change to ValidateArguments was
in order to override it here.
What ExtensionAction does is nearly good enough. They know how to deal
with the lack of a tab ID property, so that's fine.
I guess you just want to prevent APIs from adding a tab ID? In which
case I'd just do that as a little check inside extension_actions_api.cc
(there are already plenty of those for other things). That said, it's
unlikely that the UI implementation will care about the tab ID, so eh.
This validation is already being done on the renderer. The validation we
do on the browser is only for sanity and security-important stuff, which
the tab ID isn't.
So yeah - I'd delete this stuff.
https://codereview.chromium.org/11361189/diff/20064/chrome/browser/extensions/extension_action_manager.cc
File chrome/browser/extensions/extension_action_manager.cc (right):
https://codereview.chromium.org/11361189/diff/20064/chrome/browser/extensions/extension_action_manager.cc#newcode142
chrome/browser/extensions/extension_action_manager.cc:142:
delete blank line
https://codereview.chromium.org/11361189/diff/20064/chrome/common/extensions/api/system_indicator.idl
File chrome/common/extensions/api/system_indicator.idl (right):
https://codereview.chromium.org/11361189/diff/20064/chrome/common/extensions/api/system_indicator.idl#newcode6
chrome/common/extensions/api/system_indicator.idl:6: // menubar, system
tray, or other visible area provided by the OS.
could you add note like "this is modelled as an extension action API, so
analogous to browserAction.json and pageAction.json".
https://codereview.chromium.org/11361189/diff/20064/chrome/common/extensions/extension.cc
File chrome/common/extensions/extension.cc (right):
https://codereview.chromium.org/11361189/diff/20064/chrome/common/extensions/extension.cc#newcode2471
chrome/common/extensions/extension.cc:2471:
api_permissions->insert(APIPermission::kSystemIndicator);
TODO(dewittj): do this for all extension action APIs.
https://codereview.chromium.org/11361189/diff/20064/chrome/renderer/resources/extensions/system_indicator_custom_bindings.js
File
chrome/renderer/resources/extensions/system_indicator_custom_bindings.js
(right):
https://codereview.chromium.org/11361189/diff/20064/chrome/renderer/resources/extensions/system_indicator_custom_bindings.js#newcode5
chrome/renderer/resources/extensions/system_indicator_custom_bindings.js:5:
// Custom bindings for the browserAction API.
update comment
https://codereview.chromium.org/11361189/diff/20064/chrome/renderer/resources/extensions/system_indicator_custom_bindings.js#newcode10
chrome/renderer/resources/extensions/system_indicator_custom_bindings.js:10:
chromeHidden.registerCustomHook('systemIndicator', function(bindingsAPI)
{
if you're up for a little bit of cleanup along the way, pull this stuff
into a helper module and call it from page_action_custom_bindings and
browser_action_custom_bindings (and here).
https://codereview.chromium.org/11361189/diff/20064/chrome/test/data/extensions/api_test/system_indicator/test.js
File chrome/test/data/extensions/api_test/system_indicator/test.js
(right):
https://codereview.chromium.org/11361189/diff/20064/chrome/test/data/extensions/api_test/system_indicator/test.js#newcode16
chrome/test/data/extensions/api_test/system_indicator/test.js:16:
I'm not really sure what the added value of these tests are since we
presumably already have ones for browser actions, which use the same
machinery.
But if we don't already have such tests, cool.
https://codereview.chromium.org/11361189/