summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/back_forward_menu_model_unittest.cc2
-rw-r--r--chrome/browser/blocked_popup_container_unittest.cc2
-rw-r--r--chrome/browser/cocoa/blocked_popup_container_controller_unittest.mm2
-rw-r--r--chrome/browser/debugger/devtools_manager_unittest.cc2
-rw-r--r--chrome/browser/dom_ui/dom_ui_unittest.cc2
-rw-r--r--chrome/browser/download/download_request_manager_unittest.cc2
-rw-r--r--chrome/browser/download/save_package.h1
-rw-r--r--chrome/browser/extensions/extension_host.cc53
-rw-r--r--chrome/browser/extensions/extension_host.h21
-rw-r--r--chrome/browser/find_backend_unittest.cc2
-rw-r--r--chrome/browser/renderer_host/DEPS12
-rw-r--r--chrome/browser/renderer_host/cross_site_resource_handler.cc33
-rw-r--r--chrome/browser/renderer_host/render_view_host_delegate.cc50
-rw-r--r--chrome/browser/renderer_host/render_view_host_delegate.h185
-rw-r--r--chrome/browser/renderer_host/render_widget_host_unittest.cc2
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.cc8
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.h13
-rw-r--r--chrome/browser/renderer_host/test/DEPS4
-rw-r--r--chrome/browser/renderer_host/test/README.txt4
-rwxr-xr-xchrome/browser/renderer_host/test/render_view_host_manager_browsertest.cc (renamed from chrome/browser/renderer_host/render_view_host_manager_browsertest.cc)0
-rw-r--r--chrome/browser/renderer_host/test/render_view_host_unittest.cc (renamed from chrome/browser/renderer_host/render_view_host_unittest.cc)2
-rw-r--r--chrome/browser/renderer_host/test/site_instance_unittest.cc (renamed from chrome/browser/renderer_host/site_instance_unittest.cc)2
-rw-r--r--chrome/browser/renderer_host/test/test_render_view_host.cc (renamed from chrome/browser/renderer_host/test_render_view_host.cc)2
-rw-r--r--chrome/browser/renderer_host/test/test_render_view_host.h (renamed from chrome/browser/renderer_host/test_render_view_host.h)6
-rw-r--r--chrome/browser/renderer_host/test/web_cache_manager_browsertest.cc (renamed from chrome/browser/renderer_host/web_cache_manager_browser_test.cc)0
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc2
-rw-r--r--chrome/browser/sessions/tab_restore_service_unittest.cc2
-rw-r--r--chrome/browser/tab_contents/interstitial_page.cc136
-rw-r--r--chrome/browser/tab_contents/interstitial_page.h18
-rw-r--r--chrome/browser/tab_contents/navigation_controller_unittest.cc2
-rw-r--r--chrome/browser/tab_contents/render_view_host_manager_unittest.cc2
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc25
-rw-r--r--chrome/browser/tab_contents/tab_contents.h18
-rw-r--r--chrome/browser/tab_contents/test_web_contents.cc2
-rwxr-xr-xchrome/browser/tab_contents/thumbnail_generator_unittest.cc2
-rw-r--r--chrome/browser/tab_contents/web_contents_unittest.cc2
-rw-r--r--chrome/browser/tabs/tab_strip_model_unittest.cc2
-rw-r--r--chrome/browser/visitedlink_unittest.cc2
-rw-r--r--chrome/chrome.gyp13
-rw-r--r--chrome/test/browser_with_test_window_test.h2
40 files changed, 363 insertions, 279 deletions
diff --git a/chrome/browser/back_forward_menu_model_unittest.cc b/chrome/browser/back_forward_menu_model_unittest.cc
index 6f442e5..1cc6823 100644
--- a/chrome/browser/back_forward_menu_model_unittest.cc
+++ b/chrome/browser/back_forward_menu_model_unittest.cc
@@ -9,7 +9,7 @@
#include "base/path_service.h"
#include "base/string_util.h"
#include "chrome/browser/profile_manager.h"
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
diff --git a/chrome/browser/blocked_popup_container_unittest.cc b/chrome/browser/blocked_popup_container_unittest.cc
index 6d872f3..b23cab7 100644
--- a/chrome/browser/blocked_popup_container_unittest.cc
+++ b/chrome/browser/blocked_popup_container_unittest.cc
@@ -14,7 +14,7 @@
#include "base/path_service.h"
#include "chrome/browser/blocked_popup_container.h"
#include "chrome/browser/tab_contents/test_web_contents.h"
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/test/testing_profile.h"
#include "net/base/net_util.h"
diff --git a/chrome/browser/cocoa/blocked_popup_container_controller_unittest.mm b/chrome/browser/cocoa/blocked_popup_container_controller_unittest.mm
index 256fb4a..393d4a6 100644
--- a/chrome/browser/cocoa/blocked_popup_container_controller_unittest.mm
+++ b/chrome/browser/cocoa/blocked_popup_container_controller_unittest.mm
@@ -10,7 +10,7 @@
#import "chrome/browser/cocoa/blocked_popup_container_controller.h"
#include "chrome/browser/cocoa/browser_test_helper.h"
#import "chrome/browser/cocoa/cocoa_test_helper.h"
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "net/base/net_util.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/debugger/devtools_manager_unittest.cc b/chrome/browser/debugger/devtools_manager_unittest.cc
index a8a9e7a..ddcc54f 100644
--- a/chrome/browser/debugger/devtools_manager_unittest.cc
+++ b/chrome/browser/debugger/devtools_manager_unittest.cc
@@ -6,7 +6,7 @@
#include "chrome/browser/debugger/devtools_client_host.h"
#include "chrome/browser/debugger/devtools_manager.h"
#include "chrome/browser/debugger/devtools_window.h"
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "chrome/common/render_messages.h"
diff --git a/chrome/browser/dom_ui/dom_ui_unittest.cc b/chrome/browser/dom_ui/dom_ui_unittest.cc
index 43a3f71..4b7015d 100644
--- a/chrome/browser/dom_ui/dom_ui_unittest.cc
+++ b/chrome/browser/dom_ui/dom_ui_unittest.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "chrome/browser/dom_ui/new_tab_ui.h"
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/common/url_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/download/download_request_manager_unittest.cc b/chrome/browser/download/download_request_manager_unittest.cc
index a8ece7a..a9f6382 100644
--- a/chrome/browser/download/download_request_manager_unittest.cc
+++ b/chrome/browser/download/download_request_manager_unittest.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "chrome/browser/download/download_request_manager.h"
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/test/testing_profile.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/download/save_package.h b/chrome/browser/download/save_package.h
index ef475db..8d120602 100644
--- a/chrome/browser/download/save_package.h
+++ b/chrome/browser/download/save_package.h
@@ -15,6 +15,7 @@
#include "base/ref_counted.h"
#include "chrome/browser/renderer_host/render_view_host_delegate.h"
#include "chrome/browser/shell_dialogs.h"
+#include "googleurl/src/gurl.h"
class SaveFileManager;
class SaveItem;
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index 15319b3..2169a80 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -165,25 +165,6 @@ void ExtensionHost::RenderViewGone(RenderViewHost* render_view_host) {
Details<ExtensionHost>(this));
}
-WebPreferences ExtensionHost::GetWebkitPrefs() {
- PrefService* prefs = render_view_host()->process()->profile()->GetPrefs();
- const bool kIsDomUI = true;
- return RenderViewHostDelegateHelper::GetWebkitPrefs(prefs, kIsDomUI);
-}
-
-void ExtensionHost::RunJavaScriptMessage(
- const std::wstring& message,
- const std::wstring& default_prompt,
- const GURL& frame_url,
- const int flags,
- IPC::Message* reply_msg,
- bool* did_suppress_message) {
- // Automatically cancel the javascript alert (otherwise the renderer hangs
- // indefinitely).
- *did_suppress_message = true;
- render_view_host()->JavaScriptMessageBoxClosed(reply_msg, true, L"");
-}
-
void ExtensionHost::DidStopLoading(RenderViewHost* render_view_host) {
// TODO(aa): This is toolstrip-specific and should probably not be here.
// ExtensionToolstrip in bookmark_bar_view.cc?
@@ -195,6 +176,32 @@ void ExtensionHost::DidStopLoading(RenderViewHost* render_view_host) {
did_stop_loading_ = true;
}
+void ExtensionHost::RunJavaScriptMessage(const std::wstring& message,
+ const std::wstring& default_prompt,
+ const GURL& frame_url,
+ const int flags,
+ IPC::Message* reply_msg,
+ bool* did_suppress_message) {
+ // Automatically cancel the javascript alert (otherwise the renderer hangs
+ // indefinitely).
+ *did_suppress_message = true;
+ render_view_host()->JavaScriptMessageBoxClosed(reply_msg, true, L"");
+}
+
+WebPreferences ExtensionHost::GetWebkitPrefs() {
+ PrefService* prefs = render_view_host()->process()->profile()->GetPrefs();
+ const bool kIsDomUI = true;
+ return RenderViewHostDelegateHelper::GetWebkitPrefs(prefs, kIsDomUI);
+}
+
+void ExtensionHost::ProcessDOMUIMessage(const std::string& message,
+ const std::string& content,
+ int request_id,
+ bool has_callback) {
+ extension_function_dispatcher_->HandleRequest(message, content, request_id,
+ has_callback);
+}
+
void ExtensionHost::DidInsertCSS() {
#if defined(TOOLKIT_VIEWS)
if (view_.get())
@@ -304,14 +311,6 @@ Browser* ExtensionHost::GetBrowser() {
return browser;
}
-void ExtensionHost::ProcessDOMUIMessage(const std::string& message,
- const std::string& content,
- int request_id,
- bool has_callback) {
- extension_function_dispatcher_->HandleRequest(message, content, request_id,
- has_callback);
-}
-
void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) {
extension_function_dispatcher_.reset(
new ExtensionFunctionDispatcher(render_view_host_, this, url_));
diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h
index a3b04f2..b2f32b2 100644
--- a/chrome/browser/extensions/extension_host.h
+++ b/chrome/browser/extensions/extension_host.h
@@ -65,25 +65,24 @@ class ExtensionHost : public RenderViewHostDelegate,
// process crashed.
void RecoverCrashedExtension();
- // RenderViewHostDelegate
+ // RenderViewHostDelegate implementation.
+ virtual RenderViewHostDelegate::View* GetViewDelegate() const;
virtual const GURL& GetURL() const { return url_; }
virtual void RenderViewCreated(RenderViewHost* render_view_host);
virtual void RenderViewGone(RenderViewHost* render_view_host);
- virtual WebPreferences GetWebkitPrefs();
- virtual void RunJavaScriptMessage(
- const std::wstring& message,
- const std::wstring& default_prompt,
- const GURL& frame_url,
- const int flags,
- IPC::Message* reply_msg,
- bool* did_suppress_message);
virtual void DidStopLoading(RenderViewHost* render_view_host);
- virtual RenderViewHostDelegate::View* GetViewDelegate() const;
- virtual void DidInsertCSS();
+ virtual WebPreferences GetWebkitPrefs();
virtual void ProcessDOMUIMessage(const std::string& message,
const std::string& content,
int request_id,
bool has_callback);
+ virtual void RunJavaScriptMessage(const std::wstring& message,
+ const std::wstring& default_prompt,
+ const GURL& frame_url,
+ const int flags,
+ IPC::Message* reply_msg,
+ bool* did_suppress_message);
+ virtual void DidInsertCSS();
// RenderViewHostDelegate::View
virtual void CreateNewWindow(int route_id,
diff --git a/chrome/browser/find_backend_unittest.cc b/chrome/browser/find_backend_unittest.cc
index e986d5a..afe555a 100644
--- a/chrome/browser/find_backend_unittest.cc
+++ b/chrome/browser/find_backend_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/common/url_constants.h"
typedef RenderViewHostTestHarness FindBackendTest;
diff --git a/chrome/browser/renderer_host/DEPS b/chrome/browser/renderer_host/DEPS
new file mode 100644
index 0000000..1c0609d5
--- /dev/null
+++ b/chrome/browser/renderer_host/DEPS
@@ -0,0 +1,12 @@
+include_rules = [
+ # DO NOT ALLOW tab_contents INCLUDES FROM THIS DIRECTORY! The renderer_host
+ # layer should be usable in contexts other than inside TabContents. Instead,
+ # you should call upward through the RenderViewHostDelegate interface. If
+ # your test needs some TabContents code, you can put it in renderer_host/test
+ # which can include more stuff for testing purposes.
+ #
+ # If somebody adds an include and you're fixing the build, please revert them
+ # instead of commenting out this rule.
+ "-chrome/browser/tab_contents",
+]
+
diff --git a/chrome/browser/renderer_host/cross_site_resource_handler.cc b/chrome/browser/renderer_host/cross_site_resource_handler.cc
index 5064a34..2580344 100644
--- a/chrome/browser/renderer_host/cross_site_resource_handler.cc
+++ b/chrome/browser/renderer_host/cross_site_resource_handler.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,18 +6,18 @@
#include "chrome/browser/renderer_host/cross_site_resource_handler.h"
+#include "base/message_loop.h"
#include "chrome/browser/renderer_host/render_view_host.h"
-#include "chrome/browser/tab_contents/tab_util.h"
-#include "chrome/browser/tab_contents/tab_contents.h"
namespace {
+
// Task to notify the TabContents that a cross-site response has begun, so that
// TabContents can tell the old page to run its onunload handler.
-class CrossSiteNotifyTabTask : public Task {
+class CrossSiteNotifyTask : public Task {
public:
- CrossSiteNotifyTabTask(int render_process_host_id,
- int render_view_id,
- int request_id)
+ CrossSiteNotifyTask(int render_process_host_id,
+ int render_view_id,
+ int request_id)
: render_process_host_id_(render_process_host_id),
render_view_id_(render_view_id),
request_id_(request_id) {}
@@ -48,17 +48,18 @@ class CancelPendingRenderViewTask : public Task {
render_view_id_(render_view_id) {}
void Run() {
- TabContents* tab_contents =
- tab_util::GetTabContentsByID(render_process_host_id_, render_view_id_);
- if (tab_contents)
- tab_contents->CrossSiteNavigationCanceled();
+ RenderViewHost* view =
+ RenderViewHost::FromID(render_process_host_id_, render_view_id_);
+ if (view)
+ view->delegate()->OnCrossSiteNavigationCanceled();
}
private:
int render_process_host_id_;
int render_view_id_;
};
-}
+
+} // namespace
CrossSiteResourceHandler::CrossSiteResourceHandler(
ResourceHandler* handler,
@@ -250,9 +251,9 @@ void CrossSiteResourceHandler::StartCrossSiteTransition(
// Tell the tab responsible for this request that a cross-site response is
// starting, so that it can tell its old renderer to run its onunload
// handler now. We will wait to hear the corresponding ClosePage_ACK.
- CrossSiteNotifyTabTask* task =
- new CrossSiteNotifyTabTask(render_process_host_id_,
- render_view_id_,
- request_id);
+ CrossSiteNotifyTask* task =
+ new CrossSiteNotifyTask(render_process_host_id_,
+ render_view_id_,
+ request_id);
rdh_->ui_loop()->PostTask(FROM_HERE, task);
}
diff --git a/chrome/browser/renderer_host/render_view_host_delegate.cc b/chrome/browser/renderer_host/render_view_host_delegate.cc
new file mode 100644
index 0000000..4e05a60
--- /dev/null
+++ b/chrome/browser/renderer_host/render_view_host_delegate.cc
@@ -0,0 +1,50 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/renderer_host/render_view_host_delegate.h"
+
+#include "base/gfx/rect.h"
+#include "chrome/common/renderer_preferences.h"
+#include "googleurl/src/gurl.h"
+#include "webkit/glue/webpreferences.h"
+
+RenderViewHostDelegate::View* RenderViewHostDelegate::GetViewDelegate() const {
+ return NULL;
+}
+
+RenderViewHostDelegate::Save* RenderViewHostDelegate::GetSaveDelegate() const {
+ return NULL;
+}
+
+const GURL& RenderViewHostDelegate::GetURL() const {
+ return GURL::EmptyGURL();
+}
+
+TabContents* RenderViewHostDelegate::GetAsTabContents() {
+ return NULL;
+}
+
+GURL RenderViewHostDelegate::GetAlternateErrorPageURL() const {
+ return GURL();
+}
+
+RendererPreferences RenderViewHostDelegate::GetRendererPrefs() const {
+ return RendererPreferences();
+}
+
+WebPreferences RenderViewHostDelegate::GetWebkitPrefs() {
+ return WebPreferences();
+}
+
+bool RenderViewHostDelegate::CanBlur() const {
+ return true;
+}
+
+gfx::Rect RenderViewHostDelegate::GetRootWindowResizerRect() const {
+ return gfx::Rect();
+}
+
+bool RenderViewHostDelegate::IsExternalTabContainer() const {
+ return false;
+}
diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h
index ec409d9..e3fe34a 100644
--- a/chrome/browser/renderer_host/render_view_host_delegate.h
+++ b/chrome/browser/renderer_host/render_view_host_delegate.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,41 +9,45 @@
#include <vector>
#include "base/basictypes.h"
-#include "base/file_path.h"
-#include "base/gfx/rect.h"
-#include "base/logging.h"
-#include "chrome/common/native_web_keyboard_event.h"
-#include "chrome/common/renderer_preferences.h"
+#include "base/string16.h"
#include "net/base/load_states.h"
-#include "webkit/glue/password_form.h"
-#include "webkit/glue/webpreferences.h"
#include "webkit/glue/window_open_disposition.h"
class AutofillForm;
+struct ContextMenuParams;
+class FilePath;
+class GURL;
+struct NativeWebKeyboardEvent;
class NavigationEntry;
class Profile;
+struct RendererPreferences;
class RenderProcessHost;
class RenderViewHost;
class ResourceRequestDetails;
class SkBitmap;
class TabContents;
-class WebKeyboardEvent;
struct ThumbnailScore;
-struct ContextMenuParams;
struct ViewHostMsg_DidPrintPage_Params;
struct ViewHostMsg_FrameNavigate_Params;
struct WebDropData;
+class WebKeyboardEvent;
+struct WebPreferences;
namespace base {
class WaitableEvent;
}
+namespace gfx {
+class Rect;
+}
+
namespace IPC {
class Message;
}
namespace webkit_glue {
class AutofillForm;
+struct PasswordForm;
struct WebApplicationInfo;
}
@@ -153,74 +157,76 @@ class RenderViewHostDelegate {
int32 status) = 0;
};
- // Returns the current delegate associated with a feature. May be NULL.
- virtual View* GetViewDelegate() const { return NULL; }
- virtual Save* GetSaveDelegate() const { return NULL; }
+ // Returns the current delegate associated with a feature. May return NULL if
+ // there is no corresponding delegate.
+ virtual View* GetViewDelegate() const;
+ virtual Save* GetSaveDelegate() const;
// Gets the URL that is currently being displayed, if there is one.
- virtual const GURL& GetURL() const = 0;
+ virtual const GURL& GetURL() const;
- // Return this object cast to a TabContents, if it is one.
- virtual TabContents* GetAsTabContents() { return NULL; }
+ // Return this object cast to a TabContents, if it is one. If the object is
+ // not a TabContents, returns NULL.
+ virtual TabContents* GetAsTabContents();
// The RenderView is being constructed (message sent to the renderer process
// to construct a RenderView). Now is a good time to send other setup events
// to the RenderView. This precedes any other commands to the RenderView.
- virtual void RenderViewCreated(RenderViewHost* render_view_host) { }
+ virtual void RenderViewCreated(RenderViewHost* render_view_host) {}
// The RenderView has been constructed.
- virtual void RenderViewReady(RenderViewHost* render_view_host) { }
+ virtual void RenderViewReady(RenderViewHost* render_view_host) {}
// The RenderView died somehow (crashed or was killed by the user).
- virtual void RenderViewGone(RenderViewHost* render_view_host) { }
+ virtual void RenderViewGone(RenderViewHost* render_view_host) {}
// The RenderView was navigated to a different page.
virtual void DidNavigate(RenderViewHost* render_view_host,
- const ViewHostMsg_FrameNavigate_Params& params) { }
+ const ViewHostMsg_FrameNavigate_Params& params) {}
// The state for the page changed and should be updated.
virtual void UpdateState(RenderViewHost* render_view_host,
int32 page_id,
- const std::string& state) { }
+ const std::string& state) {}
// The page's title was changed and should be updated.
virtual void UpdateTitle(RenderViewHost* render_view_host,
int32 page_id,
- const std::wstring& title) { }
+ const std::wstring& title) {}
// The page's encoding was changed and should be updated.
virtual void UpdateEncoding(RenderViewHost* render_view_host,
- const std::wstring& encoding) { }
+ const std::wstring& encoding) {}
// The destination URL has changed should be updated
- virtual void UpdateTargetURL(int32 page_id, const GURL& url) { }
+ virtual void UpdateTargetURL(int32 page_id, const GURL& url) {}
// The thumbnail representation of the page changed and should be updated.
virtual void UpdateThumbnail(const GURL& url,
const SkBitmap& bitmap,
- const ThumbnailScore& score) { }
+ const ThumbnailScore& score) {}
// Inspector settings were changes and should be persisted.
- virtual void UpdateInspectorSettings(const std::wstring& raw_settings) { }
+ virtual void UpdateInspectorSettings(const std::wstring& raw_settings) {}
// The page is trying to close the RenderView's representation in the client.
- virtual void Close(RenderViewHost* render_view_host) { }
+ virtual void Close(RenderViewHost* render_view_host) {}
// The page is trying to move the RenderView's representation in the client.
- virtual void RequestMove(const gfx::Rect& new_bounds) { }
+ virtual void RequestMove(const gfx::Rect& new_bounds) {}
// The RenderView began loading a new page. This corresponds to WebKit's
// notion of the throbber starting.
- virtual void DidStartLoading(RenderViewHost* render_view_host) { }
+ virtual void DidStartLoading(RenderViewHost* render_view_host) {}
// The RenderView stopped loading a page. This corresponds to WebKit's
// notion of the throbber stopping.
- virtual void DidStopLoading(RenderViewHost* render_view_host) { }
+ virtual void DidStopLoading(RenderViewHost* render_view_host) {}
// The RenderView is starting a provisional load.
virtual void DidStartProvisionalLoadForFrame(RenderViewHost* render_view_host,
bool is_main_frame,
- const GURL& url) { }
+ const GURL& url) {}
// Notification by the resource loading system (not the renderer) that it has
// started receiving a resource response. This is different than
@@ -235,7 +241,7 @@ class RenderViewHostDelegate {
// Sent when a provisional load is redirected.
virtual void DidRedirectProvisionalLoad(int32 page_id,
const GURL& source_url,
- const GURL& target_url) { }
+ const GURL& target_url) {}
// Notification by the resource loading system (not the renderer) that a
// resource was redirected. This is different than DidRedirectProvisionalLoad
@@ -253,7 +259,7 @@ class RenderViewHostDelegate {
const GURL& url,
const std::string& frame_origin,
const std::string& main_frame_origin,
- const std::string& security_info) { }
+ const std::string& security_info) {}
// The RenderView failed a provisional load with an error.
virtual void DidFailProvisionalLoadWithError(
@@ -261,11 +267,11 @@ class RenderViewHostDelegate {
bool is_main_frame,
int error_code,
const GURL& url,
- bool showing_repost_interstitial) { }
+ bool showing_repost_interstitial) {}
// The URL for the FavIcon of a page has changed.
virtual void UpdateFavIconURL(RenderViewHost* render_view_host,
- int32 page_id, const GURL& icon_url) { }
+ int32 page_id, const GURL& icon_url) {}
// An image that was requested to be downloaded by DownloadImage has
// completed.
@@ -273,51 +279,49 @@ class RenderViewHostDelegate {
int id,
const GURL& image_url,
bool errored,
- const SkBitmap& image) { }
+ const SkBitmap& image) {}
// The page wants to open a URL with the specified disposition.
virtual void RequestOpenURL(const GURL& url,
const GURL& referrer,
- WindowOpenDisposition disposition) { }
+ WindowOpenDisposition disposition) {}
// A DOM automation operation completed. The result of the operation is
// expressed in a json string.
virtual void DomOperationResponse(const std::string& json_string,
- int automation_id) { }
+ int automation_id) {}
// A message was sent from HTML-based UI.
// By default we ignore such messages.
virtual void ProcessDOMUIMessage(const std::string& message,
const std::string& content,
int request_id,
- bool has_callback) { }
+ bool has_callback) {}
// A message for external host. By default we ignore such messages.
// |receiver| can be a receiving script and |message| is any
// arbitrary string that makes sense to the receiver.
virtual void ProcessExternalHostMessage(const std::string& message,
const std::string& origin,
- const std::string& target) {
- }
+ const std::string& target) {}
- // A document has been loaded in a frame.
- virtual void DocumentLoadedInFrame() {
- }
+ // Notification that a document has been loaded in a frame.
+ virtual void DocumentLoadedInFrame() {}
// Navigate to the history entry for the given offset from the current
// position within the NavigationController. Makes no change if offset is
// not valid.
- virtual void GoToEntryAtOffset(int offset) { }
+ virtual void GoToEntryAtOffset(int offset) {}
// The page requests the size of the back and forward lists
// within the NavigationController.
virtual void GetHistoryListCount(int* back_list_count,
- int* forward_list_count) { }
+ int* forward_list_count) {}
// A file chooser should be shown.
virtual void RunFileChooser(bool multiple_files,
const string16& title,
- const FilePath& default_file) { }
+ const FilePath& default_file) {}
// A javascript message, confirmation or prompt should be shown.
virtual void RunJavaScriptMessage(const std::wstring& message,
@@ -325,24 +329,21 @@ class RenderViewHostDelegate {
const GURL& frame_url,
const int flags,
IPC::Message* reply_msg,
- bool* did_suppress_message) { }
+ bool* did_suppress_message) {}
virtual void RunBeforeUnloadConfirm(const std::wstring& message,
- IPC::Message* reply_msg) { }
-
- // Display this RenderViewHost in a modal fashion.
- virtual void RunModal(IPC::Message* reply_msg) { }
+ IPC::Message* reply_msg) {}
virtual void ShowModalHTMLDialog(const GURL& url, int width, int height,
const std::string& json_arguments,
- IPC::Message* reply_msg) { }
+ IPC::Message* reply_msg) {}
// Password forms have been detected in the page.
virtual void PasswordFormsSeen(
- const std::vector<webkit_glue::PasswordForm>& forms) { }
+ const std::vector<webkit_glue::PasswordForm>& forms) {}
// Forms fillable by autofill have been detected in the page.
- virtual void AutofillFormSubmitted(const webkit_glue::AutofillForm& form) { }
+ virtual void AutofillFormSubmitted(const webkit_glue::AutofillForm& form) {}
// Called to retrieve a list of suggestions from the web database given
// the name of the field |field_name| and what the user has already typed in
@@ -353,118 +354,112 @@ class RenderViewHostDelegate {
virtual void GetAutofillSuggestions(const std::wstring& field_name,
const std::wstring& user_text,
int64 node_id,
- int request_id) { }
+ int request_id) {}
// Called when the user has indicated that she wants to remove the specified
// autofill suggestion from the database.
virtual void RemoveAutofillEntry(const std::wstring& field_name,
- const std::wstring& value) { }
+ const std::wstring& value) {}
// Notification that the page has an OpenSearch description document.
virtual void PageHasOSDD(RenderViewHost* render_view_host,
int32 page_id, const GURL& doc_url,
- bool autodetected) { }
+ bool autodetected) {}
// Notification that the render view has calculated the number of printed
// pages.
- virtual void DidGetPrintedPagesCount(int cookie, int number_pages) {
- NOTREACHED();
- }
+ virtual void DidGetPrintedPagesCount(int cookie, int number_pages) {}
// Notification that the render view is done rendering one printed page. This
// call is synchronous, the renderer is waiting on us because of the EMF
// memory mapped data.
- virtual void DidPrintPage(const ViewHostMsg_DidPrintPage_Params& params) {
- NOTREACHED();
- }
+ virtual void DidPrintPage(const ViewHostMsg_DidPrintPage_Params& params) {}
// |url| is assigned to a server that can provide alternate error pages. If
- // unchanged, just use the error pages built into our webkit.
- virtual GURL GetAlternateErrorPageURL() const {
- return GURL();
- }
+ // the returned URL is empty, the default error page built into WebKit will
+ // be used.
+ virtual GURL GetAlternateErrorPageURL() const;
// Return a dummy RendererPreferences object that will be used by the renderer
// associated with the owning RenderViewHost.
- virtual RendererPreferences GetRendererPrefs() const {
- return RendererPreferences();
- }
+ virtual RendererPreferences GetRendererPrefs() const;
// Returns a WebPreferences object that will be used by the renderer
// associated with the owning render view host.
- virtual WebPreferences GetWebkitPrefs() {
- NOTREACHED();
- return WebPreferences();
- }
+ virtual WebPreferences GetWebkitPrefs();
// Notification when default plugin updates status of the missing plugin.
- virtual void OnMissingPluginStatus(int status) { }
+ virtual void OnMissingPluginStatus(int status) {}
// Notification from the renderer that a plugin instance has crashed.
- virtual void OnCrashedPlugin(const FilePath& plugin_path) { }
+ virtual void OnCrashedPlugin(const FilePath& plugin_path) {}
// Notification that a worker process has crashed.
- virtual void OnCrashedWorker() { }
+ virtual void OnCrashedWorker() {}
// Notification from the renderer that JS runs out of memory.
- virtual void OnJSOutOfMemory() { }
+ virtual void OnJSOutOfMemory() {}
// Notification whether we should close the page, after an explicit call to
// AttemptToClosePage. This is called before a cross-site request or before
// a tab/window is closed, to allow the appropriate renderer to approve or
// deny the request. |proceed| indicates whether the user chose to proceed.
- virtual void ShouldClosePage(bool proceed) { }
+ virtual void ShouldClosePage(bool proceed) {}
// Called by ResourceDispatcherHost when a response for a pending cross-site
// request is received. The ResourceDispatcherHost will pause the response
// until the onunload handler of the previous renderer is run.
virtual void OnCrossSiteResponse(int new_render_process_host_id,
- int new_request_id) { }
+ int new_request_id) {}
+
+ // Called the ResourceDispatcherHost's associate CrossSiteRequestHandler
+ // when a cross-site navigation has been canceled.
+ virtual void OnCrossSiteNavigationCanceled() {}
- // Whether this object can be blurred through a javascript
- // obj.blur() call. ConstrainedWindows shouldn't be able to be
- // blurred.
- virtual bool CanBlur() const { return true; }
+ // Returns true if this this object can be blurred through a javascript
+ // obj.blur() call. ConstrainedWindows shouldn't be able to be blurred, but
+ // generally most other windows will be.
+ virtual bool CanBlur() const;
// Return the rect where to display the resize corner, if any, otherwise
// an empty rect.
- virtual gfx::Rect GetRootWindowResizerRect() const { return gfx::Rect(); }
+ virtual gfx::Rect GetRootWindowResizerRect() const;
// Notification that the renderer has become unresponsive. The
// delegate can use this notification to show a warning to the user.
virtual void RendererUnresponsive(RenderViewHost* render_view_host,
- bool is_during_unload) { }
+ bool is_during_unload) {}
// Notification that a previously unresponsive renderer has become
// responsive again. The delegate can use this notification to end the
// warning shown to the user.
- virtual void RendererResponsive(RenderViewHost* render_view_host) { }
+ virtual void RendererResponsive(RenderViewHost* render_view_host) {}
// Notification that the RenderViewHost's load state changed.
- virtual void LoadStateChanged(const GURL& url, net::LoadState load_state) { }
+ virtual void LoadStateChanged(const GURL& url, net::LoadState load_state) {}
// Notification that a request for install info has completed.
virtual void OnDidGetApplicationInfo(
int32 page_id,
- const webkit_glue::WebApplicationInfo& app_info) { }
+ const webkit_glue::WebApplicationInfo& app_info) {}
// Notification the user has made a gesture while focus was on the
// page. This is used to avoid uninitiated user downloads (aka carpet
// bombing), see DownloadRequestManager for details.
- virtual void OnUserGesture() { }
+ virtual void OnUserGesture() {}
- // If this view is used to host an external tab container.
- virtual bool IsExternalTabContainer() const { return false; }
+ // Returns true if this view is used to host an external tab container.
+ virtual bool IsExternalTabContainer() const;
// A find operation in the current page completed.
virtual void OnFindReply(int request_id,
int number_of_matches,
const gfx::Rect& selection_rect,
int active_match_ordinal,
- bool final_update) { }
+ bool final_update) {}
// The RenderView has inserted one css file into page.
- virtual void DidInsertCSS() { }
+ virtual void DidInsertCSS() {}
};
#endif // CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_
diff --git a/chrome/browser/renderer_host/render_widget_host_unittest.cc b/chrome/browser/renderer_host/render_widget_host_unittest.cc
index f41aa29..1b05260 100644
--- a/chrome/browser/renderer_host/render_widget_host_unittest.cc
+++ b/chrome/browser/renderer_host/render_widget_host_unittest.cc
@@ -9,7 +9,7 @@
#include "base/shared_memory.h"
#include "build/build_config.h"
#include "chrome/browser/renderer_host/backing_store.h"
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/common/render_messages.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc
index 4a6fc9c..28a64a3 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc
@@ -37,7 +37,6 @@
#include "chrome/browser/renderer_host/sync_resource_handler.h"
#include "chrome/browser/ssl/ssl_client_auth_handler.h"
#include "chrome/browser/ssl/ssl_manager.h"
-#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/render_messages.h"
@@ -85,7 +84,8 @@ bool ResourceDispatcherHost::g_is_http_prioritization_enabled = true;
class ResourceDispatcherHost::ShutdownTask : public Task {
public:
explicit ShutdownTask(ResourceDispatcherHost* resource_dispatcher_host)
- : rdh_(resource_dispatcher_host) { }
+ : rdh_(resource_dispatcher_host) {
+ }
void Run() {
rdh_->OnShutdown();
@@ -255,7 +255,7 @@ void ResourceDispatcherHost::OnShutdown() {
bool ResourceDispatcherHost::HandleExternalProtocol(int request_id,
int process_id,
- int tab_contents_id,
+ int route_id,
const GURL& url,
ResourceType::Type type,
ResourceHandler* handler) {
@@ -263,7 +263,7 @@ bool ResourceDispatcherHost::HandleExternalProtocol(int request_id,
return false;
ui_loop_->PostTask(FROM_HERE, NewRunnableFunction(
- &ExternalProtocolHandler::LaunchUrl, url, process_id, tab_contents_id));
+ &ExternalProtocolHandler::LaunchUrl, url, process_id, route_id));
handler->OnResponseCompleted(request_id, URLRequestStatus(
URLRequestStatus::FAILED,
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.h b/chrome/browser/renderer_host/resource_dispatcher_host.h
index fa37454..333791e 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.h
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.h
@@ -66,8 +66,8 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
protected:
explicit Receiver(ChildProcessInfo::ProcessType type)
- : ChildProcessInfo(type) { }
- virtual ~Receiver() { }
+ : ChildProcessInfo(type) {}
+ virtual ~Receiver() {}
};
// Holds the data we would like to associate with each request
@@ -183,7 +183,7 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
class Observer {
public:
- virtual ~Observer() { }
+ virtual ~Observer() {}
virtual void OnRequestStarted(ResourceDispatcherHost* resource_dispatcher,
URLRequest* request) = 0;
virtual void OnResponseCompleted(
@@ -199,7 +199,8 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
GlobalRequestID() : process_id(-1), request_id(-1) {
}
GlobalRequestID(int process_id, int request_id)
- : process_id(process_id), request_id(request_id) { }
+ : process_id(process_id), request_id(request_id) {
+ }
int process_id;
int request_id;
@@ -418,7 +419,7 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
// Internal function to finish an async IO which has completed. Returns
// true if there is more data to read (e.g. we haven't read EOF yet and
// no errors have occurred).
- bool CompleteRead(URLRequest *, int* bytes_read);
+ bool CompleteRead(URLRequest*, int* bytes_read);
// Internal function to finish handling the ResponseStarted message. Returns
// true on success.
@@ -473,7 +474,7 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
// handled, the function returns true. False otherwise.
bool HandleExternalProtocol(int request_id,
int process_id,
- int tab_contents_id,
+ int route_id,
const GURL& url,
ResourceType::Type resource_type,
ResourceHandler* handler);
diff --git a/chrome/browser/renderer_host/test/DEPS b/chrome/browser/renderer_host/test/DEPS
new file mode 100644
index 0000000..f433b7d
--- /dev/null
+++ b/chrome/browser/renderer_host/test/DEPS
@@ -0,0 +1,4 @@
+include_rules = [
+ # See README.txt in this directory for why we do this.
+ "+chrome/browser/tab_contents",
+]
diff --git a/chrome/browser/renderer_host/test/README.txt b/chrome/browser/renderer_host/test/README.txt
new file mode 100644
index 0000000..bf230e5
--- /dev/null
+++ b/chrome/browser/renderer_host/test/README.txt
@@ -0,0 +1,4 @@
+These test files would normally go in the parent directory next to the
+corresponding implementation files. However, they depend on the tab_contents
+directory which we don't want the normal code to use. So we put them in this
+separate directory with the tab_contents includes allowed by DEPS from here only.
diff --git a/chrome/browser/renderer_host/render_view_host_manager_browsertest.cc b/chrome/browser/renderer_host/test/render_view_host_manager_browsertest.cc
index 7d2ff82..7d2ff82 100755
--- a/chrome/browser/renderer_host/render_view_host_manager_browsertest.cc
+++ b/chrome/browser/renderer_host/test/render_view_host_manager_browsertest.cc
diff --git a/chrome/browser/renderer_host/render_view_host_unittest.cc b/chrome/browser/renderer_host/test/render_view_host_unittest.cc
index b70293a..f1f84a7 100644
--- a/chrome/browser/renderer_host/render_view_host_unittest.cc
+++ b/chrome/browser/renderer_host/test/render_view_host_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
class RenderViewHostTest : public RenderViewHostTestHarness {
diff --git a/chrome/browser/renderer_host/site_instance_unittest.cc b/chrome/browser/renderer_host/test/site_instance_unittest.cc
index 12bb9f9..818ca8e 100644
--- a/chrome/browser/renderer_host/site_instance_unittest.cc
+++ b/chrome/browser/renderer_host/test/site_instance_unittest.cc
@@ -6,7 +6,7 @@
#include "chrome/browser/child_process_security_policy.h"
#include "chrome/browser/renderer_host/browser_render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/chrome_constants.h"
diff --git a/chrome/browser/renderer_host/test_render_view_host.cc b/chrome/browser/renderer_host/test/test_render_view_host.cc
index 982beb6..17b91e3 100644
--- a/chrome/browser/renderer_host/test_render_view_host.cc
+++ b/chrome/browser/renderer_host/test/test_render_view_host.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/browser/renderer_host/backing_store.h"
#include "chrome/browser/tab_contents/test_web_contents.h"
diff --git a/chrome/browser/renderer_host/test_render_view_host.h b/chrome/browser/renderer_host/test/test_render_view_host.h
index 39bfce6..d87ce14 100644
--- a/chrome/browser/renderer_host/test_render_view_host.h
+++ b/chrome/browser/renderer_host/test/test_render_view_host.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_
-#define CHROME_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_
+#ifndef CHROME_BROWSER_RENDERER_HOST_TEST_TEST_RENDER_VIEW_HOST_H_
+#define CHROME_BROWSER_RENDERER_HOST_TEST_TEST_RENDER_VIEW_HOST_H_
#include "base/basictypes.h"
#include "base/message_loop.h"
@@ -254,4 +254,4 @@ class RenderViewHostTestHarness : public testing::Test {
DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness);
};
-#endif // CHROME_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_
+#endif // CHROME_BROWSER_RENDERER_HOST_TEST_TEST_RENDER_VIEW_HOST_H_
diff --git a/chrome/browser/renderer_host/web_cache_manager_browser_test.cc b/chrome/browser/renderer_host/test/web_cache_manager_browsertest.cc
index bd4069e..bd4069e 100644
--- a/chrome/browser/renderer_host/web_cache_manager_browser_test.cc
+++ b/chrome/browser/renderer_host/test/web_cache_manager_browsertest.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
index 7e70e08..43e77a8 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
diff --git a/chrome/browser/sessions/tab_restore_service_unittest.cc b/chrome/browser/sessions/tab_restore_service_unittest.cc
index c1ad7b1..97fceff 100644
--- a/chrome/browser/sessions/tab_restore_service_unittest.cc
+++ b/chrome/browser/sessions/tab_restore_service_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/browser/sessions/session_types.h"
#include "chrome/browser/sessions/tab_restore_service.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc
index 4683259..1986171 100644
--- a/chrome/browser/tab_contents/interstitial_page.cc
+++ b/chrome/browser/tab_contents/interstitial_page.cc
@@ -281,6 +281,76 @@ void InterstitialPage::Observe(NotificationType type,
}
}
+RenderViewHostDelegate::View* InterstitialPage::GetViewDelegate() const {
+ return rvh_view_delegate_.get();
+}
+
+const GURL& InterstitialPage::GetURL() const {
+ return url_;
+}
+
+void InterstitialPage::RenderViewGone(RenderViewHost* render_view_host) {
+ // Our renderer died. This should not happen in normal cases.
+ // Just dismiss the interstitial.
+ DontProceed();
+}
+
+void InterstitialPage::DidNavigate(
+ RenderViewHost* render_view_host,
+ const ViewHostMsg_FrameNavigate_Params& params) {
+ // A fast user could have navigated away from the page that triggered the
+ // interstitial while the interstitial was loading, that would have disabled
+ // us. In that case we can dismiss ourselves.
+ if (!enabled_){
+ DontProceed();
+ return;
+ }
+
+ // The RenderViewHost has loaded its contents, we can show it now.
+ render_view_host_->view()->Show();
+ tab_->set_interstitial_page(this);
+
+ RenderWidgetHostView* rwh_view = tab_->render_view_host()->view();
+
+ // The RenderViewHost may already have crashed before we even get here.
+ if (rwh_view) {
+ // If the page has focus, focus the interstitial.
+ if (rwh_view->HasFocus())
+ Focus();
+
+ // Hide the original RVH since we're showing the interstitial instead.
+ rwh_view->Hide();
+ }
+
+ // Notify the tab we are not loading so the throbber is stopped. It also
+ // causes a NOTIFY_LOAD_STOP notification, that the AutomationProvider (used
+ // by the UI tests) expects to consider a navigation as complete. Without
+ // this, navigating in a UI test to a URL that triggers an interstitial would
+ // hang.
+ tab_->SetIsLoading(false, NULL);
+}
+
+void InterstitialPage::UpdateTitle(RenderViewHost* render_view_host,
+ int32 page_id,
+ const std::wstring& title) {
+ DCHECK(render_view_host == render_view_host_);
+ NavigationEntry* entry = tab_->controller().GetActiveEntry();
+ // If this interstitial is shown on an existing navigation entry, we'll need
+ // to remember its title so we can revert to it when hidden.
+ if (!new_navigation_ && !should_revert_tab_title_) {
+ original_tab_title_ = UTF16ToWideHack(entry->title());
+ should_revert_tab_title_ = true;
+ }
+ entry->set_title(WideToUTF16Hack(title));
+ tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB);
+}
+
+void InterstitialPage::DomOperationResponse(const std::string& json_string,
+ int automation_id) {
+ if (enabled_)
+ CommandReceived(json_string);
+}
+
RenderViewHost* InterstitialPage::CreateRenderViewHost() {
RenderViewHost* render_view_host = new RenderViewHost(
SiteInstance::CreateSiteInstance(tab()->profile()),
@@ -380,72 +450,6 @@ void InterstitialPage::FocusThroughTabTraversal(bool reverse) {
render_view_host_->SetInitialFocus(reverse);
}
-void InterstitialPage::DidNavigate(
- RenderViewHost* render_view_host,
- const ViewHostMsg_FrameNavigate_Params& params) {
- // A fast user could have navigated away from the page that triggered the
- // interstitial while the interstitial was loading, that would have disabled
- // us. In that case we can dismiss ourselves.
- if (!enabled_){
- DontProceed();
- return;
- }
-
- // The RenderViewHost has loaded its contents, we can show it now.
- render_view_host_->view()->Show();
- tab_->set_interstitial_page(this);
-
- RenderWidgetHostView* rwh_view = tab_->render_view_host()->view();
-
- // The RenderViewHost may already have crashed before we even get here.
- if (rwh_view) {
- // If the page has focus, focus the interstitial.
- if (rwh_view->HasFocus())
- Focus();
-
- // Hide the original RVH since we're showing the interstitial instead.
- rwh_view->Hide();
- }
-
- // Notify the tab we are not loading so the throbber is stopped. It also
- // causes a NOTIFY_LOAD_STOP notification, that the AutomationProvider (used
- // by the UI tests) expects to consider a navigation as complete. Without
- // this, navigating in a UI test to a URL that triggers an interstitial would
- // hang.
- tab_->SetIsLoading(false, NULL);
-}
-
-void InterstitialPage::RenderViewGone(RenderViewHost* render_view_host) {
- // Our renderer died. This should not happen in normal cases.
- // Just dismiss the interstitial.
- DontProceed();
-}
-
-void InterstitialPage::DomOperationResponse(const std::string& json_string,
- int automation_id) {
- if (enabled_)
- CommandReceived(json_string);
-}
-
-void InterstitialPage::UpdateTitle(RenderViewHost* render_view_host,
- int32 page_id,
- const std::wstring& title) {
- DCHECK(render_view_host == render_view_host_);
- NavigationEntry* entry = tab_->controller().GetActiveEntry();
- // If this interstitial is shown on an existing navigation entry, we'll need
- // to remember its title so we can revert to it when hidden.
- if (!new_navigation_ && !should_revert_tab_title_) {
- original_tab_title_ = UTF16ToWideHack(entry->title());
- should_revert_tab_title_ = true;
- }
- entry->set_title(WideToUTF16Hack(title));
- tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB);
-}
-
-RenderViewHostDelegate::View* InterstitialPage::GetViewDelegate() const {
- return rvh_view_delegate_.get();
-}
-
void InterstitialPage::Disable() {
enabled_ = false;
}
diff --git a/chrome/browser/tab_contents/interstitial_page.h b/chrome/browser/tab_contents/interstitial_page.h
index 821171d..8ebfb51 100644
--- a/chrome/browser/tab_contents/interstitial_page.h
+++ b/chrome/browser/tab_contents/interstitial_page.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_
#define CHROME_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_
+#include <map>
#include <string>
#include "base/gfx/size.h"
@@ -91,29 +92,26 @@ class InterstitialPage : public NotificationObserver,
const NotificationDetails& details);
// RenderViewHostDelegate implementation:
- virtual const GURL& GetURL() const { return url_; }
- virtual WebPreferences GetWebkitPrefs() {
- return WebPreferences();
- }
+ virtual View* GetViewDelegate() const;
+ virtual const GURL& GetURL() const;
+ virtual void RenderViewGone(RenderViewHost* render_view_host);
virtual void DidNavigate(RenderViewHost* render_view_host,
const ViewHostMsg_FrameNavigate_Params& params);
- virtual void RenderViewGone(RenderViewHost* render_view_host);
- virtual void DomOperationResponse(const std::string& json_string,
- int automation_id);
virtual void UpdateTitle(RenderViewHost* render_view_host,
int32 page_id,
const std::wstring& title);
- virtual View* GetViewDelegate() const;
+ virtual void DomOperationResponse(const std::string& json_string,
+ int automation_id);
// Invoked when the page sent a command through DOMAutomation.
- virtual void CommandReceived(const std::string& command) { }
+ virtual void CommandReceived(const std::string& command) {}
// Invoked with the NavigationEntry that is going to be added to the
// navigation controller.
// Gives an opportunity to sub-classes to set states on the |entry|.
// Note that this is only called if the InterstitialPage was constructed with
// |create_navigation_entry| set to true.
- virtual void UpdateEntry(NavigationEntry* entry) { }
+ virtual void UpdateEntry(NavigationEntry* entry) {}
TabContents* tab() const { return tab_; }
const GURL& url() const { return url_; }
diff --git a/chrome/browser/tab_contents/navigation_controller_unittest.cc b/chrome/browser/tab_contents/navigation_controller_unittest.cc
index 50964c7..8047216 100644
--- a/chrome/browser/tab_contents/navigation_controller_unittest.cc
+++ b/chrome/browser/tab_contents/navigation_controller_unittest.cc
@@ -8,7 +8,7 @@
#include "base/string_util.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/browser/history/history.h"
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sessions/session_service_test_helper.h"
#include "chrome/browser/sessions/session_types.h"
diff --git a/chrome/browser/tab_contents/render_view_host_manager_unittest.cc b/chrome/browser/tab_contents/render_view_host_manager_unittest.cc
index 01fb323..6cf549e 100644
--- a/chrome/browser/tab_contents/render_view_host_manager_unittest.cc
+++ b/chrome/browser/tab_contents/render_view_host_manager_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/render_view_host_manager.h"
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 3b46d99..8141c42 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -50,6 +50,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/render_messages.h"
+#include "chrome/common/renderer_preferences.h"
#include "chrome/common/url_constants.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
@@ -57,6 +58,8 @@
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
#include "net/base/registry_controlled_domain.h"
+#include "webkit/glue/password_form.h"
+#include "webkit/glue/webpreferences.h"
#if defined(OS_WIN)
// For CRect
@@ -1862,6 +1865,10 @@ void TabContents::RequestOpenURL(const GURL& url, const GURL& referrer,
}
}
+void TabContents::DomOperationResponse(const std::string& json_string,
+ int automation_id) {
+}
+
void TabContents::ProcessDOMUIMessage(const std::string& message,
const std::string& content,
int request_id,
@@ -2133,6 +2140,10 @@ void TabContents::OnCrossSiteResponse(int new_render_process_host_id,
new_request_id);
}
+void TabContents::OnCrossSiteNavigationCanceled() {
+ render_manager_.CrossSiteNavigationCanceled();
+}
+
bool TabContents::CanBlur() const {
return delegate() ? delegate()->CanBlur() : true;
}
@@ -2205,6 +2216,13 @@ void TabContents::OnUserGesture() {
controller_.OnUserGesture();
}
+bool TabContents::IsExternalTabContainer() const {
+ if (!delegate())
+ return false;
+
+ return delegate()->IsExternalTabContainer();
+}
+
void TabContents::OnFindReply(int request_id,
int number_of_matches,
const gfx::Rect& selection_rect,
@@ -2236,11 +2254,8 @@ void TabContents::OnFindReply(int request_id,
Details<FindNotificationDetails>(&last_search_result_));
}
-bool TabContents::IsExternalTabContainer() const {
- if (!delegate())
- return false;
-
- return delegate()->IsExternalTabContainer();
+void TabContents::DidInsertCSS() {
+ // This RVHDelegate function is used for extensions and not us.
}
void TabContents::FileSelected(const FilePath& path,
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index f7d8f69..759c70a 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -34,7 +34,6 @@
#include "chrome/common/notification_registrar.h"
#include "chrome/common/page_action.h"
#include "chrome/common/property_bag.h"
-#include "chrome/common/renderer_preferences.h"
#include "net/base/load_states.h"
#include "webkit/glue/password_form.h"
#include "webkit/glue/webpreferences.h"
@@ -78,6 +77,7 @@ class PageAction;
class PasswordManager;
class PluginInstaller;
class Profile;
+struct RendererPreferences;
class RenderViewHost;
class TabContentsDelegate;
class TabContentsFactory;
@@ -562,10 +562,6 @@ class TabContents : public PageNavigator,
render_view_host()->SetPageEncoding(encoding);
}
- void CrossSiteNavigationCanceled() {
- render_manager_.CrossSiteNavigationCanceled();
- }
-
void WindowMoveOrResizeStarted() {
render_view_host()->WindowMoveOrResizeStarted();
}
@@ -739,7 +735,6 @@ class TabContents : public PageNavigator,
// RenderViewHostDelegate ----------------------------------------------------
- virtual RendererPreferences GetRendererPrefs() const;
virtual RenderViewHostDelegate::View* GetViewDelegate() const;
virtual RenderViewHostDelegate::Save* GetSaveDelegate() const;
virtual TabContents* GetAsTabContents();
@@ -794,6 +789,8 @@ class TabContents : public PageNavigator,
const SkBitmap& image);
virtual void RequestOpenURL(const GURL& url, const GURL& referrer,
WindowOpenDisposition disposition);
+ virtual void DomOperationResponse(const std::string& json_string,
+ int automation_id);
virtual void ProcessDOMUIMessage(const std::string& message,
const std::string& content,
int request_id,
@@ -831,14 +828,16 @@ class TabContents : public PageNavigator,
virtual void DidGetPrintedPagesCount(int cookie, int number_pages);
virtual void DidPrintPage(const ViewHostMsg_DidPrintPage_Params& params);
virtual GURL GetAlternateErrorPageURL() const;
+ virtual RendererPreferences GetRendererPrefs() const;
virtual WebPreferences GetWebkitPrefs();
virtual void OnMissingPluginStatus(int status);
virtual void OnCrashedPlugin(const FilePath& plugin_path);
virtual void OnCrashedWorker();
virtual void OnJSOutOfMemory();
virtual void ShouldClosePage(bool proceed);
- void OnCrossSiteResponse(int new_render_process_host_id,
- int new_request_id);
+ virtual void OnCrossSiteResponse(int new_render_process_host_id,
+ int new_request_id);
+ virtual void OnCrossSiteNavigationCanceled();
virtual bool CanBlur() const;
virtual gfx::Rect GetRootWindowResizerRect() const;
virtual void RendererUnresponsive(RenderViewHost* render_view_host,
@@ -849,12 +848,13 @@ class TabContents : public PageNavigator,
int32 page_id,
const webkit_glue::WebApplicationInfo& info);
virtual void OnUserGesture();
+ virtual bool IsExternalTabContainer() const;
virtual void OnFindReply(int request_id,
int number_of_matches,
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update);
- virtual bool IsExternalTabContainer() const;
+ virtual void DidInsertCSS();
// SelectFileDialog::Listener ------------------------------------------------
diff --git a/chrome/browser/tab_contents/test_web_contents.cc b/chrome/browser/tab_contents/test_web_contents.cc
index bb5f4d06..f27aa9b 100644
--- a/chrome/browser/tab_contents/test_web_contents.cc
+++ b/chrome/browser/tab_contents/test_web_contents.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/tab_contents/test_web_contents.h"
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
TestTabContents::TestTabContents(Profile* profile, SiteInstance* instance)
: TabContents(profile, instance, MSG_ROUTING_NONE, NULL),
diff --git a/chrome/browser/tab_contents/thumbnail_generator_unittest.cc b/chrome/browser/tab_contents/thumbnail_generator_unittest.cc
index 591fdd0..160a377 100755
--- a/chrome/browser/tab_contents/thumbnail_generator_unittest.cc
+++ b/chrome/browser/tab_contents/thumbnail_generator_unittest.cc
@@ -5,7 +5,7 @@
#include "base/basictypes.h"
#include "chrome/browser/renderer_host/backing_store_manager.h"
#include "chrome/browser/renderer_host/mock_render_process_host.h"
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/browser/tab_contents/thumbnail_generator.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/render_messages.h"
diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc
index 3b1c43e..bbdc7ef 100644
--- a/chrome/browser/tab_contents/web_contents_unittest.cc
+++ b/chrome/browser/tab_contents/web_contents_unittest.cc
@@ -5,7 +5,7 @@
#include "base/logging.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/browser/tab_contents/interstitial_page.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc
index 2db6626..0f74cc0 100644
--- a/chrome/browser/tabs/tab_strip_model_unittest.cc
+++ b/chrome/browser/tabs/tab_strip_model_unittest.cc
@@ -8,7 +8,7 @@
#include "chrome/browser/dom_ui/new_tab_ui.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/profile_manager.h"
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
diff --git a/chrome/browser/visitedlink_unittest.cc b/chrome/browser/visitedlink_unittest.cc
index 43be8e8..16ee644 100644
--- a/chrome/browser/visitedlink_unittest.cc
+++ b/chrome/browser/visitedlink_unittest.cc
@@ -15,7 +15,7 @@
#include "chrome/browser/visitedlink_master.h"
#include "chrome/browser/visitedlink_event_listener.h"
#include "chrome/browser/renderer_host/browser_render_process_host.h"
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/common/render_messages.h"
#include "chrome/renderer/visitedlink_slave.h"
#include "googleurl/src/gurl.h"
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index d60b966..9154f64 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -31,8 +31,8 @@
'browser/views/find_bar_win_browsertest.cc',
# TODO(jam): http://crbug.com/15101 These tests fail on Linux and Mac.
'browser/child_process_security_policy_browser_test.cc',
- 'browser/renderer_host/web_cache_manager_browser_test.cc',
- 'browser/renderer_host/render_view_host_manager_browsertest.cc',
+ 'browser/renderer_host/test/web_cache_manager_browsertest.cc',
+ 'browser/renderer_host/test/render_view_host_manager_browsertest.cc',
# TODO(jcampan): once the task manager works on Mac, move this test to the
# non win specific section.
'browser/task_manager_browsertest.cc',
@@ -1333,6 +1333,7 @@
'browser/renderer_host/render_sandbox_host_linux.cc',
'browser/renderer_host/render_view_host.cc',
'browser/renderer_host/render_view_host.h',
+ 'browser/renderer_host/render_view_host_delegate.cc',
'browser/renderer_host/render_view_host_delegate.h',
'browser/renderer_host/render_view_host_factory.cc',
'browser/renderer_host/render_view_host_factory.h',
@@ -3039,8 +3040,8 @@
'browser/automation/url_request_mock_net_error_job.h',
'browser/renderer_host/mock_render_process_host.cc',
'browser/renderer_host/mock_render_process_host.h',
- 'browser/renderer_host/test_render_view_host.cc',
- 'browser/renderer_host/test_render_view_host.h',
+ 'browser/renderer_host/test/test_render_view_host.cc',
+ 'browser/renderer_host/test/test_render_view_host.h',
'browser/tab_contents/test_web_contents.cc',
'browser/tab_contents/test_web_contents.h',
'common/ipc_test_sink.cc',
@@ -3547,10 +3548,10 @@
'browser/profile_manager_unittest.cc',
'browser/renderer_host/audio_renderer_host_unittest.cc',
'browser/renderer_host/file_system_accessor_unittest.cc',
- 'browser/renderer_host/render_view_host_unittest.cc',
'browser/renderer_host/render_widget_host_unittest.cc',
'browser/renderer_host/resource_dispatcher_host_unittest.cc',
- 'browser/renderer_host/site_instance_unittest.cc',
+ 'browser/renderer_host/test/render_view_host_unittest.cc',
+ 'browser/renderer_host/test/site_instance_unittest.cc',
'browser/renderer_host/web_cache_manager_unittest.cc',
'browser/rlz/rlz_unittest.cc',
'browser/safe_browsing/bloom_filter_unittest.cc',
diff --git a/chrome/test/browser_with_test_window_test.h b/chrome/test/browser_with_test_window_test.h
index 3e63685..835bdeb 100644
--- a/chrome/test/browser_with_test_window_test.h
+++ b/chrome/test/browser_with_test_window_test.h
@@ -8,7 +8,7 @@
#include <string>
#include "base/message_loop.h"
-#include "chrome/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/test/test_browser_window.h"
#include "testing/gtest/include/gtest/gtest.h"