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

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

Issue 10544185: Order the script badges in the location bar consistently (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 years, 6 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 e40ae493672d09cdee4823137bd44c3a02aa6f76..a26738292d324d73ba9fea31a1c02117264200b0 100644
--- a/chrome/browser/extensions/script_badge_controller.h
+++ b/chrome/browser/extensions/script_badge_controller.h
@@ -16,6 +16,8 @@
#include "chrome/browser/extensions/location_bar_controller.h"
#include "chrome/browser/extensions/script_executor.h"
#include "chrome/browser/extensions/script_executor_impl.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h"
class ExtensionAction;
@@ -48,7 +50,8 @@ class ScriptBadgeController
: public base::RefCountedThreadSafe<ScriptBadgeController>,
public LocationBarController,
public ScriptExecutor,
- public content::WebContentsObserver {
+ public content::WebContentsObserver,
+ public content::NotificationObserver {
public:
explicit ScriptBadgeController(TabContents* tab_contents);
@@ -94,19 +97,38 @@ class ScriptBadgeController
const content::FrameNavigateParams& params) OVERRIDE;
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+ // content::NotificationObserver implementation.
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
// IPC::Message handlers.
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);
+
+ // Tries to erase an extension from the relevant collections, and returns
+ // whether any change was made.
+ bool EraseExtension(const Extension* extension);
+
// Delegate ScriptExecutorImpl for running ExecuteScript.
ScriptExecutorImpl script_executor_;
// Our parent TabContents.
TabContents* tab_contents_;
+ // The current extension actions in the order they appeared.
+ std::vector<ExtensionAction*> current_actions_;
+
// The extensions that have called ExecuteScript on the current frame.
std::set<std::string> extensions_executing_scripts_;
+ // Listen to extension unloaded notifications.
+ content::NotificationRegistrar registrar_;
+
DISALLOW_COPY_AND_ASSIGN(ScriptBadgeController);
};

Powered by Google App Engine
This is Rietveld 408576698