summaryrefslogtreecommitdiffstats
path: root/content/browser
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-08 00:40:46 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-08 00:40:46 +0000
commitba79ad5d4a87264442ba2a25b2647f7f82484e8c (patch)
treeb0cf7deae03f2fa5e15d1dba0ec01ba9e0bf2737 /content/browser
parentaef2ab36c08e90d35af176b8333750e4242d0fc9 (diff)
downloadchromium_src-ba79ad5d4a87264442ba2a25b2647f7f82484e8c.zip
chromium_src-ba79ad5d4a87264442ba2a25b2647f7f82484e8c.tar.gz
chromium_src-ba79ad5d4a87264442ba2a25b2647f7f82484e8c.tar.bz2
Have ExtensionHost use TabContents instead of RenderViewHost. This is part
of a larger refactor to eventually get rid of ExtensionHost as the container for background pages. BUG=84146 TEST=extensions (especially popups and infobars) should still work Review URL: http://codereview.chromium.org/8476010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108954 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
-rw-r--r--content/browser/tab_contents/tab_contents.cc12
-rw-r--r--content/browser/tab_contents/tab_contents.h168
-rw-r--r--content/browser/tab_contents/tab_contents_observer.cc3
-rw-r--r--content/browser/tab_contents/tab_contents_observer.h1
4 files changed, 100 insertions, 84 deletions
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 5e76850..2d17d15 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -202,8 +202,8 @@ TabContents::TabContents(content::BrowserContext* browser_context,
maximum_zoom_percent_(
static_cast<int>(WebKit::WebView::maxTextSizeMultiplier * 100)),
temporary_zoom_settings_(false),
- content_restrictions_(0) {
-
+ content_restrictions_(0),
+ view_type_(content::VIEW_TYPE_TAB_CONTENTS) {
render_manager_.Init(browser_context, site_instance, routing_id);
// We have the initial size of the view be based on the size of the passed in
@@ -1408,7 +1408,7 @@ TabContents* TabContents::GetAsTabContents() {
}
content::ViewType TabContents::GetRenderViewType() const {
- return content::VIEW_TYPE_TAB_CONTENTS;
+ return view_type_;
}
void TabContents::RenderViewCreated(RenderViewHost* render_view_host) {
@@ -1679,6 +1679,12 @@ void TabContents::DidChangeLoadProgress(double progress) {
delegate()->LoadProgressChanged(progress);
}
+void TabContents::DocumentAvailableInMainFrame(
+ RenderViewHost* render_view_host) {
+ FOR_EACH_OBSERVER(TabContentsObserver, observers_,
+ DocumentAvailableInMainFrame());
+}
+
void TabContents::DocumentOnLoadCompletedInMainFrame(
RenderViewHost* render_view_host,
int32 page_id) {
diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h
index 64eec1e..89e1a9e 100644
--- a/content/browser/tab_contents/tab_contents.h
+++ b/content/browser/tab_contents/tab_contents.h
@@ -103,6 +103,8 @@ class CONTENT_EXPORT TabContents : public PageNavigator,
return controller_.browser_context();
}
+ void set_view_type(content::ViewType view_type) { view_type_ = view_type; }
+
// Returns the SavePackage which manages the page saving job. May be NULL.
SavePackage* save_package() const { return save_package_.get(); }
@@ -464,6 +466,88 @@ class CONTENT_EXPORT TabContents : public PageNavigator,
// locked.
bool GotResponseToLockMouseRequest(bool allowed);
+ // RenderViewHostDelegate ----------------------------------------------------
+
+ virtual RenderViewHostDelegate::View* GetViewDelegate() OVERRIDE;
+ virtual RenderViewHostDelegate::RendererManagement*
+ GetRendererManagementDelegate() OVERRIDE;
+ virtual TabContents* GetAsTabContents() OVERRIDE;
+ virtual content::ViewType GetRenderViewType() const OVERRIDE;
+ virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
+ virtual void RenderViewReady(RenderViewHost* render_view_host) OVERRIDE;
+ virtual void RenderViewGone(RenderViewHost* render_view_host,
+ base::TerminationStatus status,
+ int error_code) OVERRIDE;
+ virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE;
+ virtual void DidNavigate(
+ RenderViewHost* render_view_host,
+ const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE;
+ virtual void UpdateState(RenderViewHost* render_view_host,
+ int32 page_id,
+ const std::string& state) OVERRIDE;
+ virtual void UpdateTitle(RenderViewHost* render_view_host,
+ int32 page_id,
+ const string16& title,
+ base::i18n::TextDirection title_direction) OVERRIDE;
+ virtual void UpdateEncoding(RenderViewHost* render_view_host,
+ const std::string& encoding) OVERRIDE;
+ virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE;
+ virtual void Close(RenderViewHost* render_view_host) OVERRIDE;
+ virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE;
+ virtual void DidStartLoading() OVERRIDE;
+ virtual void DidStopLoading() OVERRIDE;
+ virtual void DidCancelLoading() OVERRIDE;
+ virtual void DidChangeLoadProgress(double progress) OVERRIDE;
+ virtual void DocumentAvailableInMainFrame(
+ RenderViewHost* render_view_host) OVERRIDE;
+ virtual void DocumentOnLoadCompletedInMainFrame(
+ RenderViewHost* render_view_host,
+ int32 page_id) OVERRIDE;
+ virtual void RequestOpenURL(const GURL& url,
+ const GURL& referrer,
+ WindowOpenDisposition disposition,
+ int64 source_frame_id) OVERRIDE;
+ virtual void RunJavaScriptMessage(const RenderViewHost* rvh,
+ const string16& message,
+ const string16& default_prompt,
+ const GURL& frame_url,
+ const int flags,
+ IPC::Message* reply_msg,
+ bool* did_suppress_message) OVERRIDE;
+ virtual void RunBeforeUnloadConfirm(const RenderViewHost* rvh,
+ const string16& message,
+ IPC::Message* reply_msg) OVERRIDE;
+ virtual content::RendererPreferences GetRendererPrefs(
+ content::BrowserContext* browser_context) const OVERRIDE;
+ virtual WebPreferences GetWebkitPrefs() OVERRIDE;
+ virtual void OnUserGesture() OVERRIDE;
+ virtual void OnIgnoredUIEvent() OVERRIDE;
+ virtual void RendererUnresponsive(RenderViewHost* render_view_host,
+ bool is_during_unload) OVERRIDE;
+ virtual void RendererResponsive(RenderViewHost* render_view_host) OVERRIDE;
+ virtual void LoadStateChanged(const GURL& url,
+ const net::LoadStateWithParam& load_state,
+ uint64 upload_position,
+ uint64 upload_size) OVERRIDE;
+ virtual void WorkerCrashed() OVERRIDE;
+ virtual void Activate() OVERRIDE;
+ virtual void Deactivate() OVERRIDE;
+ virtual void LostCapture() OVERRIDE;
+ virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
+ bool* is_keyboard_shortcut) OVERRIDE;
+ virtual void HandleKeyboardEvent(
+ const NativeWebKeyboardEvent& event) OVERRIDE;
+ virtual void HandleMouseUp() OVERRIDE;
+ virtual void HandleMouseActivate() OVERRIDE;
+ virtual bool OnMessageReceived(const IPC::Message& message);
+ virtual void RunFileChooser(RenderViewHost* render_view_host,
+ const ViewHostMsg_RunFileChooser_Params& params);
+ virtual void ToggleFullscreenMode(bool enter_fullscreen) OVERRIDE;
+ virtual bool IsFullscreenForCurrentTab() const OVERRIDE;
+ virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE;
+ virtual void RequestToLockMouse() OVERRIDE;
+ virtual void LostMouseLock() OVERRIDE;
+
protected:
friend class TabContentsObserver;
@@ -609,87 +693,6 @@ class CONTENT_EXPORT TabContents : public PageNavigator,
void NotifyConnected();
void NotifyDisconnected();
- // RenderViewHostDelegate ----------------------------------------------------
-
- // RenderViewHostDelegate implementation.
- virtual RenderViewHostDelegate::View* GetViewDelegate() OVERRIDE;
- virtual RenderViewHostDelegate::RendererManagement*
- GetRendererManagementDelegate() OVERRIDE;
- virtual TabContents* GetAsTabContents() OVERRIDE;
- virtual content::ViewType GetRenderViewType() const OVERRIDE;
- virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
- virtual void RenderViewReady(RenderViewHost* render_view_host) OVERRIDE;
- virtual void RenderViewGone(RenderViewHost* render_view_host,
- base::TerminationStatus status,
- int error_code) OVERRIDE;
- virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE;
- virtual void DidNavigate(
- RenderViewHost* render_view_host,
- const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE;
- virtual void UpdateState(RenderViewHost* render_view_host,
- int32 page_id,
- const std::string& state) OVERRIDE;
- virtual void UpdateTitle(RenderViewHost* render_view_host,
- int32 page_id,
- const string16& title,
- base::i18n::TextDirection title_direction) OVERRIDE;
- virtual void UpdateEncoding(RenderViewHost* render_view_host,
- const std::string& encoding) OVERRIDE;
- virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE;
- virtual void Close(RenderViewHost* render_view_host) OVERRIDE;
- virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE;
- virtual void DidStartLoading() OVERRIDE;
- virtual void DidStopLoading() OVERRIDE;
- virtual void DidCancelLoading() OVERRIDE;
- virtual void DidChangeLoadProgress(double progress) OVERRIDE;
- virtual void DocumentOnLoadCompletedInMainFrame(
- RenderViewHost* render_view_host,
- int32 page_id) OVERRIDE;
- virtual void RequestOpenURL(const GURL& url,
- const GURL& referrer,
- WindowOpenDisposition disposition,
- int64 source_frame_id) OVERRIDE;
- virtual void RunJavaScriptMessage(const RenderViewHost* rvh,
- const string16& message,
- const string16& default_prompt,
- const GURL& frame_url,
- const int flags,
- IPC::Message* reply_msg,
- bool* did_suppress_message) OVERRIDE;
- virtual void RunBeforeUnloadConfirm(const RenderViewHost* rvh,
- const string16& message,
- IPC::Message* reply_msg) OVERRIDE;
- virtual content::RendererPreferences GetRendererPrefs(
- content::BrowserContext* browser_context) const OVERRIDE;
- virtual WebPreferences GetWebkitPrefs() OVERRIDE;
- virtual void OnUserGesture() OVERRIDE;
- virtual void OnIgnoredUIEvent() OVERRIDE;
- virtual void RendererUnresponsive(RenderViewHost* render_view_host,
- bool is_during_unload) OVERRIDE;
- virtual void RendererResponsive(RenderViewHost* render_view_host) OVERRIDE;
- virtual void LoadStateChanged(const GURL& url,
- const net::LoadStateWithParam& load_state,
- uint64 upload_position,
- uint64 upload_size) OVERRIDE;
- virtual void WorkerCrashed() OVERRIDE;
- virtual void Activate() OVERRIDE;
- virtual void Deactivate() OVERRIDE;
- virtual void LostCapture() OVERRIDE;
- virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
- bool* is_keyboard_shortcut) OVERRIDE;
- virtual void HandleKeyboardEvent(
- const NativeWebKeyboardEvent& event) OVERRIDE;
- virtual void HandleMouseUp() OVERRIDE;
- virtual void HandleMouseActivate() OVERRIDE;
- virtual bool OnMessageReceived(const IPC::Message& message);
- virtual void RunFileChooser(RenderViewHost* render_view_host,
- const ViewHostMsg_RunFileChooser_Params& params);
- virtual void ToggleFullscreenMode(bool enter_fullscreen) OVERRIDE;
- virtual bool IsFullscreenForCurrentTab() const OVERRIDE;
- virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE;
- virtual void RequestToLockMouse() OVERRIDE;
- virtual void LostMouseLock() OVERRIDE;
-
// RenderViewHostManager::Delegate -------------------------------------------
virtual void BeforeUnloadFiredFromRenderManager(
@@ -852,6 +855,9 @@ class CONTENT_EXPORT TabContents : public PageNavigator,
// (full-page plugins for now only) permissions.
int content_restrictions_;
+ // Our view type. Default is VIEW_TYPE_TAB_CONTENTS.
+ content::ViewType view_type_;
+
DISALLOW_COPY_AND_ASSIGN(TabContents);
};
diff --git a/content/browser/tab_contents/tab_contents_observer.cc b/content/browser/tab_contents/tab_contents_observer.cc
index c18b1f3..ac41d29 100644
--- a/content/browser/tab_contents/tab_contents_observer.cc
+++ b/content/browser/tab_contents/tab_contents_observer.cc
@@ -57,6 +57,9 @@ void TabContentsObserver::DidFailProvisionalLoad(
const string16& error_description) {
}
+void TabContentsObserver::DocumentAvailableInMainFrame() {
+}
+
void TabContentsObserver::DocumentLoadedInFrame(int64 frame_id) {
}
diff --git a/content/browser/tab_contents/tab_contents_observer.h b/content/browser/tab_contents/tab_contents_observer.h
index aed69ec..a7d55c3 100644
--- a/content/browser/tab_contents/tab_contents_observer.h
+++ b/content/browser/tab_contents/tab_contents_observer.h
@@ -50,6 +50,7 @@ class CONTENT_EXPORT TabContentsObserver : public IPC::Channel::Listener,
const GURL& validated_url,
int error_code,
const string16& error_description);
+ virtual void DocumentAvailableInMainFrame();
virtual void DocumentLoadedInFrame(int64 frame_id);
virtual void DidFinishLoad(int64 frame_id);
virtual void DidGetUserGesture();