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

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

Issue 10388160: Only return the visible page actions from PageActionController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: actually fix Created 8 years, 7 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/extension_tab_helper.h
diff --git a/chrome/browser/extensions/extension_tab_helper.h b/chrome/browser/extensions/extension_tab_helper.h
index 16b4f5fcb391e9fe356ea6ada4ca0db3be3c0c53..686d77d8b8499ad7d6bc59dc395ce4e8392e3b74 100644
--- a/chrome/browser/extensions/extension_tab_helper.h
+++ b/chrome/browser/extensions/extension_tab_helper.h
@@ -7,6 +7,7 @@
#pragma once
#include "base/memory/weak_ptr.h"
+#include "base/observer_list.h"
#include "chrome/browser/extensions/app_notify_channel_setup.h"
#include "chrome/browser/extensions/extension_function_dispatcher.h"
#include "chrome/browser/extensions/image_loading_tracker.h"
@@ -24,6 +25,11 @@ namespace content {
struct LoadCommittedDetails;
}
+namespace extensions {
+class ActionBoxController;
+class ScriptExecutor;
+}
+
// Per-tab extension helper. Also handles non-extension apps.
class ExtensionTabHelper
: public content::WebContentsObserver,
@@ -33,6 +39,15 @@ class ExtensionTabHelper
public AppNotifyChannelSetup::Delegate,
public base::SupportsWeakPtr<ExtensionTabHelper> {
public:
+ class Observer {
+ public:
+ // Called when the page action state (such as visibility, title) changes.
+ virtual void OnPageActionStateChanged() = 0;
+
+ protected:
+ virtual ~Observer() {}
+ };
+
explicit ExtensionTabHelper(TabContentsWrapper* wrapper);
virtual ~ExtensionTabHelper();
@@ -50,6 +65,10 @@ class ExtensionTabHelper
// the data is available.
void GetApplicationInfo(int32 page_id);
+ // Observer management.
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
// App extensions ------------------------------------------------------------
// Sets the extension denoting this as an app. If |extension| is non-null this
@@ -90,6 +109,14 @@ class ExtensionTabHelper
return content::WebContentsObserver::web_contents();
}
+ extensions::ScriptExecutor* script_executor() {
+ return script_executor_.get();
+ }
+
+ extensions::ActionBoxController* action_box_controller() {
+ return action_box_controller_.get();
+ }
+
// Sets a non-extension app icon associated with WebContents and fires an
// INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title.
void SetAppIcon(const SkBitmap& app_icon);
@@ -150,6 +177,10 @@ class ExtensionTabHelper
// Data for app extensions ---------------------------------------------------
+ // Our observers. Declare at top so that it will outlive all other members,
+ // since they might add themselves as observers.
+ ObserverList<Observer> observers_;
+
// Delegate for notifying our owner about stuff. Not owned by us.
ExtensionTabHelperDelegate* delegate_;
@@ -172,6 +203,10 @@ class ExtensionTabHelper
TabContentsWrapper* wrapper_;
+ scoped_ptr<extensions::ScriptExecutor> script_executor_;
+
+ scoped_ptr<extensions::ActionBoxController> action_box_controller_;
+
DISALLOW_COPY_AND_ASSIGN(ExtensionTabHelper);
};
« no previous file with comments | « chrome/browser/extensions/execute_code_in_tab_function.cc ('k') | chrome/browser/extensions/extension_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698