Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1254)

Unified Diff: chrome/browser/extensions/script_badge_controller.cc

Issue 10823143: Make the getAttention badge grey. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/script_badge_controller.cc
diff --git a/chrome/browser/extensions/script_badge_controller.cc b/chrome/browser/extensions/script_badge_controller.cc
index 5ef797c638a7a0fa67c170d31be7d1be3bb4a4a0..9e850e933d06ee10d713fc759a06944d3a21ddf3 100644
--- a/chrome/browser/extensions/script_badge_controller.cc
+++ b/chrome/browser/extensions/script_badge_controller.cc
@@ -50,7 +50,8 @@ void ScriptBadgeController::GetAttentionFor(
// TODO(jyasskin): Modify the icon's appearance to indicate that the
// extension is merely asking for permission to run:
// http://crbug.com/133142
- script_badge->SetIsVisible(SessionID::IdForTab(tab_contents_), true);
+ script_badge->SetAppearance(SessionID::IdForTab(tab_contents_),
+ ExtensionAction::GETTING_ATTENTION);
NotifyChange();
}
@@ -66,8 +67,21 @@ LocationBarController::Action ScriptBadgeController::OnClicked(
ExtensionAction* script_badge = extension->script_badge();
CHECK(script_badge);
- tab_contents_->extension_tab_helper()->active_tab_permission_manager()->
- GrantIfRequested(extension);
+ if (mouse_button != 3) {
+ // Don't grant access on right clicks, so users can investigate
not at google - send to devlin 2012/08/02 15:38:09 can you move this inside the switch below? That wa
Jeffrey Yasskin 2012/08/02 15:55:56 I would have done that, except it conflicts with t
Jeffrey Yasskin 2012/08/03 11:11:30 Done now, by having both mouse buttons send the on
+ // the extension without danger.
+
+ tab_contents_->extension_tab_helper()->active_tab_permission_manager()->
+ GrantIfRequested(extension);
+
+ // Even if clicking the badge doesn't immediately cause the extension to run
+ // script on the page, we want to help users associate clicking with the
+ // extension having permission to modify the page, so we make the icon
+ // full-colored immediately.
+ if (script_badge->SetAppearance(SessionID::IdForTab(tab_contents_),
+ ExtensionAction::ACTIVE))
+ NotifyChange();
+ }
switch (mouse_button) {
case 1: // left
@@ -186,8 +200,8 @@ bool ScriptBadgeController::MarkExtensionExecuting(
if (!script_badge)
return false;
- script_badge->SetIsVisible(SessionID::IdForTab(tab_contents_), true);
- script_badge->RunIconAnimation(SessionID::IdForTab(tab_contents_));
+ script_badge->SetAppearance(SessionID::IdForTab(tab_contents_),
+ ExtensionAction::ACTIVE);
not at google - send to devlin 2012/08/02 15:38:09 nit: 1 less \n (not yours I know)
Jeffrey Yasskin 2012/08/02 15:55:56 Done.
return true;
}

Powered by Google App Engine
This is Rietveld 408576698