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

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

Issue 10695070: Implement scriptBadge.requestToAct. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix more of Aaron's comments. 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.h
diff --git a/chrome/browser/extensions/script_badge_controller.h b/chrome/browser/extensions/script_badge_controller.h
index a2fa7930cda3eb24b12cb541702891c2031f930a..8a81deb2a5eb051a4f0a59c1c62e4b3e3ff37349 100644
--- a/chrome/browser/extensions/script_badge_controller.h
+++ b/chrome/browser/extensions/script_badge_controller.h
@@ -54,6 +54,7 @@ class ScriptBadgeController
// LocationBarController implementation.
virtual std::vector<ExtensionAction*> GetCurrentActions() const OVERRIDE;
+ virtual void GetAttentionFor(const std::string& extension_id) OVERRIDE;
virtual Action OnClicked(const std::string& extension_id,
int mouse_button) OVERRIDE;
virtual void NotifyChange() OVERRIDE;
@@ -86,9 +87,16 @@ class ScriptBadgeController
void OnContentScriptsExecuting(const std::set<std::string>& extension_ids,
int32 page_id);
- // Tries to insert an extension into the relevant collections, and returns
- // whether any change was made.
- bool InsertExtension(const std::string& extension_id);
+ // Adds the extension's icon to the list of script badges. Returns
+ // the script badge ExtensionAction that was added, or NULL if
+ // extension_id isn't valid.
+ ExtensionAction* AddExtensionToCurrentActions(
+ const std::string& extension_id);
+
+ // Called when an extension is running script on the current tab,
+ // and tries to insert an extension into the relevant collections.
+ // Returns true if any change was made.
+ bool MarkExtensionExecuting(const std::string& extension_id);
// Tries to erase an extension from the relevant collections, and returns
// whether any change was made.
@@ -97,11 +105,12 @@ class ScriptBadgeController
// Our parent TabContents.
TabContents* tab_contents_;
- // The current extension actions in the order they appeared.
+ // The current extension actions in the order they appeared. These come from
+ // calls to ExecuteScript or getAttention on the current frame.
std::vector<ExtensionAction*> current_actions_;
- // The extensions that have called ExecuteScript on the current frame.
- std::set<std::string> extensions_executing_scripts_;
+ // The extensions that have actions in current_actions_.
+ std::set<std::string> extensions_in_current_actions_;
// Listen to extension unloaded notifications.
content::NotificationRegistrar registrar_;

Powered by Google App Engine
This is Rietveld 408576698