summaryrefslogtreecommitdiffstats
path: root/extensions/renderer/extension_frame_helper.h
diff options
context:
space:
mode:
authorrdevlin.cronin <rdevlin.cronin@chromium.org>2015-06-19 11:58:51 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-19 19:00:11 +0000
commit6f42c2520140acb4f0e4bd24e597f974df5f8599 (patch)
tree46538c06ee7c7cea88050757f67c9ab90248dea2 /extensions/renderer/extension_frame_helper.h
parent827f05ffa204e546b0b884e82f2831371c7e9c89 (diff)
downloadchromium_src-6f42c2520140acb4f0e4bd24e597f974df5f8599.zip
chromium_src-6f42c2520140acb4f0e4bd24e597f974df5f8599.tar.gz
chromium_src-6f42c2520140acb4f0e4bd24e597f974df5f8599.tar.bz2
[Extensions OOPI] Move view type and window id registration to frames
Move the registration of ViewType and browser window id to ExtensionFrameHelper, so that it will work with OOPI. Also move browser window id registration to a single place (ChromeExtensionWebContentsObserver). This also lets us move GetExtensionViews() from ExtensionHelper. Also correct the RenderFrameHost listening in ExtensionWebContentsObserver. Cleanup along the way: make a ScriptContext::IsLazyBackgroundPage() method. BUG=455776 TBR=nasko@chromium.org (extension message rename) Review URL: https://codereview.chromium.org/1185373008 Cr-Commit-Position: refs/heads/master@{#335314}
Diffstat (limited to 'extensions/renderer/extension_frame_helper.h')
-rw-r--r--extensions/renderer/extension_frame_helper.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/extensions/renderer/extension_frame_helper.h b/extensions/renderer/extension_frame_helper.h
index 76135f1..67f793e 100644
--- a/extensions/renderer/extension_frame_helper.h
+++ b/extensions/renderer/extension_frame_helper.h
@@ -5,9 +5,12 @@
#ifndef EXTENSIONS_RENDERER_EXTENSION_FRAME_HELPER_H_
#define EXTENSIONS_RENDERER_EXTENSION_FRAME_HELPER_H_
+#include <vector>
+
#include "content/public/common/console_message_level.h"
#include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/render_frame_observer_tracker.h"
+#include "extensions/common/view_type.h"
struct ExtensionMsg_ExternalConnectionInfo;
struct ExtensionMsg_TabConnectionInfo;
@@ -20,6 +23,7 @@ namespace extensions {
class Dispatcher;
struct Message;
+class ScriptContext;
// RenderFrame-level plumbing for extension features.
class ExtensionFrameHelper
@@ -30,7 +34,28 @@ class ExtensionFrameHelper
Dispatcher* extension_dispatcher);
~ExtensionFrameHelper() override;
+ // Returns a list of extension RenderFrames that match the given filter
+ // criteria. A |browser_window_id| of extension_misc::kUnknownWindowId
+ // specifies "all", as does a |view_type| of VIEW_TYPE_INVALID.
+ static std::vector<content::RenderFrame*> GetExtensionFrames(
+ const std::string& extension_id,
+ int browser_window_id,
+ ViewType view_type);
+
+ // Returns the main frame of the extension's background page, or null if there
+ // isn't one in this process.
+ static content::RenderFrame* GetBackgroundPageFrame(
+ const std::string& extension_id);
+
+ // Returns true if the given |context| is for any frame in the extension's
+ // event page.
+ // TODO(devlin): This isn't really used properly, and should probably be
+ // deleted.
+ static bool IsContextForEventPage(const ScriptContext* context);
+
+ ViewType view_type() const { return view_type_; }
int tab_id() const { return tab_id_; }
+ int browser_window_id() const { return browser_window_id_; }
const std::string& tab_extension_owner_id() const {
return tab_extension_owner_id_;
}
@@ -57,15 +82,23 @@ class ExtensionFrameHelper
void OnExtensionDispatchOnDisconnect(int port_id,
const std::string& error_message);
void OnExtensionSetTabId(int tab_id);
- void OnSetTabExtensionOwner(const std::string& extension_id);
+ void OnSetMainFrameExtensionOwner(const std::string& extension_id);
+ void OnUpdateBrowserWindowId(int browser_window_id);
+ void OnNotifyRendererViewType(ViewType view_type);
void OnExtensionResponse(int request_id,
bool success,
const base::ListValue& response,
const std::string& error);
+ // Type of view associated with the RenderFrame.
+ ViewType view_type_;
+
// The id of the tab the render frame is attached to.
int tab_id_;
+ // The id of the browser window the render frame is attached to.
+ int browser_window_id_;
+
// The id of the extension that "owns" the tab if this is a chrome-extension
// page. If it's not a chrome-extension page, |tab_extension_owner_id_| is
// empty.