summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-18 05:00:10 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-18 05:00:10 +0000
commit9966325b7197accb38248ebf48983bf0d06c525b (patch)
treeb33fb7ebf51ae47074e5db5c7f255ffd7c9e75f9
parent9db98a2b1c29c70dc1a2a8a9d5169c7c5411297c (diff)
downloadchromium_src-9966325b7197accb38248ebf48983bf0d06c525b.zip
chromium_src-9966325b7197accb38248ebf48983bf0d06c525b.tar.gz
chromium_src-9966325b7197accb38248ebf48983bf0d06c525b.tar.bz2
Remove the last Chrome dependencies from renderer, and enforce no more includes through DEPS. I also added DEPS checking for gpu/plugin/worker directories as well. I moved the Chrome specific browser tests to the chrome directory, and removed render_widget_unittest since it didn't seem to be testing much (there are tests that test it much more fully). I had to move bindings_policy.h, which ideally would be split into separate pieces so that the content layer only has to know about the content bindings. Given that it's basically an enum, I moved the whole file now since it's used in a lot of places, and the value of turning on DEPS checking is really high.
Review URL: http://codereview.chromium.org/6874038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81924 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/login/web_page_view.cc2
-rw-r--r--chrome/browser/debugger/devtools_window.cc2
-rw-r--r--chrome/browser/desktop_notification_handler.cc11
-rw-r--r--chrome/browser/extensions/extension_host.cc2
-rw-r--r--chrome/browser/extensions/extension_web_ui.cc2
-rw-r--r--chrome/browser/external_tab_container_win.cc2
-rw-r--r--chrome/browser/memory_details.cc2
-rw-r--r--chrome/browser/notifications/balloon_host.cc2
-rw-r--r--chrome/browser/prerender/prerender_contents.cc17
-rw-r--r--chrome/browser/prerender/prerender_contents.h5
-rw-r--r--chrome/browser/prerender/prerender_manager.cc2
-rw-r--r--chrome/browser/sidebar/sidebar_container.cc2
-rw-r--r--chrome/browser/tab_contents/background_contents.cc1
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_mac.mm1
-rw-r--r--chrome/browser/tab_contents/web_contents_unittest.cc2
-rw-r--r--chrome/browser/ui/tab_contents/tab_contents_wrapper.cc1
-rw-r--r--chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.cc2
-rw-r--r--chrome/browser/ui/webui/constrained_html_ui.cc2
-rw-r--r--chrome/browser/ui/webui/html_dialog_ui.cc2
-rw-r--r--chrome/chrome_common.gypi6
-rw-r--r--chrome/chrome_dll.gypi1
-rw-r--r--chrome/chrome_tests.gypi3
-rw-r--r--chrome/common/chrome_constants.cc4
-rw-r--r--chrome/common/chrome_constants.h7
-rw-r--r--chrome/common/chrome_switches.cc22
-rw-r--r--chrome/common/chrome_switches.h6
-rw-r--r--chrome/common/prerender_constants.h21
-rw-r--r--chrome/common/render_messages.h63
-rw-r--r--chrome/common/url_constants.cc24
-rw-r--r--chrome/common/url_constants.h30
-rw-r--r--chrome/renderer/autofill/autofill_browsertest.cc161
-rw-r--r--chrome/renderer/chrome_content_renderer_client.cc25
-rw-r--r--chrome/renderer/chrome_content_renderer_client.h3
-rw-r--r--chrome/renderer/chrome_render_view_observer.cc258
-rw-r--r--chrome/renderer/chrome_render_view_observer.h70
-rw-r--r--chrome/renderer/extensions/extension_helper.cc15
-rw-r--r--chrome/renderer/extensions/extension_helper.h12
-rw-r--r--chrome/renderer/extensions/extension_process_bindings.cc6
-rw-r--r--chrome/renderer/external_extension.cc22
-rw-r--r--chrome/renderer/page_load_histograms.cc1
-rw-r--r--chrome/renderer/print_web_view_helper_browsertest.cc203
-rw-r--r--chrome/renderer/translate_helper_browsertest.cc69
-rw-r--r--content/browser/child_process_security_policy.cc2
-rw-r--r--content/browser/renderer_host/render_view_host.cc17
-rw-r--r--content/browser/renderer_host/render_view_host.h4
-rw-r--r--content/browser/tab_contents/interstitial_page.cc2
-rw-r--r--content/browser/tab_contents/navigation_controller.cc3
-rw-r--r--content/browser/tab_contents/navigation_entry.cc3
-rw-r--r--content/browser/tab_contents/tab_contents.cc6
-rw-r--r--content/browser/tab_contents/tab_contents.h3
-rw-r--r--content/browser/webui/web_ui.cc2
-rw-r--r--content/common/bindings_policy.h (renamed from chrome/common/bindings_policy.h)8
-rw-r--r--content/common/content_constants.cc2
-rw-r--r--content/common/content_constants.h7
-rw-r--r--content/common/content_switches.cc22
-rw-r--r--content/common/content_switches.h6
-rw-r--r--content/common/url_constants.cc34
-rw-r--r--content/common/url_constants.h49
-rw-r--r--content/common/view_messages.h55
-rw-r--r--content/content_common.gypi3
-rw-r--r--content/gpu/gpu_child_thread.cc2
-rw-r--r--content/renderer/content_renderer_client.cc5
-rw-r--r--content/renderer/content_renderer_client.h5
-rw-r--r--content/renderer/navigation_state.h1
-rw-r--r--content/renderer/notification_provider.cc11
-rw-r--r--content/renderer/render_thread.cc1
-rw-r--r--content/renderer/render_view.cc334
-rw-r--r--content/renderer/render_view.h148
-rw-r--r--content/renderer/render_view_browsertest.cc410
-rw-r--r--content/renderer/render_view_browsertest_mac.mm2
-rw-r--r--content/renderer/render_view_observer.h2
-rw-r--r--content/renderer/render_widget_unittest.cc61
-rw-r--r--content/worker/worker_uitest.cc2
73 files changed, 1126 insertions, 1180 deletions
diff --git a/chrome/browser/chromeos/login/web_page_view.cc b/chrome/browser/chromeos/login/web_page_view.cc
index 0ab31ae..0ee2f4d 100644
--- a/chrome/browser/chromeos/login/web_page_view.cc
+++ b/chrome/browser/chromeos/login/web_page_view.cc
@@ -11,10 +11,10 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/login/helper.h"
#include "chrome/browser/chromeos/login/rounded_rect_painter.h"
-#include "chrome/common/bindings_policy.h"
#include "content/browser/child_process_security_policy.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/webui/web_ui.h"
+#include "content/common/bindings_policy.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "ipc/ipc_message.h"
diff --git a/chrome/browser/debugger/devtools_window.cc b/chrome/browser/debugger/devtools_window.cc
index b8a0f8b..bef318d 100644
--- a/chrome/browser/debugger/devtools_window.cc
+++ b/chrome/browser/debugger/devtools_window.cc
@@ -22,7 +22,6 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
-#include "chrome/common/bindings_policy.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
@@ -32,6 +31,7 @@
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_view.h"
+#include "content/common/bindings_policy.h"
#include "content/common/notification_service.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/desktop_notification_handler.cc b/chrome/browser/desktop_notification_handler.cc
index 986425a..e6654ec 100644
--- a/chrome/browser/desktop_notification_handler.cc
+++ b/chrome/browser/desktop_notification_handler.cc
@@ -7,6 +7,7 @@
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/notifications/desktop_notification_service_factory.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/url_constants.h"
#include "content/browser/renderer_host/render_process_host.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/render_view_host_delegate.h"
@@ -37,6 +38,16 @@ bool DesktopNotificationHandler::OnMessageReceived(
void DesktopNotificationHandler::OnShow(
const DesktopNotificationHostMsg_Show_Params& params) {
+ // Disallow HTML notifications from unwanted schemes. javascript:
+ // in particular allows unwanted cross-domain access.
+ GURL url = params.contents_url;
+ if (!url.SchemeIs(chrome::kHttpScheme) &&
+ !url.SchemeIs(chrome::kHttpsScheme) &&
+ !url.SchemeIs(chrome::kExtensionScheme) &&
+ !url.SchemeIs(chrome::kDataScheme)) {
+ return;
+ }
+
RenderProcessHost* process = render_view_host()->process();
DesktopNotificationService* service =
DesktopNotificationServiceFactory::GetForProfile(process->profile());
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index a930350..142a559 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -24,7 +24,6 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/webui/chrome_web_ui_factory.h"
-#include "chrome/common/bindings_policy.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
@@ -39,6 +38,7 @@
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_view.h"
+#include "content/common/bindings_policy.h"
#include "content/common/native_web_keyboard_event.h"
#include "content/common/notification_service.h"
#include "content/common/view_messages.h"
diff --git a/chrome/browser/extensions/extension_web_ui.cc b/chrome/browser/extensions/extension_web_ui.cc
index c6c9611..1a9b122 100644
--- a/chrome/browser/extensions/extension_web_ui.cc
+++ b/chrome/browser/extensions/extension_web_ui.cc
@@ -18,7 +18,6 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
-#include "chrome/common/bindings_policy.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
@@ -27,6 +26,7 @@
#include "chrome/common/url_constants.h"
#include "content/browser/renderer_host/render_widget_host_view.h"
#include "content/browser/tab_contents/tab_contents.h"
+#include "content/common/bindings_policy.h"
#include "content/common/page_transition_types.h"
#include "net/base/file_stream.h"
#include "third_party/skia/include/core/SkBitmap.h"
diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc
index 4894c2d..c483a78 100644
--- a/chrome/browser/external_tab_container_win.cc
+++ b/chrome/browser/external_tab_container_win.cc
@@ -30,13 +30,13 @@
#include "chrome/browser/ui/views/tab_contents/render_view_context_menu_views.h"
#include "chrome/browser/ui/views/tab_contents/tab_contents_container.h"
#include "chrome/common/automation_messages.h"
-#include "chrome/common/bindings_policy.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/url_constants.h"
#include "content/browser/renderer_host/render_process_host.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "content/browser/tab_contents/provisional_load_details.h"
+#include "content/common/bindings_policy.h"
#include "content/common/native_web_keyboard_event.h"
#include "content/common/notification_service.h"
#include "content/common/page_transition_types.h"
diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc
index 4510aa5..ea1c834 100644
--- a/chrome/browser/memory_details.cc
+++ b/chrome/browser/memory_details.cc
@@ -11,7 +11,6 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/bindings_policy.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/url_constants.h"
#include "content/browser/browser_child_process_host.h"
@@ -21,6 +20,7 @@
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/browser/tab_contents/tab_contents.h"
+#include "content/common/bindings_policy.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc
index 1edeb2f..9ac175f 100644
--- a/chrome/browser/notifications/balloon_host.cc
+++ b/chrome/browser/notifications/balloon_host.cc
@@ -12,11 +12,11 @@
#include "chrome/browser/renderer_preferences_util.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/webui/chrome_web_ui_factory.h"
-#include "chrome/common/bindings_policy.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/site_instance.h"
+#include "content/common/bindings_policy.h"
#include "content/common/notification_service.h"
#include "content/common/notification_source.h"
#include "content/common/notification_type.h"
diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc
index ebd530a2..96a7386 100644
--- a/chrome/browser/prerender/prerender_contents.cc
+++ b/chrome/browser/prerender/prerender_contents.cc
@@ -108,7 +108,6 @@ void PrerenderContents::StartPrerendering() {
// Hide the RVH, so that we will run at a lower CPU priority.
// Once the RVH is being swapped into a tab, we will Restore it again.
render_view_host_->WasHidden();
- render_view_host_->AllowScriptToClose(true);
// Register this with the ResourceDispatcherHost as a prerender
// RenderViewHost. This must be done before the Navigate message to catch all
@@ -439,8 +438,8 @@ bool PrerenderContents::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartProvisionalLoadForFrame,
OnDidStartProvisionalLoadForFrame)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL)
- IPC_MESSAGE_HANDLER(ViewHostMsg_MaybeCancelPrerender,
- OnMaybeCancelPrerender)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_MaybeCancelPrerenderForHTML5Media,
+ OnMaybeCancelPrerenderForHTML5Media)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP_EX()
@@ -479,16 +478,8 @@ void PrerenderContents::OnUpdateFaviconURL(
}
}
-void PrerenderContents::OnMaybeCancelPrerender(
- PrerenderCancellationReason reason) {
- switch (reason) {
- case PRERENDER_CANCELLATION_REASON_HTML5_MEDIA:
- Destroy(FINAL_STATUS_HTML5_MEDIA);
- return;
- default:
- LOG(DFATAL) << "Invalid reason " << reason
- << " in OnMaybeCancelPrerender.";
- }
+void PrerenderContents::OnMaybeCancelPrerenderForHTML5Media() {
+ Destroy(FINAL_STATUS_HTML5_MEDIA);
}
bool PrerenderContents::AddAliasURL(const GURL& url) {
diff --git a/chrome/browser/prerender/prerender_contents.h b/chrome/browser/prerender/prerender_contents.h
index 541006a..6d9245d 100644
--- a/chrome/browser/prerender/prerender_contents.h
+++ b/chrome/browser/prerender/prerender_contents.h
@@ -15,7 +15,6 @@
#include "chrome/browser/tab_contents/render_view_host_delegate_helper.h"
#include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h"
#include "chrome/common/icon_messages.h"
-#include "chrome/common/prerender_constants.h"
#include "chrome/common/view_types.h"
#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/common/notification_registrar.h"
@@ -208,10 +207,8 @@ class PrerenderContents : public RenderViewHostDelegate,
void OnDidStartProvisionalLoadForFrame(int64 frame_id,
bool main_frame,
const GURL& url);
-
void OnUpdateFaviconURL(int32 page_id, const std::vector<FaviconURL>& urls);
-
- void OnMaybeCancelPrerender(PrerenderCancellationReason reason);
+ void OnMaybeCancelPrerenderForHTML5Media();
// Adds an alias URL, for one of the many redirections. Returns whether
// the URL is valid.
diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc
index 5c3c3b1..f560fa6 100644
--- a/chrome/browser/prerender/prerender_manager.cc
+++ b/chrome/browser/prerender/prerender_manager.cc
@@ -12,7 +12,6 @@
#include "chrome/browser/prerender/prerender_contents.h"
#include "chrome/browser/prerender/prerender_final_status.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/render_messages.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/render_process_host.h"
@@ -20,6 +19,7 @@
#include "content/browser/tab_contents/render_view_host_manager.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/common/notification_service.h"
+#include "content/common/view_messages.h"
#include "googleurl/src/url_parse.h"
#include "googleurl/src/url_canon.h"
#include "googleurl/src/url_util.h"
diff --git a/chrome/browser/sidebar/sidebar_container.cc b/chrome/browser/sidebar/sidebar_container.cc
index 529eb8f..c673906 100644
--- a/chrome/browser/sidebar/sidebar_container.cc
+++ b/chrome/browser/sidebar/sidebar_container.cc
@@ -7,7 +7,6 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_host/browser_render_process_host.h"
-#include "chrome/common/bindings_policy.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_resource.h"
#include "chrome/common/extensions/extension_sidebar_defaults.h"
@@ -17,6 +16,7 @@
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_view.h"
+#include "content/common/bindings_policy.h"
#include "googleurl/src/gurl.h"
#include "third_party/skia/include/core/SkBitmap.h"
diff --git a/chrome/browser/tab_contents/background_contents.cc b/chrome/browser/tab_contents/background_contents.cc
index 8b30787..c994fad 100644
--- a/chrome/browser/tab_contents/background_contents.cc
+++ b/chrome/browser/tab_contents/background_contents.cc
@@ -31,7 +31,6 @@ BackgroundContents::BackgroundContents(SiteInstance* site_instance,
// TODO(rafaelw): Implement correct session storage.
render_view_host_ = new RenderViewHost(site_instance, this, routing_id, NULL);
- render_view_host_->AllowScriptToClose(true);
// Close ourselves when the application is shutting down.
registrar_.Add(this, NotificationType::APP_TERMINATING,
diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.mm b/chrome/browser/tab_contents/tab_contents_view_mac.mm
index fd2cd1e..cf8efdc 100644
--- a/chrome/browser/tab_contents/tab_contents_view_mac.mm
+++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm
@@ -28,6 +28,7 @@
#include "content/common/notification_details.h"
#include "content/common/notification_source.h"
#include "content/common/notification_type.h"
+#include "content/common/view_messages.h"
#include "skia/ext/skia_utils_mac.h"
#import "third_party/mozilla/NSPasteboard+Utils.h"
diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc
index cc26c77..6057195 100644
--- a/chrome/browser/tab_contents/web_contents_unittest.cc
+++ b/chrome/browser/tab_contents/web_contents_unittest.cc
@@ -8,7 +8,6 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/pref_value_store.h"
-#include "chrome/common/bindings_policy.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
@@ -25,6 +24,7 @@
#include "content/browser/tab_contents/navigation_controller.h"
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/browser/tab_contents/test_tab_contents.h"
+#include "content/common/bindings_policy.h"
#include "content/common/view_messages.h"
#include "ipc/ipc_channel.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
index 23bd6fd..e602095 100644
--- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
+++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
@@ -32,6 +32,7 @@
#include "chrome/common/render_messages.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/common/notification_service.h"
+#include "content/common/view_messages.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "grit/platform_locale_settings.h"
diff --git a/chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.cc b/chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.cc
index 5b4cb24..246c447 100644
--- a/chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.cc
@@ -13,11 +13,11 @@
#include "base/values.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
-#include "chrome/common/bindings_policy.h"
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/url_constants.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/tab_contents.h"
+#include "content/common/bindings_policy.h"
#include "content/common/property_bag.h"
#include "grit/browser_resources.h"
#include "grit/chromium_strings.h"
diff --git a/chrome/browser/ui/webui/constrained_html_ui.cc b/chrome/browser/ui/webui/constrained_html_ui.cc
index 2bae21f..2e90d0e 100644
--- a/chrome/browser/ui/webui/constrained_html_ui.cc
+++ b/chrome/browser/ui/webui/constrained_html_ui.cc
@@ -7,9 +7,9 @@
#include "base/lazy_instance.h"
#include "base/values.h"
#include "chrome/browser/ui/webui/html_dialog_ui.h"
-#include "chrome/common/bindings_policy.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/tab_contents.h"
+#include "content/common/bindings_policy.h"
static base::LazyInstance<PropertyAccessor<ConstrainedHtmlUIDelegate*> >
g_constrained_html_ui_property_accessor(base::LINKER_INITIALIZED);
diff --git a/chrome/browser/ui/webui/html_dialog_ui.cc b/chrome/browser/ui/webui/html_dialog_ui.cc
index 80872aa..871fea2 100644
--- a/chrome/browser/ui/webui/html_dialog_ui.cc
+++ b/chrome/browser/ui/webui/html_dialog_ui.cc
@@ -7,9 +7,9 @@
#include "base/callback.h"
#include "base/lazy_instance.h"
#include "base/values.h"
-#include "chrome/common/bindings_policy.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/tab_contents.h"
+#include "content/common/bindings_policy.h"
static base::LazyInstance<PropertyAccessor<HtmlDialogUIDelegate*> >
g_html_dialog_ui_property_accessor(base::LINKER_INITIALIZED);
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index aaeb88f..94971e3 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -31,7 +31,6 @@
'common/auto_start_linux.cc',
'common/auto_start_linux.h',
'common/autofill_messages.h',
- 'common/bindings_policy.h',
'common/child_process_logging.h',
'common/child_process_logging_linux.cc',
'common/child_process_logging_mac.mm',
@@ -67,7 +66,6 @@
'common/nacl_messages.cc',
'common/nacl_messages.h',
'common/nacl_types.h',
- 'common/prerender_constants.h',
'common/profiling.cc',
'common/profiling.h',
'common/ref_counted_util.h',
@@ -109,7 +107,7 @@
'common_constants',
'common_net',
'default_plugin/default_plugin.gyp:default_plugin',
- 'safe_browsing_csd_proto',
+ 'safe_browsing_csd_proto',
'theme_resources',
'../app/app.gyp:app_base',
'../app/app.gyp:app_resources',
@@ -214,7 +212,7 @@
'common/remoting/chromoting_host_info.h',
'common/render_messages.cc',
'common/render_messages.h',
- '<(protoc_out_dir)/chrome/common/safe_browsing/csd.pb.cc',
+ '<(protoc_out_dir)/chrome/common/safe_browsing/csd.pb.cc',
'<(protoc_out_dir)/chrome/common/safe_browsing/csd.pb.h',
'common/search_provider.h',
'common/security_style.h',
diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi
index e8a7fa1..c701750 100644
--- a/chrome/chrome_dll.gypi
+++ b/chrome/chrome_dll.gypi
@@ -610,6 +610,7 @@
'../content/common/notification_service.cc',
'../content/common/notification_source.cc',
'../content/common/sandbox_init_wrapper_win.cc',
+ '../content/common/url_constants.cc',
],
'msvs_settings': {
'VCLinkerTool': {
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 4b4ff72..94767c6 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -1916,7 +1916,6 @@
'../content/renderer/media/audio_renderer_impl_unittest.cc',
'../content/renderer/p2p/p2p_transport_impl_unittest.cc',
'../content/renderer/paint_aggregator_unittest.cc',
- '../content/renderer/render_widget_unittest.cc',
'../testing/gtest_mac_unittest.mm',
'../third_party/cld/encodings/compact_lang_det/compact_lang_det_unittest_small.cc',
'../webkit/fileapi/file_system_dir_url_request_job_unittest.cc',
@@ -2357,10 +2356,12 @@
'browser/ui/webui/file_browse_browsertest.cc',
'browser/ui/webui/mediaplayer_browsertest.cc',
'browser/ui/webui/settings_browsertest.cc',
+ 'renderer/autofill/autofill_browsertest.cc',
'renderer/autofill/form_autocomplete_browsertest.cc',
'renderer/autofill/form_manager_browsertest.cc',
'renderer/autofill/password_autofill_manager_unittest.cc',
'renderer/page_click_tracker_browsertest.cc',
+ 'renderer/print_web_view_helper_browsertest.cc',
'renderer/safe_browsing/malware_dom_details_browsertest.cc',
'renderer/safe_browsing/phishing_classifier_browsertest.cc',
'renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc',
diff --git a/chrome/common/chrome_constants.cc b/chrome/common/chrome_constants.cc
index 0ccf500..465a1efe6 100644
--- a/chrome/common/chrome_constants.cc
+++ b/chrome/common/chrome_constants.cc
@@ -116,8 +116,6 @@ const unsigned int kMaxRendererProcessCount = 42;
const int kStatsMaxThreads = 32;
const int kStatsMaxCounters = 3000;
-const size_t kMaxTitleChars = 4 * 1024;
-
// We don't enable record mode in the released product because users could
// potentially be tricked into running a product in record mode without
// knowing it. Enable in debug builds. Playback mode is allowed always,
@@ -130,8 +128,6 @@ const bool kRecordModeEnabled = false;
const int kHistogramSynchronizerReservedSequenceNumber = 0;
-const int kMaxSessionHistoryEntries = 50;
-
const char* const kUnknownLanguageCode = "und";
const int kJavascriptMessageExpectedDelay = 1000;
diff --git a/chrome/common/chrome_constants.h b/chrome/common/chrome_constants.h
index 0070a0f..4cc992d 100644
--- a/chrome/common/chrome_constants.h
+++ b/chrome/common/chrome_constants.h
@@ -74,10 +74,6 @@ extern const unsigned int kMaxRendererProcessCount;
extern const int kStatsMaxThreads;
extern const int kStatsMaxCounters;
-// The maximum number of characters of the document's title that we're willing
-// to accept in the browser process.
-extern const size_t kMaxTitleChars;
-
extern const bool kRecordModeEnabled;
// Most sequence numbers are used by a renderer when responding to a browser
@@ -87,9 +83,6 @@ extern const bool kRecordModeEnabled;
// a browser-supplied sequence number.
extern const int kHistogramSynchronizerReservedSequenceNumber;
-// The maximum number of session history entries per tab.
-extern const int kMaxSessionHistoryEntries;
-
// The language code used when the language of a page could not be detected.
// (Matches what the CLD -Compact Language Detection- library reports.)
extern const char* const kUnknownLanguageCode;
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 58410fb..dd92eb7 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -164,10 +164,6 @@ const char kDisableAltWinstation[] = "disable-winsta";
// Replaces the audio IPC layer for <audio> and <video> with a mock audio
// device, useful when using remote desktop or machines without sound cards.
// This is temporary until we fix the underlying problem.
-//
-// TODO(scherkus): remove --disable-audio when we have a proper fallback
-// mechanism.
-const char kDisableAudio[] = "disable-audio";
// Disable CNAME lookup of the host when generating the Kerberos SPN for a
// Negotiate challenge. See HttpAuthHandlerNegotiate::CreateSPN
@@ -362,9 +358,6 @@ const char kEnableAccelerated2dCanvas[] = "enable-accelerated-2d-canvas";
// Enables the hardware acceleration of plugins.
const char kEnableAcceleratedPlugins[] = "enable-accelerated-plugins";
-// Enables WebKit accessibility within the renderer process.
-const char kEnableAccessibility[] = "enable-accessibility";
-
// Enables AeroPeek for each tab. (This switch only works on Windows 7).
const char kEnableAeroPeekTabs[] = "enable-aero-peek-tabs";
@@ -469,9 +462,6 @@ const char kEnableRemoting[] = "enable-remoting";
const char kEnableResourceContentSettings[] =
"enable-resource-content-settings";
-// Enable Pepper and JavaScript P2P API.
-const char kEnableP2PApi[] = "enable-p2papi";
-
// Enable panels (always on-top docked pop-up windows).
const char kEnablePanels[] = "enable-panels";
@@ -511,14 +501,6 @@ const char kEnableTcpFastOpen[] = "enable-tcp-fastopen";
// browser window.
const char kEnableVerticalTabs[] = "enable-vertical-tabs";
-// Enables support for fullscreen video. Current implementation is
-// incomplete and this flag is used for development and testing.
-const char kEnableVideoFullscreen[] = "enable-video-fullscreen";
-
-// Enables video logging where video elements log playback performance data to
-// the debug log.
-const char kEnableVideoLogging[] = "enable-video-logging";
-
// Spawn threads to watch for excessive delays in specified message loops.
// User should set breakpoints on Alarm() to examine problematic thread.
// Usage: -enable-watchdog=[ui][io]
@@ -909,10 +891,6 @@ const char kSilentDumpOnDCHECK[] = "silent-dump-on-dcheck";
// Replaces the buffered data source for <audio> and <video> with a simplified
// resource loader that downloads the entire resource into memory.
-//
-// TODO(scherkus): remove --simple-data-source when our media resource loading
-// is cleaned up and playback testing completed.
-const char kSimpleDataSource[] = "simple-data-source";
// Start the browser maximized, regardless of any previous settings.
const char kStartMaximized[] = "start-maximized";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index e624157..8eae4b0 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -61,7 +61,6 @@ extern const char kDiagnostics[];
extern const char kDisableAcceleratedLayers[];
extern const char kDisableAcceleratedVideo[];
extern const char kDisableAltWinstation[];
-extern const char kDisableAudio[];
extern const char kDisableAuthNegotiateCnameLookup[];
extern const char kDisableBackgroundMode[];
extern const char kDisableBackgroundNetworking[];
@@ -111,7 +110,6 @@ extern const char kDomAutomationController[];
extern const char kDumpHistogramsOnExit[];
extern const char kEnableAccelerated2dCanvas[];
extern const char kEnableAcceleratedPlugins[];
-extern const char kEnableAccessibility[];
extern const char kEnableAeroPeekTabs[];
extern const char kEnableAuthNegotiatePort[];
extern const char kEnableClientSidePhishingInterstitial[];
@@ -137,7 +135,6 @@ extern const char kEnableIPPooling[];
extern const char kEnableMemoryInfo[];
extern const char kEnableNaCl[];
extern const char kEnableNaClDebug[];
-extern const char kEnableP2PApi[];
extern const char kEnablePanels[];
extern const char kEnablePreconnect[];
extern const char kEnablePrintPreview[];
@@ -154,8 +151,6 @@ extern const char kEnableTabGroupsContextMenu[];
extern const char kEnableTcpFastOpen[];
extern const char kEnableTopSites[];
extern const char kEnableVerticalTabs[];
-extern const char kEnableVideoFullscreen[];
-extern const char kEnableVideoLogging[];
extern const char kEnableWatchdog[];
extern const char kExperimentalSpellcheckerFeatures[];
extern const char kExplicitlyAllowedPorts[];
@@ -249,7 +244,6 @@ extern const char kShowCompositedLayerTree[];
extern const char kShowFPSCounter[];
extern const char kShowIcons[];
extern const char kSilentDumpOnDCHECK[];
-extern const char kSimpleDataSource[];
extern const char kStartMaximized[];
extern const char kSyncAllowInsecureXmppConnection[];
extern const char kSyncInvalidateXmppLogin[];
diff --git a/chrome/common/prerender_constants.h b/chrome/common/prerender_constants.h
deleted file mode 100644
index 7712ea0..0000000
--- a/chrome/common/prerender_constants.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2011 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.
-
-// Constants related to the prerendering feature in chrome.
-
-#ifndef CHROME_COMMON_PRERENDER_CONSTANTS_H_
-#define CHROME_COMMON_PRERENDER_CONSTANTS_H_
-#pragma once
-
-namespace prerender {
-
-enum PrerenderCancellationReason {
- PRERENDER_CANCELLATION_REASON_FIRST_UNUSED,
- PRERENDER_CANCELLATION_REASON_HTML5_MEDIA,
- PRERENDER_CANCELLATION_REASON_LAST_UNUSED,
-};
-
-} // namespace prerender
-
-#endif // CHROME_COMMON_PRERENDER_CONSTANTS_H_
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index f1ee889..510a8f1 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -21,7 +21,6 @@
#include "chrome/common/icon_messages.h"
#include "chrome/common/instant_types.h"
#include "chrome/common/nacl_types.h"
-#include "chrome/common/prerender_constants.h"
#include "chrome/common/search_provider.h"
#include "chrome/common/thumbnail_score.h"
#include "chrome/common/translate_errors.h"
@@ -37,15 +36,6 @@
#ifndef CHROME_COMMON_RENDER_MESSAGES_H_
#define CHROME_COMMON_RENDER_MESSAGES_H_
-// Values that may be OR'd together to form the 'flags' parameter of the
-// ViewMsg_EnablePreferredSizeChangedMode message.
-enum ViewHostMsg_EnablePreferredSizeChangedMode_Flags {
- kPreferredSizeNothing,
- kPreferredSizeWidth = 1 << 0,
- // Requesting the height currently requires a polling loop in render_view.cc.
- kPreferredSizeHeightThisIsSlow = 1 << 1,
-};
-
// Command values for the cmd parameter of the
// ViewHost_JavaScriptStressTestControl message. For each command the parameter
// passed has a different meaning:
@@ -100,7 +90,6 @@ struct ParamTraits<ContentSettings> {
#define IPC_MESSAGE_START ChromeMsgStart
IPC_ENUM_TRAITS(InstantCompleteBehavior)
-IPC_ENUM_TRAITS(prerender::PrerenderCancellationReason)
IPC_ENUM_TRAITS(search_provider::OSDDType)
IPC_ENUM_TRAITS(search_provider::InstallState)
IPC_ENUM_TRAITS(TranslateErrors::Type)
@@ -187,15 +176,9 @@ IPC_MESSAGE_CONTROL2(ViewMsg_SetContentSettingsForCurrentURL,
GURL /* url */,
ContentSettings /* content_settings */)
-// Install the first missing pluign.
-IPC_MESSAGE_ROUTED0(ViewMsg_InstallMissingPlugin)
-
// Tells the render view to load all blocked plugins.
IPC_MESSAGE_ROUTED0(ViewMsg_LoadBlockedPlugins)
-// Tells the render view a prerendered page is about to be displayed.
-IPC_MESSAGE_ROUTED0(ViewMsg_DisplayPrerenderedPage)
-
// Used to instruct the RenderView to go into "view source" mode.
IPC_MESSAGE_ROUTED0(ViewMsg_EnableViewSourceMode)
@@ -242,18 +225,6 @@ IPC_MESSAGE_ROUTED3(ViewMsg_HandleMessageFromExternalHost,
std::string /* The origin */,
std::string /* The target*/)
-// Sent to the renderer when a popup window should no longer count against
-// the current popup count (either because it's not a popup or because it was
-// a generated by a user action or because a constrained popup got turned
-// into a full window).
-IPC_MESSAGE_ROUTED0(ViewMsg_DisassociateFromPopupCount)
-
-// Sent by the Browser process to alert a window about whether a it should
-// allow a scripted window.close(). The renderer assumes every new window is a
-// blocked popup until notified otherwise.
-IPC_MESSAGE_ROUTED1(ViewMsg_AllowScriptToClose,
- bool /* script_can_close */)
-
IPC_MESSAGE_ROUTED4(ViewMsg_SearchBoxChange,
string16 /* value */,
bool /* verbatim */,
@@ -379,11 +350,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1(ViewHostMsg_GetSearchProviderInstallState,
GURL /* inquiry url */,
search_provider::InstallState /* install */)
-// Stores new inspector setting in the profile.
-IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateInspectorSetting,
- std::string, /* key */
- std::string /* value */)
-
// Send back a string to be recorded by UserMetrics.
IPC_MESSAGE_CONTROL1(ViewHostMsg_UserMetricsRecordAction,
std::string /* action */)
@@ -410,10 +376,6 @@ IPC_MESSAGE_CONTROL2(ViewHostMsg_V8HeapStats,
IPC_MESSAGE_CONTROL1(ViewHostMsg_DnsPrefetch,
std::vector<std::string> /* hostnames */)
-// Notifies when default plugin updates status of the missing plugin.
-IPC_MESSAGE_ROUTED1(ViewHostMsg_MissingPluginStatus,
- int /* status */)
-
// Requests the outdated plugins policy.
// |policy| is one of ALLOW, BLOCK or ASK. Anything else is an error.
// ALLOW means that outdated plugins are allowed, and BLOCK that they should
@@ -427,9 +389,6 @@ IPC_MESSAGE_ROUTED2(ViewHostMsg_BlockedOutdatedPlugin,
string16, /* name */
GURL /* update_url */)
-// Displays a JavaScript out-of-memory message in the infobar.
-IPC_MESSAGE_ROUTED0(ViewHostMsg_JSOutOfMemory)
-
IPC_MESSAGE_ROUTED3(ViewHostMsg_SendCurrentPageAllSavableResourceLinks,
std::vector<GURL> /* all savable resource links */,
std::vector<GURL> /* all referrers of resource links */,
@@ -472,12 +431,6 @@ IPC_MESSAGE_ROUTED4(ViewHostMsg_PageTranslated,
std::string /* the translated language */,
TranslateErrors::Type /* the error type if available */)
-// Message sent from the renderer to the browser to notify it of events which
-// may lead to the cancellation of a prerender. The message is sent only when
-// the renderer is in prerender mode.
-IPC_MESSAGE_ROUTED1(ViewHostMsg_MaybeCancelPrerender,
- prerender::PrerenderCancellationReason)
-
// Suggest results -----------------------------------------------------------
IPC_MESSAGE_ROUTED3(ViewHostMsg_SetSuggestions,
@@ -489,16 +442,6 @@ IPC_MESSAGE_ROUTED2(ViewHostMsg_InstantSupportDetermined,
int32 /* page_id */,
bool /* result */)
-// Updates the content restrictions, i.e. to disable print/copy.
-IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateContentRestrictions,
- int /* restrictions */)
-
-// The currently displayed PDF has an unsupported feature.
-IPC_MESSAGE_ROUTED0(ViewHostMsg_PDFHasUnsupportedFeature)
-
-// Brings up SaveAs... dialog (similar to the wrench->SaveAs...).
-IPC_MESSAGE_ROUTED0(ViewHostMsg_SaveAs)
-
// JavaScript related messages -----------------------------------------------
// Notify the JavaScript engine in the render to change its parameters
@@ -506,9 +449,3 @@ IPC_MESSAGE_ROUTED0(ViewHostMsg_SaveAs)
IPC_MESSAGE_ROUTED2(ViewMsg_JavaScriptStressTestControl,
int /* cmd */,
int /* param */)
-
-// Register a new handler for URL requests with the given scheme.
-IPC_MESSAGE_ROUTED3(ViewHostMsg_RegisterProtocolHandler,
- std::string /* scheme */,
- GURL /* url */,
- string16 /* title */)
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc
index 9fa04de..bfb3254 100644
--- a/chrome/common/url_constants.cc
+++ b/chrome/common/url_constants.cc
@@ -9,30 +9,10 @@
namespace chrome {
-const char kAboutScheme[] = "about";
-const char kBlobScheme[] = "blob";
-const char kChromeDevToolsScheme[] = "chrome-devtools";
-const char kChromeInternalScheme[] = "chrome-internal";
-const char kChromeUIScheme[] = "chrome";
-const char kDataScheme[] = "data";
-const char kExtensionScheme[] = "chrome-extension";
-const char kFileScheme[] = "file";
-const char kFileSystemScheme[] = "filesystem";
-const char kFtpScheme[] = "ftp";
-const char kHttpScheme[] = "http";
-const char kHttpsScheme[] = "https";
-const char kJavaScriptScheme[] = "javascript";
-const char kMailToScheme[] = "mailto";
-const char kMetadataScheme[] = "metadata";
-const char kUserScriptScheme[] = "chrome-user-script";
-const char kViewSourceScheme[] = "view-source";
-
#if defined(OS_CHROMEOS)
const char kCrosScheme[] = "cros";
#endif
-const char kStandardSchemeSeparator[] = "://";
-
const char* kSavableSchemes[] = {
kHttpScheme,
kHttpsScheme,
@@ -46,10 +26,8 @@ const char* kSavableSchemes[] = {
const char kAboutAboutURL[] = "about:about";
const char kAboutAppCacheInternalsURL[] = "about:appcache-internals";
-const char kAboutBlankURL[] = "about:blank";
const char kAboutCacheURL[] = "about:cache";
const char kAboutConflicts[] = "about:conflicts";
-const char kAboutCrashURL[] = "about:crash";
const char kAboutKillURL[] = "about:kill";
const char kAboutCreditsURL[] = "about:credits";
const char kAboutDNSURL[] = "about:dns";
@@ -180,8 +158,6 @@ const char kChromeUILoginContainerHost[] = "login-container";
const char kChromeUILoginHost[] = "login";
#endif
-const char kUnreachableWebDataURL[] = "chrome://chromewebdata/";
-
const char kAppCacheViewInternalsURL[] = "chrome://appcache-internals/";
const char kBlobViewInternalsURL[] = "chrome://blob-internals/";
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h
index 80bee61..db4bfbe 100644
--- a/chrome/common/url_constants.h
+++ b/chrome/common/url_constants.h
@@ -8,30 +8,9 @@
#define CHROME_COMMON_URL_CONSTANTS_H_
#pragma once
-namespace chrome {
+#include "content/common/url_constants.h"
-// Canonical schemes you can use as input to GURL.SchemeIs().
-extern const char kAboutScheme[];
-extern const char kBlobScheme[];
-extern const char kChromeDevToolsScheme[];
-extern const char kChromeInternalScheme[];
-extern const char kChromeUIScheme[]; // The scheme used for WebUIs.
-extern const char kCrosScheme[]; // The scheme used for ChromeOS.
-extern const char kDataScheme[];
-extern const char kExtensionScheme[];
-extern const char kFileScheme[];
-extern const char kFileSystemScheme[];
-extern const char kFtpScheme[];
-extern const char kHttpScheme[];
-extern const char kHttpsScheme[];
-extern const char kJavaScriptScheme[];
-extern const char kMailToScheme[];
-extern const char kMetadataScheme[];
-extern const char kUserScriptScheme[];
-extern const char kViewSourceScheme[];
-
-// Used to separate a standard scheme and the hostname: "://".
-extern const char kStandardSchemeSeparator[];
+namespace chrome {
// Null terminated list of schemes that are savable.
extern const char* kSavableSchemes[];
@@ -39,11 +18,9 @@ extern const char* kSavableSchemes[];
// About URLs (including schemes).
extern const char kAboutAboutURL[];
extern const char kAboutAppCacheInternalsURL[];
-extern const char kAboutBlankURL[];
extern const char kAboutBrowserCrash[];
extern const char kAboutConflicts[];
extern const char kAboutCacheURL[];
-extern const char kAboutCrashURL[];
extern const char kAboutKillURL[];
extern const char kAboutCreditsURL[];
extern const char kAboutDNSURL[];
@@ -170,9 +147,6 @@ extern const char kChromeUILoginContainerHost[];
extern const char kChromeUILoginHost[];
#endif
-// Special URL used to start a navigation to an error page.
-extern const char kUnreachableWebDataURL[];
-
// AppCache related URL.
extern const char kAppCacheViewInternalsURL[];
diff --git a/chrome/renderer/autofill/autofill_browsertest.cc b/chrome/renderer/autofill/autofill_browsertest.cc
new file mode 100644
index 0000000..cfb9965
--- /dev/null
+++ b/chrome/renderer/autofill/autofill_browsertest.cc
@@ -0,0 +1,161 @@
+// Copyright (c) 2011 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 "base/utf_string_conversions.h"
+#include "chrome/common/autofill_messages.h"
+#include "chrome/test/render_view_test.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
+#include "webkit/glue/form_data.h"
+#include "webkit/glue/form_field.h"
+
+using WebKit::WebDocument;
+using WebKit::WebFrame;
+using WebKit::WebInputElement;
+using WebKit::WebString;
+using webkit_glue::FormData;
+using webkit_glue::FormField;
+
+TEST_F(RenderViewTest, SendForms) {
+ // Don't want any delay for form state sync changes. This will still post a
+ // message so updates will get coalesced, but as soon as we spin the message
+ // loop, it will generate an update.
+ view_->set_send_content_state_immediately(true);
+
+ LoadHTML("<form method=\"POST\">"
+ " <input type=\"text\" id=\"firstname\"/>"
+ " <input type=\"text\" id=\"middlename\" autoComplete=\"off\"/>"
+ " <input type=\"hidden\" id=\"lastname\"/>"
+ " <select id=\"state\"/>"
+ " <option>?</option>"
+ " <option>California</option>"
+ " <option>Texas</option>"
+ " </select>"
+ "</form>");
+
+ // Verify that "FormsSeen" sends the expected number of fields.
+ ProcessPendingMessages();
+ const IPC::Message* message = render_thread_.sink().GetFirstMessageMatching(
+ AutofillHostMsg_FormsSeen::ID);
+ ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
+ AutofillHostMsg_FormsSeen::Param params;
+ AutofillHostMsg_FormsSeen::Read(message, &params);
+ const std::vector<FormData>& forms = params.a;
+ ASSERT_EQ(1UL, forms.size());
+ ASSERT_EQ(3UL, forms[0].fields.size());
+ EXPECT_TRUE(forms[0].fields[0].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("firstname"),
+ string16(),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false))) << forms[0].fields[0];
+ EXPECT_TRUE(forms[0].fields[1].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("middlename"),
+ string16(),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false))) << forms[0].fields[1];
+ EXPECT_TRUE(forms[0].fields[2].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("state"),
+ ASCIIToUTF16("?"),
+ ASCIIToUTF16("select-one"),
+ 0,
+ false))) << forms[0].fields[2];
+
+ // Verify that |didAcceptAutoFillSuggestion()| sends the expected number of
+ // fields.
+ WebFrame* web_frame = GetMainFrame();
+ WebDocument document = web_frame->document();
+ WebInputElement firstname =
+ document.getElementById("firstname").to<WebInputElement>();
+
+ // Accept suggestion that contains a label. Labeled items indicate Autofill
+ // as opposed to Autocomplete. We're testing this distinction below with
+ // the |AutofillHostMsg_FillAutofillFormData::ID| message.
+ autofill_agent_->didAcceptAutoFillSuggestion(
+ firstname,
+ WebKit::WebString::fromUTF8("Johnny"),
+ WebKit::WebString::fromUTF8("Home"),
+ 1,
+ -1);
+
+ ProcessPendingMessages();
+ const IPC::Message* message2 = render_thread_.sink().GetUniqueMessageMatching(
+ AutofillHostMsg_FillAutofillFormData::ID);
+ ASSERT_NE(static_cast<IPC::Message*>(NULL), message2);
+ AutofillHostMsg_FillAutofillFormData::Param params2;
+ AutofillHostMsg_FillAutofillFormData::Read(message2, &params2);
+ const FormData& form2 = params2.b;
+ ASSERT_EQ(3UL, form2.fields.size());
+ EXPECT_TRUE(form2.fields[0].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("firstname"),
+ string16(),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false))) << form2.fields[0];
+ EXPECT_TRUE(form2.fields[1].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("middlename"),
+ string16(),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false))) << form2.fields[1];
+ EXPECT_TRUE(form2.fields[2].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("state"),
+ ASCIIToUTF16("?"),
+ ASCIIToUTF16("select-one"),
+ 0,
+ false))) << form2.fields[2];
+}
+
+TEST_F(RenderViewTest, FillFormElement) {
+ // Don't want any delay for form state sync changes. This will still post a
+ // message so updates will get coalesced, but as soon as we spin the message
+ // loop, it will generate an update.
+ view_->set_send_content_state_immediately(true);
+
+ LoadHTML("<form method=\"POST\">"
+ " <input type=\"text\" id=\"firstname\"/>"
+ " <input type=\"text\" id=\"middlename\"/>"
+ "</form>");
+
+ // Verify that "FormsSeen" isn't sent, as there are too few fields.
+ ProcessPendingMessages();
+ const IPC::Message* message = render_thread_.sink().GetFirstMessageMatching(
+ AutofillHostMsg_FormsSeen::ID);
+ ASSERT_EQ(static_cast<IPC::Message*>(NULL), message);
+
+ // Verify that |didAcceptAutoFillSuggestion()| sets the value of the expected
+ // field.
+ WebFrame* web_frame = GetMainFrame();
+ WebDocument document = web_frame->document();
+ WebInputElement firstname =
+ document.getElementById("firstname").to<WebInputElement>();
+ WebInputElement middlename =
+ document.getElementById("middlename").to<WebInputElement>();
+ middlename.setAutofilled(true);
+
+ // Accept a suggestion in a form that has been auto-filled. This triggers
+ // the direct filling of the firstname element with value parameter.
+ autofill_agent_->didAcceptAutoFillSuggestion(firstname,
+ WebString::fromUTF8("David"),
+ WebString(),
+ 0,
+ 0);
+
+ ProcessPendingMessages();
+ const IPC::Message* message2 = render_thread_.sink().GetUniqueMessageMatching(
+ AutofillHostMsg_FillAutofillFormData::ID);
+
+ // No message should be sent in this case. |firstname| is filled directly.
+ ASSERT_EQ(static_cast<IPC::Message*>(NULL), message2);
+ EXPECT_EQ(firstname.value(), WebKit::WebString::fromUTF8("David"));
+}
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index dcbf956..1bdf1b5 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -66,6 +66,7 @@
#include "grit/renderer_resources.h"
#include "net/base/net_errors.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h"
@@ -85,6 +86,7 @@ using autofill::AutofillAgent;
using autofill::FormManager;
using autofill::PasswordAutofillManager;
using WebKit::WebCache;
+using WebKit::WebDataSource;
using WebKit::WebFrame;
using WebKit::WebPlugin;
using WebKit::WebPluginParams;
@@ -398,7 +400,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
plugin_setting == CONTENT_SETTING_ALLOW ||
host_setting == CONTENT_SETTING_ALLOW) {
// Delay loading plugins if prerendering.
- if (render_view->is_prerendering_) {
+ if (render_view->is_prerendering()) {
return CreatePluginPlaceholder(
render_view, frame, params, *group, IDR_CLICK_TO_PLAY_PLUGIN_HTML,
IDS_PLUGIN_LOAD, true, true);
@@ -406,9 +408,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
bool pepper_plugin_was_registered = false;
scoped_refptr<webkit::ppapi::PluginModule> pepper_module(
- render_view->pepper_delegate_.CreatePepperPlugin(
- info.path,
- &pepper_plugin_was_registered));
+ render_view->pepper_delegate()->CreatePepperPlugin(
+ info.path, &pepper_plugin_was_registered));
if (pepper_plugin_was_registered) {
if (pepper_module) {
return render_view->CreatePepperPlugin(
@@ -461,6 +462,22 @@ WebPlugin* ChromeContentRendererClient::CreatePluginPlaceholder(
return blocked_plugin->plugin();
}
+void ChromeContentRendererClient::ShowErrorPage(RenderView* render_view,
+ WebKit::WebFrame* frame,
+ int http_status_code) {
+ // Use an internal error page, if we have one for the status code.
+ if (LocalizedError::HasStrings(LocalizedError::kHttpErrorDomain,
+ http_status_code)) {
+ WebURLError error;
+ error.unreachableURL = frame->url();
+ error.domain = WebString::fromUTF8(LocalizedError::kHttpErrorDomain);
+ error.reason = http_status_code;
+
+ render_view->LoadNavigationErrorPage(
+ frame, frame->dataSource()->request(), error, std::string(), true);
+ }
+}
+
std::string ChromeContentRendererClient::GetNavigationErrorHtml(
const WebURLRequest& failed_request,
const WebURLError& error) {
diff --git a/chrome/renderer/chrome_content_renderer_client.h b/chrome/renderer/chrome_content_renderer_client.h
index f2de762..d408bab 100644
--- a/chrome/renderer/chrome_content_renderer_client.h
+++ b/chrome/renderer/chrome_content_renderer_client.h
@@ -42,6 +42,9 @@ class ChromeContentRendererClient : public content::ContentRendererClient {
RenderView* render_view,
WebKit::WebFrame* frame,
const WebKit::WebPluginParams& params);
+ virtual void ShowErrorPage(RenderView* render_view,
+ WebKit::WebFrame* frame,
+ int http_status_code);
virtual std::string GetNavigationErrorHtml(
const WebKit::WebURLRequest& failed_request,
const WebKit::WebURLError& error);
diff --git a/chrome/renderer/chrome_render_view_observer.cc b/chrome/renderer/chrome_render_view_observer.cc
index fa43970..f7316fa 100644
--- a/chrome/renderer/chrome_render_view_observer.cc
+++ b/chrome/renderer/chrome_render_view_observer.cc
@@ -10,29 +10,52 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/thumbnail_score.h"
+#include "chrome/common/url_constants.h"
#include "chrome/renderer/about_handler.h"
+#include "chrome/renderer/automation/dom_automation_controller.h"
+#include "chrome/renderer/external_host_bindings.h"
#include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
#include "chrome/renderer/translate_helper.h"
+#include "content/common/bindings_policy.h"
#include "content/common/view_messages.h"
#include "content/renderer/content_renderer_client.h"
-#include "content/renderer/render_view.h"
+#include "googleurl/src/gurl.h"
+#include "net/base/data_url.h"
#include "skia/ext/bitmap_platform_device.h"
#include "skia/ext/image_operations.h"
#include "skia/ext/platform_canvas.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializer.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "ui/gfx/color_utils.h"
+#include "ui/gfx/favicon_size.h"
#include "ui/gfx/skbitmap_operations.h"
+#include "webkit/glue/dom_operations.h"
+#include "webkit/glue/image_decoder.h"
+#include "webkit/glue/image_resource_fetcher.h"
#include "webkit/glue/webkit_glue.h"
+#include "v8/include/v8-testing.h"
+using WebKit::WebCString;
using WebKit::WebDataSource;
using WebKit::WebFrame;
+using WebKit::WebPageSerializer;
+using WebKit::WebPageSerializerClient;
using WebKit::WebRect;
using WebKit::WebSize;
+using WebKit::WebString;
+using WebKit::WebURL;
+using WebKit::WebURLRequest;
using WebKit::WebView;
+using WebKit::WebVector;
+using webkit_glue::ImageResourceFetcher;
// Delay in milliseconds that we'll wait before capturing the page contents
// and thumbnail.
@@ -94,6 +117,12 @@ ChromeRenderViewObserver::ChromeRenderViewObserver(
phishing_classifier_(phishing_classifier),
last_indexed_page_id_(-1),
ALLOW_THIS_IN_INITIALIZER_LIST(page_info_method_factory_(this)) {
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ if (command_line.HasSwitch(switches::kDomAutomationController)) {
+ int old_bindings = render_view->enabled_bindings();
+ render_view->set_enabled_bindings(
+ old_bindings |= BindingsPolicy::DOM_AUTOMATION);
+ }
}
ChromeRenderViewObserver::~ChromeRenderViewObserver() {
@@ -103,6 +132,17 @@ bool ChromeRenderViewObserver::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ChromeRenderViewObserver, message)
IPC_MESSAGE_HANDLER(ViewMsg_CaptureSnapshot, OnCaptureSnapshot)
+ IPC_MESSAGE_HANDLER(ViewMsg_HandleMessageFromExternalHost,
+ OnHandleMessageFromExternalHost)
+ IPC_MESSAGE_HANDLER(ViewMsg_JavaScriptStressTestControl,
+ OnJavaScriptStressTestControl)
+ IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage,
+ OnGetAllSavableResourceLinksForCurrentPage)
+ IPC_MESSAGE_HANDLER(
+ ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks,
+ OnGetSerializedHtmlDataForCurrentPageWithLocalLinks)
+ IPC_MESSAGE_HANDLER(ViewMsg_DownloadFavicon, OnDownloadFavicon)
+ IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -132,6 +172,115 @@ void ChromeRenderViewObserver::OnCaptureSnapshot() {
Send(new ViewHostMsg_Snapshot(routing_id(), snapshot));
}
+void ChromeRenderViewObserver::OnHandleMessageFromExternalHost(
+ const std::string& message,
+ const std::string& origin,
+ const std::string& target) {
+ if (message.empty())
+ return;
+ GetExternalHostBindings()->ForwardMessageFromExternalHost(message, origin,
+ target);
+}
+
+void ChromeRenderViewObserver::OnJavaScriptStressTestControl(int cmd,
+ int param) {
+ if (cmd == kJavaScriptStressTestSetStressRunType) {
+ v8::Testing::SetStressRunType(static_cast<v8::Testing::StressType>(param));
+ } else if (cmd == kJavaScriptStressTestPrepareStressRun) {
+ v8::Testing::PrepareStressRun(param);
+ }
+}
+
+void ChromeRenderViewObserver::OnGetAllSavableResourceLinksForCurrentPage(
+ const GURL& page_url) {
+ // Prepare list to storage all savable resource links.
+ std::vector<GURL> resources_list;
+ std::vector<GURL> referrers_list;
+ std::vector<GURL> frames_list;
+ webkit_glue::SavableResourcesResult result(&resources_list,
+ &referrers_list,
+ &frames_list);
+
+ if (!webkit_glue::GetAllSavableResourceLinksForCurrentPage(
+ render_view()->webview(),
+ page_url,
+ &result,
+ chrome::kSavableSchemes)) {
+ // If something is wrong when collecting all savable resource links,
+ // send empty list to embedder(browser) to tell it failed.
+ referrers_list.clear();
+ resources_list.clear();
+ frames_list.clear();
+ }
+
+ // Send result of all savable resource links to embedder.
+ Send(new ViewHostMsg_SendCurrentPageAllSavableResourceLinks(routing_id(),
+ resources_list,
+ referrers_list,
+ frames_list));
+}
+
+void
+ChromeRenderViewObserver::OnGetSerializedHtmlDataForCurrentPageWithLocalLinks(
+ const std::vector<GURL>& links,
+ const std::vector<FilePath>& local_paths,
+ const FilePath& local_directory_name) {
+
+ // Convert std::vector of GURLs to WebVector<WebURL>
+ WebVector<WebURL> weburl_links(links);
+
+ // Convert std::vector of std::strings to WebVector<WebString>
+ WebVector<WebString> webstring_paths(local_paths.size());
+ for (size_t i = 0; i < local_paths.size(); i++)
+ webstring_paths[i] = webkit_glue::FilePathToWebString(local_paths[i]);
+
+ WebPageSerializer::serialize(render_view()->webview()->mainFrame(),
+ true, this, weburl_links, webstring_paths,
+ webkit_glue::FilePathToWebString(
+ local_directory_name));
+}
+
+void ChromeRenderViewObserver::OnDownloadFavicon(int id,
+ const GURL& image_url,
+ int image_size) {
+ bool data_image_failed = false;
+ if (image_url.SchemeIs("data")) {
+ SkBitmap data_image = ImageFromDataUrl(image_url);
+ data_image_failed = data_image.empty();
+ if (!data_image_failed) {
+ Send(new ViewHostMsg_DidDownloadFavicon(
+ routing_id(), id, image_url, false, data_image));
+ }
+ }
+
+ if (data_image_failed ||
+ !DownloadFavicon(id, image_url, image_size)) {
+ Send(new ViewHostMsg_DidDownloadFavicon(
+ routing_id(), id, image_url, true, SkBitmap()));
+ }
+}
+
+void ChromeRenderViewObserver::OnEnableViewSourceMode() {
+ if (!render_view()->webview())
+ return;
+ WebFrame* main_frame = render_view()->webview()->mainFrame();
+ if (!main_frame)
+ return;
+
+ main_frame->enableViewSourceMode(true);
+}
+
+void ChromeRenderViewObserver::didSerializeDataForFrame(
+ const WebURL& frame_url,
+ const WebCString& data,
+ WebPageSerializerClient::PageSerializationStatus status) {
+ Send(new ViewHostMsg_SendSerializedHtmlData(
+ routing_id(),
+ frame_url,
+ data.data(),
+ static_cast<int32>(status)));
+}
+
void ChromeRenderViewObserver::OnNavigate(
const ViewMsg_Navigate_Params& params) {
AboutHandler::MaybeHandle(params.url);
@@ -144,6 +293,33 @@ void ChromeRenderViewObserver::DidStopLoading() {
&ChromeRenderViewObserver::CapturePageInfo, render_view()->page_id(),
false),
render_view()->content_state_immediately() ? 0 : kDelayForCaptureMs);
+
+ GURL osd_url =
+ render_view()->webview()->mainFrame()->openSearchDescriptionURL();
+ if (!osd_url.is_empty()) {
+ Send(new ViewHostMsg_PageHasOSDD(
+ routing_id(), render_view()->page_id(), osd_url,
+ search_provider::AUTODETECTED_PROVIDER));
+ }
+
+ // TODO : Get both favicon and touch icon url, and send them to the browser.
+ GURL favicon_url(render_view()->webview()->mainFrame()->favIconURL());
+ if (!favicon_url.is_empty()) {
+ std::vector<FaviconURL> urls;
+ urls.push_back(FaviconURL(favicon_url, FAVICON));
+ Send(new ViewHostMsg_UpdateFaviconURL(
+ routing_id(), render_view()->page_id(), urls));
+ }
+}
+
+void ChromeRenderViewObserver::DidChangeIcons(WebFrame* frame) {
+ if (frame->parent())
+ return;
+
+ std::vector<FaviconURL> urls;
+ urls.push_back(FaviconURL(frame->favIconURL(), FAVICON));
+ Send(new ViewHostMsg_UpdateFaviconURL(
+ routing_id(), render_view()->page_id(), urls));
}
void ChromeRenderViewObserver::DidCommitProvisionalLoad(
@@ -159,6 +335,20 @@ void ChromeRenderViewObserver::DidCommitProvisionalLoad(
kDelayForForcedCaptureMs);
}
+void ChromeRenderViewObserver::DidClearWindowObject(WebFrame* frame) {
+ if (BindingsPolicy::is_dom_automation_enabled(
+ render_view()->enabled_bindings())) {
+ BindDOMAutomationController(frame);
+ }
+
+ if (BindingsPolicy::is_external_host_enabled(
+ render_view()->enabled_bindings())) {
+ GetExternalHostBindings()->set_message_sender(render_view());
+ GetExternalHostBindings()->set_routing_id(routing_id());
+ GetExternalHostBindings()->BindToJavascript(frame, "externalHost");
+ }
+}
+
void ChromeRenderViewObserver::CapturePageInfo(int load_id,
bool preliminary_capture) {
if (load_id != render_view()->page_id())
@@ -359,3 +549,69 @@ bool ChromeRenderViewObserver::CaptureSnapshot(WebView* view,
base::TimeTicks::Now() - beginning_time);
return true;
}
+
+void ChromeRenderViewObserver::BindDOMAutomationController(WebFrame* frame) {
+ if (!dom_automation_controller_.get()) {
+ dom_automation_controller_.reset(new DomAutomationController());
+ }
+ dom_automation_controller_->set_message_sender(this);
+ dom_automation_controller_->set_routing_id(routing_id());
+ dom_automation_controller_->BindToJavascript(frame,
+ "domAutomationController");
+}
+
+ExternalHostBindings* ChromeRenderViewObserver::GetExternalHostBindings() {
+ if (!external_host_bindings_.get())
+ external_host_bindings_.reset(new ExternalHostBindings());
+ return external_host_bindings_.get();
+}
+
+bool ChromeRenderViewObserver::DownloadFavicon(int id,
+ const GURL& image_url,
+ int image_size) {
+ // Make sure webview was not shut down.
+ if (!render_view()->webview())
+ return false;
+ // Create an image resource fetcher and assign it with a call back object.
+ image_fetchers_.push_back(linked_ptr<ImageResourceFetcher>(
+ new ImageResourceFetcher(
+ image_url, render_view()->webview()->mainFrame(), id, image_size,
+ WebURLRequest::TargetIsFavicon,
+ NewCallback(this, &ChromeRenderViewObserver::DidDownloadFavicon))));
+ return true;
+}
+
+void ChromeRenderViewObserver::DidDownloadFavicon(
+ ImageResourceFetcher* fetcher, const SkBitmap& image) {
+ // Notify requester of image download status.
+ Send(new ViewHostMsg_DidDownloadFavicon(routing_id(),
+ fetcher->id(),
+ fetcher->image_url(),
+ image.isNull(),
+ image));
+
+ // Remove the image fetcher from our pending list. We're in the callback from
+ // ImageResourceFetcher, best to delay deletion.
+ RenderView::ImageResourceFetcherList::iterator iter;
+ for (iter = image_fetchers_.begin(); iter != image_fetchers_.end(); ++iter) {
+ if (iter->get() == fetcher) {
+ iter->release();
+ image_fetchers_.erase(iter);
+ break;
+ }
+ }
+ MessageLoop::current()->DeleteSoon(FROM_HERE, fetcher);
+}
+
+SkBitmap ChromeRenderViewObserver::ImageFromDataUrl(const GURL& url) const {
+ std::string mime_type, char_set, data;
+ if (net::DataURL::Parse(url, &mime_type, &char_set, &data) && !data.empty()) {
+ // Decode the favicon using WebKit's image decoder.
+ webkit_glue::ImageDecoder decoder(gfx::Size(kFaviconSize, kFaviconSize));
+ const unsigned char* src_data =
+ reinterpret_cast<const unsigned char*>(&data[0]);
+
+ return decoder.Decode(src_data, data.size());
+ }
+ return SkBitmap();
+}
diff --git a/chrome/renderer/chrome_render_view_observer.h b/chrome/renderer/chrome_render_view_observer.h
index 038753b..11ddff7 100644
--- a/chrome/renderer/chrome_render_view_observer.h
+++ b/chrome/renderer/chrome_render_view_observer.h
@@ -6,9 +6,18 @@
#define CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_
#pragma once
+#include <vector>
+
#include "base/task.h"
+#include "base/scoped_ptr.h"
+#include "content/renderer/render_view.h"
#include "content/renderer/render_view_observer.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializerClient.h"
+class DomAutomationController;
+class ExternalHostBindings;
+class FilePath;
+class GURL;
class SkBitmap;
class TranslateHelper;
struct ThumbnailScore;
@@ -22,9 +31,14 @@ namespace safe_browsing {
class PhishingClassifierDelegate;
}
+namespace webkit_glue {
+class ImageResourceFetcher;
+}
+
// This class holds the Chrome specific parts of RenderView, and has the same
// lifetime.
-class ChromeRenderViewObserver : public RenderViewObserver {
+class ChromeRenderViewObserver : public RenderViewObserver,
+ public WebKit::WebPageSerializerClient {
public:
// translate_helper and/or phishing_classifier can be NULL.
ChromeRenderViewObserver(
@@ -37,10 +51,28 @@ class ChromeRenderViewObserver : public RenderViewObserver {
// RenderViewObserver implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void DidStopLoading() OVERRIDE;
+ virtual void DidChangeIcons(WebKit::WebFrame* frame) OVERRIDE;
virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame,
bool is_new_navigation) OVERRIDE;
+ virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE;
+
+ // WebKit::WebPageSerializerClient implementation.
+ virtual void didSerializeDataForFrame(const WebKit::WebURL& frame_url,
+ const WebKit::WebCString& data,
+ PageSerializationStatus status);
void OnCaptureSnapshot();
+ void OnHandleMessageFromExternalHost(const std::string& message,
+ const std::string& origin,
+ const std::string& target);
+ void OnJavaScriptStressTestControl(int cmd, int param);
+ void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url);
+ void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks(
+ const std::vector<GURL>& links,
+ const std::vector<FilePath>& local_paths,
+ const FilePath& local_directory_name);
+ void OnDownloadFavicon(int id, const GURL& image_url, int image_size);
+ void OnEnableViewSourceMode();
void OnNavigate(const ViewMsg_Navigate_Params& params);
// Captures the thumbnail and text contents for indexing for the given load
@@ -65,7 +97,31 @@ class ChromeRenderViewObserver : public RenderViewObserver {
// to get a snapshot of a tab using chrome.tabs.captureVisibleTab().
bool CaptureSnapshot(WebKit::WebView* view, SkBitmap* snapshot);
- // Has the same lifetime as us.
+ // Exposes the DOMAutomationController object that allows JS to send
+ // information to the browser process.
+ void BindDOMAutomationController(WebKit::WebFrame* webframe);
+
+ ExternalHostBindings* GetExternalHostBindings();
+
+ // This callback is triggered when DownloadFavicon completes, either
+ // succesfully or with a failure. See DownloadFavicon for more
+ // details.
+ void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher,
+ const SkBitmap& image);
+
+ // Requests to download a favicon image. When done, the RenderView
+ // is notified by way of DidDownloadFavicon. Returns true if the
+ // request was successfully started, false otherwise. id is used to
+ // uniquely identify the request and passed back to the
+ // DidDownloadFavicon method. If the image has multiple frames, the
+ // frame whose size is image_size is returned. If the image doesn't
+ // have a frame at the specified size, the first is returned.
+ bool DownloadFavicon(int id, const GURL& image_url, int image_size);
+
+ // Decodes a data: URL image or returns an empty image in case of failure.
+ SkBitmap ImageFromDataUrl(const GURL&) const;
+
+ // Have the same lifetime as us.
TranslateHelper* translate_helper_;
safe_browsing::PhishingClassifierDelegate* phishing_classifier_;
@@ -73,9 +129,19 @@ class ChromeRenderViewObserver : public RenderViewObserver {
// same page twice in a row.
int32 last_indexed_page_id_;
+ // Allows JS to access DOM automation. The JS object is only exposed when the
+ // DOM automation bindings are enabled.
+ scoped_ptr<DomAutomationController> dom_automation_controller_;
+
+ // External host exposed through automation controller.
+ scoped_ptr<ExternalHostBindings> external_host_bindings_;
+
ScopedRunnableMethodFactory<ChromeRenderViewObserver>
page_info_method_factory_;
+ // ImageResourceFetchers schedule via DownloadImage.
+ RenderView::ImageResourceFetcherList image_fetchers_;
+
DISALLOW_COPY_AND_ASSIGN(ChromeRenderViewObserver);
};
diff --git a/chrome/renderer/extensions/extension_helper.cc b/chrome/renderer/extensions/extension_helper.cc
index 888c0ed..691e7cb 100644
--- a/chrome/renderer/extensions/extension_helper.cc
+++ b/chrome/renderer/extensions/extension_helper.cc
@@ -10,6 +10,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_messages.h"
+#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
#include "chrome/renderer/extensions/extension_dispatcher.h"
#include "chrome/renderer/extensions/extension_process_bindings.h"
@@ -47,7 +48,9 @@ ExtensionHelper::ExtensionHelper(RenderView* render_view,
: RenderViewObserver(render_view),
RenderViewObserverTracker<ExtensionHelper>(render_view),
extension_dispatcher_(extension_dispatcher),
- pending_app_icon_requests_(0) {
+ pending_app_icon_requests_(0),
+ view_type_(ViewType::INVALID),
+ browser_window_id_(-1) {
}
ExtensionHelper::~ExtensionHelper() {
@@ -106,6 +109,8 @@ bool ExtensionHelper::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ExtensionMsg_MessageInvoke, OnExtensionMessageInvoke)
IPC_MESSAGE_HANDLER(ExtensionMsg_ExecuteCode, OnExecuteCode)
IPC_MESSAGE_HANDLER(ExtensionMsg_GetApplicationInfo, OnGetApplicationInfo)
+ IPC_MESSAGE_HANDLER(ViewMsg_UpdateBrowserWindowId, OnUpdateBrowserWindowId)
+ IPC_MESSAGE_HANDLER(ViewMsg_NotifyRenderViewType, OnNotifyRendererViewType)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -221,6 +226,14 @@ void ExtensionHelper::OnGetApplicationInfo(int page_id) {
routing_id(), page_id, app_info));
}
+void ExtensionHelper::OnNotifyRendererViewType(ViewType::Type type) {
+ view_type_ = type;
+}
+
+void ExtensionHelper::OnUpdateBrowserWindowId(int window_id) {
+ browser_window_id_ = window_id;
+}
+
void ExtensionHelper::DidDownloadApplicationDefinition(
const WebKit::WebURLResponse& response,
const std::string& data) {
diff --git a/chrome/renderer/extensions/extension_helper.h b/chrome/renderer/extensions/extension_helper.h
index 2fc45ab..c53dad5 100644
--- a/chrome/renderer/extensions/extension_helper.h
+++ b/chrome/renderer/extensions/extension_helper.h
@@ -8,6 +8,7 @@
#include <map>
+#include "chrome/common/view_types.h"
#include "content/renderer/render_view.h"
#include "content/renderer/render_view_observer.h"
#include "content/renderer/render_view_observer_tracker.h"
@@ -37,6 +38,9 @@ class ExtensionHelper : public RenderViewObserver,
bool InstallWebApplicationUsingDefinitionFile(WebKit::WebFrame* frame,
string16* error);
+ int browser_window_id() const { return browser_window_id_; }
+ ViewType::Type view_type() const { return view_type_; }
+
private:
// RenderViewObserver implementation.
virtual bool OnMessageReceived(const IPC::Message& message);
@@ -57,6 +61,8 @@ class ExtensionHelper : public RenderViewObserver,
const GURL& event_url);
void OnExecuteCode(const ExtensionMsg_ExecuteCode_Params& params);
void OnGetApplicationInfo(int page_id);
+ void OnNotifyRendererViewType(ViewType::Type view_type);
+ void OnUpdateBrowserWindowId(int window_id);
// Callback triggered when we finish downloading the application definition
// file.
@@ -88,6 +94,12 @@ class ExtensionHelper : public RenderViewObserver,
// done processing an app definition file.
int pending_app_icon_requests_;
+ // Type of view attached with RenderView.
+ ViewType::Type view_type_;
+
+ // Id number of browser window which RenderView is attached to.
+ int browser_window_id_;
+
DISALLOW_COPY_AND_ASSIGN(ExtensionHelper);
};
diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc
index 36b92b1..57d6fec 100644
--- a/chrome/renderer/extensions/extension_process_bindings.cc
+++ b/chrome/renderer/extensions/extension_process_bindings.cc
@@ -26,6 +26,7 @@
#include "chrome/renderer/extensions/bindings_utils.h"
#include "chrome/renderer/extensions/event_bindings.h"
#include "chrome/renderer/extensions/extension_dispatcher.h"
+#include "chrome/renderer/extensions/extension_helper.h"
#include "chrome/renderer/extensions/js_only_v8_extensions.h"
#include "chrome/renderer/extensions/renderer_extension_bindings.h"
#include "chrome/renderer/extensions/user_script_slave.h"
@@ -122,7 +123,8 @@ class ExtensionViewAccumulator : public RenderViewVisitor {
v8::Local<v8::Array> views() { return views_; }
virtual bool Visit(RenderView* render_view) {
- if (!ViewTypeMatches(render_view->view_type(), view_type_))
+ ExtensionHelper* helper = ExtensionHelper::Get(render_view);
+ if (!ViewTypeMatches(helper->view_type(), view_type_))
return true;
GURL url = render_view->webview()->mainFrame()->url();
@@ -133,7 +135,7 @@ class ExtensionViewAccumulator : public RenderViewVisitor {
return true;
if (browser_window_id_ != extension_misc::kUnknownWindowId &&
- render_view->browser_window_id() != browser_window_id_) {
+ helper->browser_window_id() != browser_window_id_) {
return true;
}
diff --git a/chrome/renderer/external_extension.cc b/chrome/renderer/external_extension.cc
index 47d703b..f101333 100644
--- a/chrome/renderer/external_extension.cc
+++ b/chrome/renderer/external_extension.cc
@@ -6,9 +6,11 @@
#include "base/command_line.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/render_messages.h"
#include "chrome/common/search_provider.h"
#include "content/renderer/render_view.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "v8/include/v8.h"
using WebKit::WebFrame;
@@ -124,7 +126,16 @@ v8::Handle<v8::Value> ExternalExtensionWrapper::AddSearchProvider(
RenderView* render_view = GetRenderView();
if (!render_view) return v8::Undefined();
- render_view->AddSearchProvider(name, provider_type);
+ if (provider_type != search_provider::EXPLICIT_DEFAULT_PROVIDER ||
+ render_view->webview()->mainFrame()->isProcessingUserGesture()) {
+ GURL osd_url(name);
+ if (!osd_url.is_empty()) {
+ render_view->Send(new ViewHostMsg_PageHasOSDD(
+ render_view->routing_id(), render_view->page_id(), osd_url,
+ provider_type));
+ }
+ }
+
return v8::Undefined();
}
@@ -142,8 +153,13 @@ v8::Handle<v8::Value> ExternalExtensionWrapper::IsSearchProviderInstalled(
WebFrame* webframe = WebFrame::frameForEnteredContext();
if (!webframe) return v8::Undefined();
- search_provider::InstallState install =
- render_view->GetSearchProviderInstallState(webframe, name);
+ search_provider::InstallState install = search_provider::DENIED;
+ GURL inquiry_url = GURL(name);
+ if (!inquiry_url.is_empty()) {
+ render_view->Send(new ViewHostMsg_GetSearchProviderInstallState(
+ render_view->routing_id(), webframe->url(), inquiry_url, &install));
+ }
+
if (install == search_provider::DENIED) {
// FIXME: throw access denied exception.
return v8::ThrowException(v8::Exception::Error(v8::String::Empty()));
diff --git a/chrome/renderer/page_load_histograms.cc b/chrome/renderer/page_load_histograms.cc
index 7922e48..32a75e2 100644
--- a/chrome/renderer/page_load_histograms.cc
+++ b/chrome/renderer/page_load_histograms.cc
@@ -9,6 +9,7 @@
#include "base/metrics/histogram.h"
#include "base/time.h"
#include "chrome/common/chrome_constants.h"
+#include "chrome/common/extensions/url_pattern.h"
#include "chrome/renderer/renderer_histogram_snapshots.h"
#include "content/common/view_messages.h"
#include "content/renderer/navigation_state.h"
diff --git a/chrome/renderer/print_web_view_helper_browsertest.cc b/chrome/renderer/print_web_view_helper_browsertest.cc
new file mode 100644
index 0000000..72b7a2c
--- /dev/null
+++ b/chrome/renderer/print_web_view_helper_browsertest.cc
@@ -0,0 +1,203 @@
+// Copyright (c) 2011 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 "base/file_util.h"
+#include "chrome/renderer/print_web_view_helper.h"
+#include "chrome/test/render_view_test.h"
+#include "printing/image.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
+
+using WebKit::WebFrame;
+using WebKit::WebString;
+using WebKit::WebView;
+
+namespace {
+
+const char kPrintWithJSHTML[] =
+ "<body>Hello<script>window.print()</script>World</body>";
+
+} // namespace
+
+// Tests that printing pages work and sending and receiving messages through
+// that channel all works.
+TEST_F(RenderViewTest, OnPrintPages) {
+ // Lets simulate a print pages with Hello world.
+ LoadHTML("<body><p>Hello World!</p></body>");
+ PrintWebViewHelper::Get(view_)->OnPrintPages();
+
+ VerifyPageCount(1);
+ VerifyPagesPrinted(true);
+}
+
+// Duplicate of OnPrintPagesTest only using javascript to print.
+TEST_F(RenderViewTest, PrintWithJavascript) {
+ // HTML contains a call to window.print()
+ LoadHTML(kPrintWithJSHTML);
+
+ VerifyPageCount(1);
+ VerifyPagesPrinted(true);
+}
+
+// Tests that the renderer blocks window.print() calls if they occur too
+// frequently.
+TEST_F(RenderViewTest, BlockScriptInitiatedPrinting) {
+ // Pretend user will cancel printing.
+ render_thread_.set_print_dialog_user_response(false);
+ // Try to print with window.print() a few times.
+ LoadHTML(kPrintWithJSHTML);
+ LoadHTML(kPrintWithJSHTML);
+ LoadHTML(kPrintWithJSHTML);
+ VerifyPagesPrinted(false);
+
+ // Pretend user will print. (but printing is blocked.)
+ render_thread_.set_print_dialog_user_response(true);
+ LoadHTML(kPrintWithJSHTML);
+ VerifyPagesPrinted(false);
+
+ // Unblock script initiated printing and verify printing works.
+ PrintWebViewHelper::Get(view_)->ResetScriptedPrintCount();
+ render_thread_.printer()->ResetPrinter();
+ LoadHTML(kPrintWithJSHTML);
+ VerifyPageCount(1);
+ VerifyPagesPrinted(true);
+}
+
+#if defined(OS_WIN) || defined(OS_MACOSX)
+// TODO(estade): I don't think this test is worth porting to Linux. We will have
+// to rip out and replace most of the IPC code if we ever plan to improve
+// printing, and the comment below by sverrir suggests that it doesn't do much
+// for us anyway.
+TEST_F(RenderViewTest, PrintWithIframe) {
+ // Document that populates an iframe.
+ const char html[] =
+ "<html><body>Lorem Ipsum:"
+ "<iframe name=\"sub1\" id=\"sub1\"></iframe><script>"
+ " document.write(frames['sub1'].name);"
+ " frames['sub1'].document.write("
+ " '<p>Cras tempus ante eu felis semper luctus!</p>');"
+ "</script></body></html>";
+
+ LoadHTML(html);
+
+ // Find the frame and set it as the focused one. This should mean that that
+ // the printout should only contain the contents of that frame.
+ WebFrame* sub1_frame =
+ view_->webview()->findFrameByName(WebString::fromUTF8("sub1"));
+ ASSERT_TRUE(sub1_frame);
+ view_->webview()->setFocusedFrame(sub1_frame);
+ ASSERT_NE(view_->webview()->focusedFrame(),
+ view_->webview()->mainFrame());
+
+ // Initiate printing.
+ PrintWebViewHelper::Get(view_)->OnPrintPages();
+
+ // Verify output through MockPrinter.
+ const MockPrinter* printer(render_thread_.printer());
+ ASSERT_EQ(1, printer->GetPrintedPages());
+ const printing::Image& image1(printer->GetPrintedPage(0)->image());
+
+ // TODO(sverrir): Figure out a way to improve this test to actually print
+ // only the content of the iframe. Currently image1 will contain the full
+ // page.
+ EXPECT_NE(0, image1.size().width());
+ EXPECT_NE(0, image1.size().height());
+}
+#endif
+
+// Tests if we can print a page and verify its results.
+// This test prints HTML pages into a pseudo printer and check their outputs,
+// i.e. a simplified version of the PrintingLayoutTextTest UI test.
+namespace {
+// Test cases used in this test.
+struct TestPageData {
+ const char* page;
+ size_t printed_pages;
+ int width;
+ int height;
+ const char* checksum;
+ const wchar_t* file;
+};
+
+const TestPageData kTestPages[] = {
+ {"<html>"
+ "<head>"
+ "<meta"
+ " http-equiv=\"Content-Type\""
+ " content=\"text/html; charset=utf-8\"/>"
+ "<title>Test 1</title>"
+ "</head>"
+ "<body style=\"background-color: white;\">"
+ "<p style=\"font-family: arial;\">Hello World!</p>"
+ "</body>",
+#if defined(OS_MACOSX)
+ // Mac printing code compensates for the WebKit scale factor while generating
+ // the metafile, so we expect smaller pages.
+ 1, 540, 720,
+#else
+ 1, 675, 900,
+#endif
+ NULL,
+ NULL,
+ },
+};
+} // namespace
+
+// TODO(estade): need to port MockPrinter to get this on Linux. This involves
+// hooking up Cairo to read a pdf stream, or accessing the cairo surface in the
+// metafile directly.
+#if defined(OS_WIN) || defined(OS_MACOSX)
+TEST_F(RenderViewTest, PrintLayoutTest) {
+ bool baseline = false;
+
+ EXPECT_TRUE(render_thread_.printer() != NULL);
+ for (size_t i = 0; i < arraysize(kTestPages); ++i) {
+ // Load an HTML page and print it.
+ LoadHTML(kTestPages[i].page);
+ PrintWebViewHelper::Get(view_)->OnPrintPages();
+
+ // MockRenderThread::Send() just calls MockRenderThread::OnMsgReceived().
+ // So, all IPC messages sent in the above RenderView::OnPrintPages() call
+ // has been handled by the MockPrinter object, i.e. this printing job
+ // has been already finished.
+ // So, we can start checking the output pages of this printing job.
+ // Retrieve the number of pages actually printed.
+ size_t pages = render_thread_.printer()->GetPrintedPages();
+ EXPECT_EQ(kTestPages[i].printed_pages, pages);
+
+ // Retrieve the width and height of the output page.
+ int width = render_thread_.printer()->GetWidth(0);
+ int height = render_thread_.printer()->GetHeight(0);
+
+ // Check with margin for error. This has been failing with a one pixel
+ // offset on our buildbot.
+ const int kErrorMargin = 5; // 5%
+ EXPECT_GT(kTestPages[i].width * (100 + kErrorMargin) / 100, width);
+ EXPECT_LT(kTestPages[i].width * (100 - kErrorMargin) / 100, width);
+ EXPECT_GT(kTestPages[i].height * (100 + kErrorMargin) / 100, height);
+ EXPECT_LT(kTestPages[i].height* (100 - kErrorMargin) / 100, height);
+
+ // Retrieve the checksum of the bitmap data from the pseudo printer and
+ // compare it with the expected result.
+ std::string bitmap_actual;
+ EXPECT_TRUE(render_thread_.printer()->GetBitmapChecksum(0, &bitmap_actual));
+ if (kTestPages[i].checksum)
+ EXPECT_EQ(kTestPages[i].checksum, bitmap_actual);
+
+ if (baseline) {
+ // Save the source data and the bitmap data into temporary files to
+ // create base-line results.
+ FilePath source_path;
+ file_util::CreateTemporaryFile(&source_path);
+ render_thread_.printer()->SaveSource(0, source_path);
+
+ FilePath bitmap_path;
+ file_util::CreateTemporaryFile(&bitmap_path);
+ render_thread_.printer()->SaveBitmap(0, bitmap_path);
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/chrome/renderer/translate_helper_browsertest.cc b/chrome/renderer/translate_helper_browsertest.cc
index 9298305..e375148 100644
--- a/chrome/renderer/translate_helper_browsertest.cc
+++ b/chrome/renderer/translate_helper_browsertest.cc
@@ -293,3 +293,72 @@ TEST_F(TranslateHelperTest, MultipleDifferentTranslations) {
EXPECT_EQ(new_target_lang, received_target_lang);
EXPECT_EQ(TranslateErrors::NONE, error);
}
+
+// Tests that we send the right translatable for a page and that we respect the
+// "no translate" meta-tag.
+TEST_F(RenderViewTest, TranslatablePage) {
+ // Suppress the normal delay that occurs when the page is loaded before which
+ // the renderer sends the page contents to the browser.
+ view_->set_send_content_state_immediately(true);
+
+ LoadHTML("<html><body>A random page with random content.</body></html>");
+ ProcessPendingMessages();
+ const IPC::Message* message = render_thread_.sink().GetUniqueMessageMatching(
+ ViewHostMsg_TranslateLanguageDetermined::ID);
+ ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
+ ViewHostMsg_TranslateLanguageDetermined::Param params;
+ ViewHostMsg_TranslateLanguageDetermined::Read(message, &params);
+ EXPECT_TRUE(params.b); // Translatable should be true.
+ render_thread_.sink().ClearMessages();
+
+ // Now the page specifies the META tag to prevent translation.
+ LoadHTML("<html><head><meta name=\"google\" value=\"notranslate\"></head>"
+ "<body>A random page with random content.</body></html>");
+ ProcessPendingMessages();
+ message = render_thread_.sink().GetUniqueMessageMatching(
+ ViewHostMsg_TranslateLanguageDetermined::ID);
+ ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
+ ViewHostMsg_TranslateLanguageDetermined::Read(message, &params);
+ EXPECT_FALSE(params.b); // Translatable should be false.
+ render_thread_.sink().ClearMessages();
+
+ // Try the alternate version of the META tag (content instead of value).
+ LoadHTML("<html><head><meta name=\"google\" content=\"notranslate\"></head>"
+ "<body>A random page with random content.</body></html>");
+ ProcessPendingMessages();
+ message = render_thread_.sink().GetUniqueMessageMatching(
+ ViewHostMsg_TranslateLanguageDetermined::ID);
+ ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
+ ViewHostMsg_TranslateLanguageDetermined::Read(message, &params);
+ EXPECT_FALSE(params.b); // Translatable should be false.
+}
+
+// Tests that the language meta tag takes precedence over the CLD when reporting
+// the page's language.
+TEST_F(RenderViewTest, LanguageMetaTag) {
+ // Suppress the normal delay that occurs when the page is loaded before which
+ // the renderer sends the page contents to the browser.
+ view_->set_send_content_state_immediately(true);
+
+ LoadHTML("<html><head><meta http-equiv=\"content-language\" content=\"es\">"
+ "</head><body>A random page with random content.</body></html>");
+ ProcessPendingMessages();
+ const IPC::Message* message = render_thread_.sink().GetUniqueMessageMatching(
+ ViewHostMsg_TranslateLanguageDetermined::ID);
+ ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
+ ViewHostMsg_TranslateLanguageDetermined::Param params;
+ ViewHostMsg_TranslateLanguageDetermined::Read(message, &params);
+ EXPECT_EQ("es", params.a);
+ render_thread_.sink().ClearMessages();
+
+ // Makes sure we support multiple languages specified.
+ LoadHTML("<html><head><meta http-equiv=\"content-language\" "
+ "content=\" fr , es,en \">"
+ "</head><body>A random page with random content.</body></html>");
+ ProcessPendingMessages();
+ message = render_thread_.sink().GetUniqueMessageMatching(
+ ViewHostMsg_TranslateLanguageDetermined::ID);
+ ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
+ ViewHostMsg_TranslateLanguageDetermined::Read(message, &params);
+ EXPECT_EQ("fr", params.a);
+}
diff --git a/content/browser/child_process_security_policy.cc b/content/browser/child_process_security_policy.cc
index 81eca77..1f4e9ce 100644
--- a/content/browser/child_process_security_policy.cc
+++ b/content/browser/child_process_security_policy.cc
@@ -9,8 +9,8 @@
#include "base/platform_file.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
-#include "chrome/common/bindings_policy.h"
#include "chrome/common/url_constants.h"
+#include "content/common/bindings_policy.h"
#include "googleurl/src/gurl.h"
#include "net/url_request/url_request.h"
diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc
index da1e2e0..920d462 100644
--- a/content/browser/renderer_host/render_view_host.cc
+++ b/content/browser/renderer_host/render_view_host.cc
@@ -19,7 +19,6 @@
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/net/predictor_api.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/bindings_policy.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_messages.h"
@@ -38,6 +37,8 @@
#include "content/browser/renderer_host/render_widget_host.h"
#include "content/browser/renderer_host/render_widget_host_view.h"
#include "content/browser/site_instance.h"
+#include "content/common/bindings_policy.h"
+#include "content/common/content_constants.h"
#include "content/common/drag_messages.h"
#include "content/common/native_web_keyboard_event.h"
#include "content/common/notification_details.h"
@@ -514,29 +515,35 @@ void RenderViewHost::InsertCSSInWebFrame(
void RenderViewHost::Undo() {
Send(new ViewMsg_Undo(routing_id()));
+ UserMetrics::RecordAction(UserMetricsAction("Undo"));
}
void RenderViewHost::Redo() {
Send(new ViewMsg_Redo(routing_id()));
+ UserMetrics::RecordAction(UserMetricsAction("Redo"));
}
void RenderViewHost::Cut() {
Send(new ViewMsg_Cut(routing_id()));
+ UserMetrics::RecordAction(UserMetricsAction("Cut"));
}
void RenderViewHost::Copy() {
Send(new ViewMsg_Copy(routing_id()));
+ UserMetrics::RecordAction(UserMetricsAction("Copy"));
}
void RenderViewHost::CopyToFindPboard() {
#if defined(OS_MACOSX)
// Windows/Linux don't have the concept of a find pasteboard.
Send(new ViewMsg_CopyToFindPboard(routing_id()));
+ UserMetrics::RecordAction(UserMetricsAction("CopyToFindPboard"));
#endif
}
void RenderViewHost::Paste() {
Send(new ViewMsg_Paste(routing_id()));
+ UserMetrics::RecordAction(UserMetricsAction("Paste"));
}
void RenderViewHost::ToggleSpellCheck() {
@@ -545,10 +552,12 @@ void RenderViewHost::ToggleSpellCheck() {
void RenderViewHost::Delete() {
Send(new ViewMsg_Delete(routing_id()));
+ UserMetrics::RecordAction(UserMetricsAction("DeleteSelection"));
}
void RenderViewHost::SelectAll() {
Send(new ViewMsg_SelectAll(routing_id()));
+ UserMetrics::RecordAction(UserMetricsAction("SelectAll"));
}
void RenderViewHost::ToggleSpellPanel(bool is_currently_visible) {
@@ -991,7 +1000,7 @@ void RenderViewHost::OnMsgUpdateState(int32 page_id,
void RenderViewHost::OnMsgUpdateTitle(int32 page_id,
const std::wstring& title) {
- if (title.length() > chrome::kMaxTitleChars) {
+ if (title.length() > content::kMaxTitleChars) {
NOTREACHED() << "Renderer sent too many characters in title.";
return;
}
@@ -1149,10 +1158,6 @@ void RenderViewHost::DisassociateFromPopupCount() {
Send(new ViewMsg_DisassociateFromPopupCount(routing_id()));
}
-void RenderViewHost::AllowScriptToClose(bool script_can_close) {
- Send(new ViewMsg_AllowScriptToClose(routing_id(), script_can_close));
-}
-
void RenderViewHost::OnMsgSetTooltipText(
const std::wstring& tooltip_text,
WebTextDirection text_direction_hint) {
diff --git a/content/browser/renderer_host/render_view_host.h b/content/browser/renderer_host/render_view_host.h
index 4e9139f..196e6e6 100644
--- a/content/browser/renderer_host/render_view_host.h
+++ b/content/browser/renderer_host/render_view_host.h
@@ -403,10 +403,6 @@ class RenderViewHost : public RenderWidgetHost {
// as a popup.
void DisassociateFromPopupCount();
- // Tells the renderer whether it should allow window.close. This is initially
- // set to false when creating a renderer-initiated window via window.open.
- void AllowScriptToClose(bool visible);
-
// Notifies the Renderer that a move or resize of its containing window has
// started (this is used to hide the autocomplete popups if any).
void WindowMoveOrResizeStarted();
diff --git a/content/browser/tab_contents/interstitial_page.cc b/content/browser/tab_contents/interstitial_page.cc
index 0669286..da0b968 100644
--- a/content/browser/tab_contents/interstitial_page.cc
+++ b/content/browser/tab_contents/interstitial_page.cc
@@ -16,7 +16,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_preferences_util.h"
#include "chrome/browser/ui/browser_list.h"
-#include "chrome/common/bindings_policy.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/render_process_host.h"
#include "content/browser/renderer_host/render_view_host.h"
@@ -27,6 +26,7 @@
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_view.h"
+#include "content/common/bindings_policy.h"
#include "content/common/dom_storage_common.h"
#include "content/common/notification_service.h"
#include "content/common/notification_source.h"
diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc
index ba75cd0..5bdbd23 100644
--- a/content/browser/tab_contents/navigation_controller.cc
+++ b/content/browser/tab_contents/navigation_controller.cc
@@ -23,6 +23,7 @@
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_delegate.h"
+#include "content/common/content_constants.h"
#include "content/common/navigation_types.h"
#include "content/common/notification_service.h"
#include "content/common/view_messages.h"
@@ -107,7 +108,7 @@ bool AreURLsInPageNavigation(const GURL& existing_url, const GURL& new_url) {
// static
size_t NavigationController::max_entry_count_ =
- chrome::kMaxSessionHistoryEntries;
+ content::kMaxSessionHistoryEntries;
// static
bool NavigationController::check_for_repost_ = true;
diff --git a/content/browser/tab_contents/navigation_entry.cc b/content/browser/tab_contents/navigation_entry.cc
index 535f463..01a8c77 100644
--- a/content/browser/tab_contents/navigation_entry.cc
+++ b/content/browser/tab_contents/navigation_entry.cc
@@ -11,6 +11,7 @@
#include "chrome/common/url_constants.h"
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/navigation_controller.h"
+#include "content/common/content_constants.h"
#include "grit/app_resources.h"
#include "net/base/net_util.h"
#include "ui/base/resource/resource_bundle.h"
@@ -102,7 +103,7 @@ const string16& NavigationEntry::GetTitleForDisplay(
title = title.substr(slashpos + 1);
}
- ui::ElideString(title, chrome::kMaxTitleChars, &cached_display_title_);
+ ui::ElideString(title, content::kMaxTitleChars, &cached_display_title_);
return cached_display_title_;
}
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 3b4d4a9..e7071e3 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -52,7 +52,6 @@
#include "chrome/browser/tab_contents/thumbnail_generator.h"
#include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h"
#include "chrome/browser/ui/browser_dialogs.h"
-#include "chrome/common/bindings_policy.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/content_restriction.h"
@@ -78,6 +77,7 @@
#include "content/browser/tab_contents/tab_contents_observer.h"
#include "content/browser/tab_contents/tab_contents_view.h"
#include "content/browser/webui/web_ui_factory.h"
+#include "content/common/bindings_policy.h"
#include "content/common/content_client.h"
#include "content/common/navigation_types.h"
#include "content/common/notification_service.h"
@@ -240,7 +240,6 @@ TabContents::TabContents(Profile* profile,
received_page_title_(false),
blocked_contents_(NULL),
all_contents_blocked_(false),
- dont_notify_render_view_(false),
displayed_insecure_content_(false),
capturing_contents_(false),
is_being_destroyed_(false),
@@ -851,8 +850,6 @@ void TabContents::PopupNotificationVisibilityChanged(bool visible) {
if (is_being_destroyed_)
return;
content_settings_delegate_->SetPopupsBlocked(visible);
- if (!dont_notify_render_view_)
- render_view_host()->AllowScriptToClose(!visible);
}
gfx::NativeView TabContents::GetContentNativeView() const {
@@ -1539,7 +1536,6 @@ void TabContents::DidNavigateMainFramePostCommit(
if (!details.is_in_page) {
// Close blocked popups.
if (blocked_contents_) {
- AutoReset<bool> auto_reset(&dont_notify_render_view_, true);
blocked_contents_->Destroy();
blocked_contents_ = NULL;
}
diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h
index 73dd143..3f6c1fe 100644
--- a/content/browser/tab_contents/tab_contents.h
+++ b/content/browser/tab_contents/tab_contents.h
@@ -1004,9 +1004,6 @@ class TabContents : public PageNavigator,
// Should we block all child TabContents this attempts to spawn.
bool all_contents_blocked_;
- // TODO(pkasting): Hack to try and fix Linux browser tests.
- bool dont_notify_render_view_;
-
// True if this is a secure page which displayed insecure content.
bool displayed_insecure_content_;
diff --git a/content/browser/webui/web_ui.cc b/content/browser/webui/web_ui.cc
index 3cc3633..636f9e8 100644
--- a/content/browser/webui/web_ui.cc
+++ b/content/browser/webui/web_ui.cc
@@ -10,13 +10,13 @@
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
-#include "chrome/common/bindings_policy.h"
#include "chrome/common/extensions/extension_messages.h"
#include "chrome/common/render_messages.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_view.h"
#include "content/browser/webui/generic_handler.h"
+#include "content/common/bindings_policy.h"
namespace {
diff --git a/chrome/common/bindings_policy.h b/content/common/bindings_policy.h
index 7d0db25..2dcea30 100644
--- a/chrome/common/bindings_policy.h
+++ b/content/common/bindings_policy.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#ifndef CHROME_COMMON_BINDINGS_POLICY_H__
-#define CHROME_COMMON_BINDINGS_POLICY_H__
+#ifndef CONTENT_COMMON_BINDINGS_POLICY_H_
+#define CONTENT_COMMON_BINDINGS_POLICY_H_
#pragma once
// This is a utility class that specifies flag values for the types of
@@ -40,4 +40,4 @@ class BindingsPolicy {
}
};
-#endif // CHROME_COMMON_BINDINGS_POLICY_H__
+#endif // CONTENT_COMMON_BINDINGS_POLICY_H_
diff --git a/content/common/content_constants.cc b/content/common/content_constants.cc
index 2532fc1..3ecda57 100644
--- a/content/common/content_constants.cc
+++ b/content/common/content_constants.cc
@@ -6,6 +6,8 @@
namespace content {
+const int kMaxSessionHistoryEntries = 50;
+const size_t kMaxTitleChars = 4 * 1024;
const size_t kMaxURLChars = 2 * 1024 * 1024;
const size_t kMaxURLDisplayChars = 32 * 1024;
diff --git a/content/common/content_constants.h b/content/common/content_constants.h
index ca94329..05739ff 100644
--- a/content/common/content_constants.h
+++ b/content/common/content_constants.h
@@ -12,6 +12,13 @@
namespace content {
+// The maximum number of session history entries per tab.
+extern const int kMaxSessionHistoryEntries;
+
+// The maximum number of characters of the document's title that we're willing
+// to accept in the browser process.
+extern const size_t kMaxTitleChars;
+
// The maximum number of characters in the URL that we're willing to accept
// in the browser process. It is set low enough to avoid damage to the browser
// but high enough that a web site can abuse location.hash for a little storage.
diff --git a/content/common/content_switches.cc b/content/common/content_switches.cc
index a03233d..9e64cb7 100644
--- a/content/common/content_switches.cc
+++ b/content/common/content_switches.cc
@@ -27,6 +27,10 @@ const char kDisableAcceleratedCompositing[] = "disable-accelerated-compositing";
// Disable the ApplicationCache.
const char kDisableApplicationCache[] = "disable-application-cache";
+//
+// TODO(scherkus): remove --disable-audio when we have a proper fallback
+// mechanism.
+const char kDisableAudio[] = "disable-audio";
// Disable limits on the number of backing stores. Can prevent blinking for
// users with many windows/tabs and lots of memory.
@@ -117,6 +121,9 @@ const char kDisableWebSockets[] = "disable-web-sockets";
// in build/features_override.gypi.
const char kEnableAcceleratedDrawing[] = "enable-accelerated-drawing";
+// Enables WebKit accessibility within the renderer process.
+const char kEnableAccessibility[] = "enable-accessibility";
+
// Enables the benchmarking extensions.
const char kEnableBenchmarking[] = "enable-benchmarking";
@@ -135,6 +142,9 @@ const char kEnableLogging[] = "enable-logging";
// assumed to be sRGB.
const char kEnableMonitorProfile[] = "enable-monitor-profile";
+// Enable Pepper and JavaScript P2P API.
+const char kEnableP2PApi[] = "enable-p2papi";
+
// Enable caching of pre-parsed JS script data. See http://crbug.com/32407.
const char kEnablePreparsedJsCaching[] = "enable-preparsed-js-caching";
@@ -148,6 +158,14 @@ const char kEnableSeccompSandbox[] = "enable-seccomp-sandbox";
// Enables StatsTable, logging statistics to a global named shared memory table.
const char kEnableStatsTable[] = "enable-stats-table";
+// Enables support for fullscreen video. Current implementation is
+// incomplete and this flag is used for development and testing.
+const char kEnableVideoFullscreen[] = "enable-video-fullscreen";
+
+// Enables video logging where video elements log playback performance data to
+// the debug log.
+const char kEnableVideoLogging[] = "enable-video-logging";
+
// Enable web audio API.
const char kEnableWebAudio[] = "enable-webaudio";
@@ -306,6 +324,10 @@ const char kServiceProcess[] = "service";
// Visibly render a border around paint rects in the web page to help debug
// and study painting behavior.
const char kShowPaintRects[] = "show-paint-rects";
+//
+// TODO(scherkus): remove --simple-data-source when our media resource loading
+// is cleaned up and playback testing completed.
+const char kSimpleDataSource[] = "simple-data-source";
// Runs the renderer and plugins in the same process as the browser
const char kSingleProcess[] = "single-process";
diff --git a/content/common/content_switches.h b/content/common/content_switches.h
index e37e70a..761b35b 100644
--- a/content/common/content_switches.h
+++ b/content/common/content_switches.h
@@ -16,6 +16,7 @@ extern const char kBrowserSubprocessPath[];
extern const char kDisable3DAPIs[];
extern const char kDisableAcceleratedCompositing[];
extern const char kDisableApplicationCache[];
+extern const char kDisableAudio[];
extern const char kDisableBackingStoreLimit[];
extern const char kDisableDatabases[];
extern const char kDisableDataTransferItems[];
@@ -43,15 +44,19 @@ extern const char kDisableSharedWorkers[];
extern const char kDisableSpeechInput[];
extern const char kDisableWebSockets[];
extern const char kEnableAcceleratedDrawing[];
+extern const char kEnableAccessibility[];
extern const char kEnableBenchmarking[];
extern const char kEnableDeviceMotion[];
extern const char kEnableGPUPlugin[];
extern const char kEnableLogging[];
extern const char kEnableMonitorProfile[];
+extern const char kEnableP2PApi[];
extern const char kEnablePreparsedJsCaching[];
extern const char kEnableSandboxLogging[];
extern const char kEnableSeccompSandbox[];
extern const char kEnableStatsTable[];
+extern const char kEnableVideoFullscreen[];
+extern const char kEnableVideoLogging[];
extern const char kEnableWebAudio[];
extern const char kExperimentalLocationFeatures[];
// TODO(jam): this doesn't belong in content.
@@ -100,6 +105,7 @@ extern const char kSafePlugins[];
// TODO(jam): this doesn't belong in content.
extern const char kServiceProcess[];
extern const char kShowPaintRects[];
+extern const char kSimpleDataSource[];
extern const char kSingleProcess[];
extern const char kTestSandbox[];
extern const char kUnlimitedQuotaForFiles[];
diff --git a/content/common/url_constants.cc b/content/common/url_constants.cc
new file mode 100644
index 0000000..74ce5f4
--- /dev/null
+++ b/content/common/url_constants.cc
@@ -0,0 +1,34 @@
+// Copyright (c) 2011 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 "content/common/url_constants.h"
+
+namespace chrome {
+
+const char kAboutScheme[] = "about";
+const char kBlobScheme[] = "blob";
+const char kChromeDevToolsScheme[] = "chrome-devtools";
+const char kChromeInternalScheme[] = "chrome-internal";
+const char kChromeUIScheme[] = "chrome";
+const char kDataScheme[] = "data";
+const char kExtensionScheme[] = "chrome-extension";
+const char kFileScheme[] = "file";
+const char kFileSystemScheme[] = "filesystem";
+const char kFtpScheme[] = "ftp";
+const char kHttpScheme[] = "http";
+const char kHttpsScheme[] = "https";
+const char kJavaScriptScheme[] = "javascript";
+const char kMailToScheme[] = "mailto";
+const char kMetadataScheme[] = "metadata";
+const char kUserScriptScheme[] = "chrome-user-script";
+const char kViewSourceScheme[] = "view-source";
+
+const char kStandardSchemeSeparator[] = "://";
+
+const char kAboutBlankURL[] = "about:blank";
+const char kAboutCrashURL[] = "about:crash";
+
+const char kUnreachableWebDataURL[] = "chrome://chromewebdata/";
+
+} // namespace chrome
diff --git a/content/common/url_constants.h b/content/common/url_constants.h
new file mode 100644
index 0000000..86ce54d
--- /dev/null
+++ b/content/common/url_constants.h
@@ -0,0 +1,49 @@
+// Copyright (c) 2011 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.
+
+// Contains constants for known URLs and portions thereof.
+
+#ifndef CONTENT_COMMON_URL_CONSTANTS_H_
+#define CONTENT_COMMON_URL_CONSTANTS_H_
+#pragma once
+
+#include "content/common/url_constants.h"
+
+namespace chrome {
+
+// Canonical schemes you can use as input to GURL.SchemeIs().
+// TODO(jam): some of these don't below in the content layer, but are accessed
+// from there.
+extern const char kAboutScheme[];
+extern const char kBlobScheme[];
+extern const char kChromeDevToolsScheme[];
+extern const char kChromeInternalScheme[];
+extern const char kChromeUIScheme[]; // The scheme used for WebUIs.
+extern const char kCrosScheme[]; // The scheme used for ChromeOS.
+extern const char kDataScheme[];
+extern const char kExtensionScheme[];
+extern const char kFileScheme[];
+extern const char kFileSystemScheme[];
+extern const char kFtpScheme[];
+extern const char kHttpScheme[];
+extern const char kHttpsScheme[];
+extern const char kJavaScriptScheme[];
+extern const char kMailToScheme[];
+extern const char kMetadataScheme[];
+extern const char kUserScriptScheme[];
+extern const char kViewSourceScheme[];
+
+// Used to separate a standard scheme and the hostname: "://".
+extern const char kStandardSchemeSeparator[];
+
+// About URLs (including schemes).
+extern const char kAboutBlankURL[];
+extern const char kAboutCrashURL[];
+
+// Special URL used to start a navigation to an error page.
+extern const char kUnreachableWebDataURL[];
+
+} // namespace chrome
+
+#endif // CONTENT_COMMON_URL_CONSTANTS_H_
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index 8c31bdc..70f25e07 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -65,6 +65,15 @@ struct ViewHostMsg_AccessibilityNotification_Type {
};
};
+// Values that may be OR'd together to form the 'flags' parameter of the
+// ViewMsg_EnablePreferredSizeChangedMode message.
+enum ViewHostMsg_EnablePreferredSizeChangedMode_Flags {
+ kPreferredSizeNothing,
+ kPreferredSizeWidth = 1 << 0,
+ // Requesting the height currently requires a polling loop in render_view.cc.
+ kPreferredSizeHeightThisIsSlow = 1 << 1,
+};
+
struct ViewHostMsg_RunFileChooser_Mode {
public:
enum Value {
@@ -1160,6 +1169,18 @@ IPC_MESSAGE_ROUTED2(ViewMsg_PpapiBrokerChannelCreated,
IPC_MESSAGE_CONTROL1(ViewMsg_PurgePluginListCache,
bool /* reload_pages */)
+// Install the first missing pluign.
+IPC_MESSAGE_ROUTED0(ViewMsg_InstallMissingPlugin)
+
+// Sent to the renderer when a popup window should no longer count against
+// the current popup count (either because it's not a popup or because it was
+// a generated by a user action or because a constrained popup got turned
+// into a full window).
+IPC_MESSAGE_ROUTED0(ViewMsg_DisassociateFromPopupCount)
+
+// Tells the render view a prerendered page is about to be displayed.
+IPC_MESSAGE_ROUTED0(ViewMsg_DisplayPrerenderedPage)
+
// Messages sent from the renderer to the browser.
@@ -1907,3 +1928,37 @@ IPC_MESSAGE_CONTROL3(ViewHostMsg_DidGenerateCacheableMetadata,
GURL /* url */,
double /* expected_response_time */,
std::vector<char> /* data */)
+
+// Updates the content restrictions, i.e. to disable print/copy.
+IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateContentRestrictions,
+ int /* restrictions */)
+
+// The currently displayed PDF has an unsupported feature.
+IPC_MESSAGE_ROUTED0(ViewHostMsg_PDFHasUnsupportedFeature)
+
+// Brings up SaveAs... dialog (similar to the wrench->SaveAs...).
+IPC_MESSAGE_ROUTED0(ViewHostMsg_SaveAs)
+
+// Notifies when default plugin updates status of the missing plugin.
+IPC_MESSAGE_ROUTED1(ViewHostMsg_MissingPluginStatus,
+ int /* status */)
+
+// Displays a JavaScript out-of-memory message in the infobar.
+IPC_MESSAGE_ROUTED0(ViewHostMsg_JSOutOfMemory)
+
+// Register a new handler for URL requests with the given scheme.
+IPC_MESSAGE_ROUTED3(ViewHostMsg_RegisterProtocolHandler,
+ std::string /* scheme */,
+ GURL /* url */,
+ string16 /* title */)
+
+// Stores new inspector setting in the profile.
+// TODO(jam): this should be in the chrome module
+IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateInspectorSetting,
+ std::string, /* key */
+ std::string /* value */)
+
+// Message sent from the renderer to the browser to notify it of events which
+// may lead to the cancellation of a prerender. The message is sent only when
+// the renderer is in prerender mode.
+IPC_MESSAGE_ROUTED0(ViewHostMsg_MaybeCancelPrerenderForHTML5Media) \ No newline at end of file
diff --git a/content/content_common.gypi b/content/content_common.gypi
index bf9f1d3..7a4c001 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -30,6 +30,7 @@
'common/appcache_messages.h',
'common/audio_messages.h',
'common/audio_stream_state.h',
+ 'common/bindings_policy.h',
'common/child_process.cc',
'common/child_process.h',
'common/child_process_host.cc',
@@ -200,6 +201,8 @@
'common/speech_input_result.h',
'common/unix_domain_socket_posix.cc',
'common/unix_domain_socket_posix.h',
+ 'common/url_constants.cc',
+ 'common/url_constants.h',
'common/video_capture_messages.h',
'common/view_messages.h',
'common/web_database_observer_impl.cc',
diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc
index af52c53..1a04e1b 100644
--- a/content/gpu/gpu_child_thread.cc
+++ b/content/gpu/gpu_child_thread.cc
@@ -11,9 +11,9 @@
#include "base/command_line.h"
#include "base/threading/worker_pool.h"
#include "build/build_config.h"
-#include "chrome/common/chrome_switches.h"
#include "content/common/child_process.h"
#include "content/common/content_client.h"
+#include "content/common/content_switches.h"
#include "content/common/gpu_messages.h"
#include "content/gpu/gpu_info_collector.h"
#include "content/gpu/gpu_watchdog_thread.h"
diff --git a/content/renderer/content_renderer_client.cc b/content/renderer/content_renderer_client.cc
index 540a980..4c1e2e2 100644
--- a/content/renderer/content_renderer_client.cc
+++ b/content/renderer/content_renderer_client.cc
@@ -33,6 +33,11 @@ WebKit::WebPlugin* ContentRendererClient::CreatePlugin(RenderView* render_view,
return render_view->CreatePluginNoCheck(frame, params);
}
+void ContentRendererClient::ShowErrorPage(RenderView* render_view,
+ WebKit::WebFrame* frame,
+ int http_status_code) {
+}
+
std::string ContentRendererClient::GetNavigationErrorHtml(
const WebKit::WebURLRequest& failed_request,
const WebKit::WebURLError& error) {
diff --git a/content/renderer/content_renderer_client.h b/content/renderer/content_renderer_client.h
index 7bba2e8..a315695 100644
--- a/content/renderer/content_renderer_client.h
+++ b/content/renderer/content_renderer_client.h
@@ -51,6 +51,11 @@ class ContentRendererClient {
WebKit::WebFrame* frame,
const WebKit::WebPluginParams& params);
+ // Give the embedder the ability to set an error page.
+ virtual void ShowErrorPage(RenderView* render_view,
+ WebKit::WebFrame* frame,
+ int http_status_code);
+
// Returns the html to display when a navigation error occurs.
virtual std::string GetNavigationErrorHtml(
const WebKit::WebURLRequest& failed_request,
diff --git a/content/renderer/navigation_state.h b/content/renderer/navigation_state.h
index f8ff13f..0656a5e 100644
--- a/content/renderer/navigation_state.h
+++ b/content/renderer/navigation_state.h
@@ -11,7 +11,6 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/time.h"
-#include "chrome/common/extensions/url_pattern.h"
#include "content/common/page_transition_types.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h"
diff --git a/content/renderer/notification_provider.cc b/content/renderer/notification_provider.cc
index d1aecba..ea6b54a 100644
--- a/content/renderer/notification_provider.cc
+++ b/content/renderer/notification_provider.cc
@@ -6,8 +6,6 @@
#include "base/string_util.h"
#include "base/task.h"
-#include "chrome/common/url_constants.h"
-#include "chrome/common/render_messages.h"
#include "content/common/desktop_notification_messages.h"
#include "content/common/view_messages.h"
#include "content/renderer/render_thread.h"
@@ -102,15 +100,6 @@ bool NotificationProvider::OnMessageReceived(const IPC::Message& message) {
bool NotificationProvider::ShowHTML(const WebNotification& notification,
int id) {
- // Disallow HTML notifications from unwanted schemes. javascript:
- // in particular allows unwanted cross-domain access.
- GURL url = notification.url();
- if (!url.SchemeIs(chrome::kHttpScheme) &&
- !url.SchemeIs(chrome::kHttpsScheme) &&
- !url.SchemeIs(chrome::kExtensionScheme) &&
- !url.SchemeIs(chrome::kDataScheme))
- return false;
-
DCHECK(notification.isHTML());
DesktopNotificationHostMsg_Show_Params params;
params.origin =
diff --git a/content/renderer/render_thread.cc b/content/renderer/render_thread.cc
index 0500e70..625ebbc 100644
--- a/content/renderer/render_thread.cc
+++ b/content/renderer/render_thread.cc
@@ -21,7 +21,6 @@
#include "base/task.h"
#include "base/threading/thread_local.h"
#include "base/values.h"
-// DO NOT ADD ANY MORE INCLUDES TO "chrome/"!
#include "content/common/appcache/appcache_dispatcher.h"
#include "content/common/content_switches.h"
#include "content/common/database_messages.h"
diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc
index 57de066..7a339f8 100644
--- a/content/renderer/render_view.cc
+++ b/content/renderer/render_view.cc
@@ -21,19 +21,13 @@
#include "base/sys_string_conversions.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
-#include "chrome/common/bindings_policy.h"
-#include "chrome/common/chrome_constants.h"
-#include "chrome/common/chrome_paths.h"
-#include "chrome/common/chrome_switches.h"
#include "chrome/common/pepper_plugin_registry.h"
#include "chrome/common/render_messages.h"
-#include "chrome/common/url_constants.h"
-#include "chrome/renderer/automation/dom_automation_controller.h"
-#include "chrome/renderer/external_host_bindings.h"
-#include "chrome/renderer/localized_error.h"
#include "content/common/appcache/appcache_dispatcher.h"
+#include "content/common/bindings_policy.h"
#include "content/common/clipboard_messages.h"
#include "content/common/content_constants.h"
+#include "content/common/content_switches.h"
#include "content/common/database_messages.h"
#include "content/common/drag_messages.h"
#include "content/common/file_system/file_system_dispatcher.h"
@@ -43,6 +37,7 @@
#include "content/common/pepper_messages.h"
#include "content/common/quota_dispatcher.h"
#include "content/common/renderer_preferences.h"
+#include "content/common/url_constants.h"
#include "content/common/view_messages.h"
#include "content/renderer/audio_message_filter.h"
#include "content/renderer/content_renderer_client.h"
@@ -72,7 +67,6 @@
#include "media/base/filter_collection.h"
#include "media/base/media_switches.h"
#include "media/base/message_loop_factory_impl.h"
-#include "net/base/data_url.h"
#include "net/base/escape.h"
#include "net/base/net_errors.h"
#include "net/http/http_util.h"
@@ -97,7 +91,6 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNetworkStateNotifier.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeList.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializer.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginDocument.h"
@@ -122,21 +115,16 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/message_box_flags.h"
-#include "ui/gfx/favicon_size.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/point.h"
#include "ui/gfx/rect.h"
-#include "v8/include/v8-testing.h"
#include "v8/include/v8.h"
#include "webkit/appcache/web_application_cache_host_impl.h"
#include "webkit/glue/alt_error_page_resource_fetcher.h"
#include "webkit/glue/context_menu.h"
-#include "webkit/glue/dom_operations.h"
#include "webkit/glue/form_data.h"
#include "webkit/glue/form_field.h"
#include "webkit/glue/glue_serialize.h"
-#include "webkit/glue/image_decoder.h"
-#include "webkit/glue/image_resource_fetcher.h"
#include "webkit/glue/media/video_renderer_impl.h"
#include "webkit/glue/password_form_dom_manager.h"
#include "webkit/glue/site_isolation_metrics.h"
@@ -202,8 +190,6 @@ using WebKit::WebNavigationPolicy;
using WebKit::WebNavigationType;
using WebKit::WebNetworkStateNotifier;
using WebKit::WebNode;
-using WebKit::WebPageSerializer;
-using WebKit::WebPageSerializerClient;
using WebKit::WebPlugin;
using WebKit::WebPluginContainer;
using WebKit::WebPluginDocument;
@@ -240,7 +226,6 @@ using base::Time;
using base::TimeDelta;
using webkit_glue::AltErrorPageResourceFetcher;
using webkit_glue::FormField;
-using webkit_glue::ImageResourceFetcher;
using webkit_glue::PasswordForm;
using webkit_glue::PasswordFormDomManager;
using webkit_glue::ResourceFetcher;
@@ -395,7 +380,6 @@ RenderView::RenderView(RenderThreadBase* render_thread,
send_content_state_immediately_(false),
enabled_bindings_(0),
send_preferred_size_changes_(false),
- script_can_close_(true),
is_loading_(false),
navigation_gesture_(NavigationGestureUnknown),
opened_by_user_gesture_(true),
@@ -407,8 +391,6 @@ RenderView::RenderView(RenderThreadBase* render_thread,
history_list_length_(0),
has_unload_listener_(false),
target_url_status_(TARGET_NONE),
- view_type_(ViewType::INVALID),
- browser_window_id_(-1),
ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)),
ALLOW_THIS_IN_INITIALIZER_LIST(accessibility_method_factory_(this)),
ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)),
@@ -464,18 +446,14 @@ RenderView::RenderView(RenderThreadBase* render_thread,
host_window_ = parent_hwnd;
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kDomAutomationController))
- enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION;
if (command_line.HasSwitch(switches::kEnableAccessibility))
WebAccessibilityCache::enableAccessibility();
audio_message_filter_ = new AudioMessageFilter(routing_id_);
render_thread_->AddFilter(audio_message_filter_);
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableP2PApi)) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableP2PApi))
p2p_socket_dispatcher_ = new P2PSocketDispatcher(this);
- }
content::GetContentClient()->renderer()->RenderViewCreated(this);
}
@@ -587,10 +565,6 @@ WebKit::WebView* RenderView::webview() const {
return static_cast<WebKit::WebView*>(webwidget());
}
-void RenderView::UserMetricsRecordAction(const std::string& action) {
- Send(new ViewHostMsg_UserMetricsRecordAction(action));
-}
-
void RenderView::SetReportLoadProgressEnabled(bool enabled) {
if (!enabled) {
load_progress_tracker_.reset(NULL);
@@ -689,7 +663,6 @@ bool RenderView::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding)
IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault,
OnResetPageEncodingToDefault)
- IPC_MESSAGE_HANDLER(ViewMsg_DownloadFavicon, OnDownloadFavicon)
IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest)
IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest)
IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange)
@@ -714,21 +687,11 @@ bool RenderView::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse,
OnEnumerateDirectoryResponse)
IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse)
- IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode)
- IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage,
- OnGetAllSavableResourceLinksForCurrentPage)
- IPC_MESSAGE_HANDLER(
- ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks,
- OnGetSerializedHtmlDataForCurrentPageWithLocalLinks)
IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnShouldClose)
IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage)
IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged)
- IPC_MESSAGE_HANDLER(ViewMsg_HandleMessageFromExternalHost,
- OnHandleMessageFromExternalHost)
IPC_MESSAGE_HANDLER(ViewMsg_DisassociateFromPopupCount,
OnDisassociateFromPopupCount)
- IPC_MESSAGE_HANDLER(ViewMsg_AllowScriptToClose,
- OnAllowScriptToClose)
IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted)
IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode)
IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground)
@@ -737,10 +700,6 @@ bool RenderView::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_DisableScrollbarsForSmallWindows,
OnDisableScrollbarsForSmallWindows)
IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs)
- IPC_MESSAGE_HANDLER(ViewMsg_UpdateBrowserWindowId,
- OnUpdateBrowserWindowId)
- IPC_MESSAGE_HANDLER(ViewMsg_NotifyRenderViewType,
- OnNotifyRendererViewType)
IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt)
IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive)
#if defined(OS_MACOSX)
@@ -765,8 +724,6 @@ bool RenderView::OnMessageReceived(const IPC::Message& message) {
#if defined(OS_MACOSX)
IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem)
#endif
- IPC_MESSAGE_HANDLER(ViewMsg_JavaScriptStressTestControl,
- OnJavaScriptStressTestControl)
IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed)
IPC_MESSAGE_HANDLER(ViewMsg_NetworkStateChanged, OnNetworkStateChanged)
// TODO(viettrungluu): Move to a separate message filter.
@@ -925,7 +882,6 @@ void RenderView::OnUndo() {
return;
webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Undo"));
- UserMetricsRecordAction("Undo");
}
void RenderView::OnRedo() {
@@ -933,7 +889,6 @@ void RenderView::OnRedo() {
return;
webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Redo"));
- UserMetricsRecordAction("Redo");
}
void RenderView::OnCut() {
@@ -941,7 +896,6 @@ void RenderView::OnCut() {
return;
webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Cut"));
- UserMetricsRecordAction("Cut");
}
void RenderView::OnCopy() {
@@ -949,7 +903,6 @@ void RenderView::OnCopy() {
return;
webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Copy"));
- UserMetricsRecordAction("Copy");
}
#if defined(OS_MACOSX)
@@ -965,8 +918,6 @@ void RenderView::OnCopyToFindPboard() {
RenderThread::current()->Send(
new ClipboardHostMsg_FindPboardWriteStringAsync(selection));
}
-
- UserMetricsRecordAction("CopyToFindPboard");
}
#endif
@@ -975,7 +926,6 @@ void RenderView::OnPaste() {
return;
webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Paste"));
- UserMetricsRecordAction("Paste");
}
void RenderView::OnReplace(const string16& text) {
@@ -993,7 +943,6 @@ void RenderView::OnDelete() {
return;
webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Delete"));
- UserMetricsRecordAction("DeleteSelection");
}
void RenderView::OnSelectAll() {
@@ -1002,7 +951,6 @@ void RenderView::OnSelectAll() {
webview()->focusedFrame()->executeCommand(
WebString::fromUTF8("SelectAll"));
- UserMetricsRecordAction("SelectAll");
}
void RenderView::OnSetInitialFocus(bool reverse) {
@@ -1231,8 +1179,8 @@ void RenderView::UpdateTitle(WebFrame* frame, const string16& title) {
Send(new ViewHostMsg_UpdateTitle(
routing_id_,
page_id_,
- UTF16ToWideHack(title.length() > chrome::kMaxTitleChars ?
- title.substr(0, chrome::kMaxTitleChars) : title)));
+ UTF16ToWideHack(title.length() > content::kMaxTitleChars ?
+ title.substr(0, content::kMaxTitleChars) : title)));
}
}
@@ -1289,16 +1237,6 @@ void RenderView::LoadNavigationErrorPage(WebFrame* frame,
replace);
}
-void RenderView::BindDOMAutomationController(WebFrame* frame) {
- if (!dom_automation_controller_.get()) {
- dom_automation_controller_.reset(new DomAutomationController());
- }
- dom_automation_controller_->set_message_sender(this);
- dom_automation_controller_->set_routing_id(routing_id_);
- dom_automation_controller_->BindToJavascript(frame,
- "domAutomationController");
-}
-
bool RenderView::RunJavaScriptMessage(int type,
const std::wstring& message,
const std::wstring& default_value,
@@ -1326,43 +1264,6 @@ bool RenderView::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) {
return Send(message);
}
-void RenderView::AddGURLSearchProvider(
- const GURL& osd_url,
- search_provider::OSDDType provider_type) {
- if (!osd_url.is_empty())
- Send(new ViewHostMsg_PageHasOSDD(routing_id_, page_id_, osd_url,
- provider_type));
-}
-
-void RenderView::OnAllowScriptToClose(bool script_can_close) {
- script_can_close_ = script_can_close;
-}
-
-void RenderView::AddSearchProvider(
- const std::string& url,
- search_provider::OSDDType provider_type) {
- if (provider_type == search_provider::EXPLICIT_DEFAULT_PROVIDER &&
- !webview()->mainFrame()->isProcessingUserGesture())
- return;
-
- AddGURLSearchProvider(GURL(url), provider_type);
-}
-
-search_provider::InstallState
-RenderView::GetSearchProviderInstallState(WebFrame* frame,
- const std::string& url) {
- GURL inquiry_url = GURL(url);
- if (inquiry_url.is_empty())
- return search_provider::DENIED;
-
- search_provider::InstallState install;
- Send(new ViewHostMsg_GetSearchProviderInstallState(routing_id_,
- frame->url(),
- inquiry_url,
- &install));
- return install;
-}
-
void RenderView::OnMissingPluginStatus(
WebPluginDelegateProxy* delegate,
int status) {
@@ -1400,10 +1301,6 @@ WebView* RenderView::createView(
if (shared_popup_counter_->data > kMaximumNumberOfUnacknowledgedPopups)
return NULL;
- // This window can't be closed from a window.close() call until we receive a
- // message from the Browser process explicitly allowing it.
- script_can_close_ = false;
-
ViewHostMsg_CreateWindow_Params params;
params.opener_id = routing_id_;
params.user_gesture = creator->isProcessingUserGesture();
@@ -1562,18 +1459,6 @@ void RenderView::didStopLoading() {
// displayed when done loading. Ideally we would send notification when
// finished parsing the head, but webkit doesn't support that yet.
// The feed discovery code would also benefit from access to the head.
-
- // TODO : Get both favicon and touch icon url, and send them to the browser.
- GURL favicon_url(webview()->mainFrame()->favIconURL());
- if (!favicon_url.is_empty()) {
- std::vector<FaviconURL> urls;
- urls.push_back(FaviconURL(favicon_url, FAVICON));
- Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, page_id_, urls));
- }
-
- AddGURLSearchProvider(webview()->mainFrame()->openSearchDescriptionURL(),
- search_provider::AUTODETECTED_PROVIDER);
-
Send(new ViewHostMsg_DidStopLoading(routing_id_));
if (load_progress_tracker_ != NULL)
@@ -1635,7 +1520,7 @@ void RenderView::didExecuteCommand(const WebString& command_name) {
StartsWithASCII(name, "Insert", true) ||
StartsWithASCII(name, "Delete", true))
return;
- UserMetricsRecordAction(name);
+ webkit_glue::UserMetricsRecordAction(name);
}
void RenderView::SendPendingAccessibilityNotifications() {
@@ -2037,8 +1922,7 @@ WebMediaPlayer* RenderView::createMediaPlayer(
WebFrame* frame, WebMediaPlayerClient* client) {
// If this is a prerendering page, start the cancel of the prerender.
if (is_prerendering_) {
- Send(new ViewHostMsg_MaybeCancelPrerender(routing_id_,
- prerender::PRERENDER_CANCELLATION_REASON_HTML5_MEDIA));
+ Send(new ViewHostMsg_MaybeCancelPrerenderForHTML5Media(routing_id_));
}
scoped_ptr<media::MessageLoopFactory> message_loop_factory(
@@ -2580,8 +2464,8 @@ void RenderView::didCommitProvisionalLoad(WebFrame* frame,
// Advance our offset in session history, applying the length limit. There
// is now no forward history.
history_list_offset_++;
- if (history_list_offset_ >= chrome::kMaxSessionHistoryEntries)
- history_list_offset_ = chrome::kMaxSessionHistoryEntries - 1;
+ if (history_list_offset_ >= content::kMaxSessionHistoryEntries)
+ history_list_offset_ = content::kMaxSessionHistoryEntries - 1;
history_list_length_ = history_list_offset_ + 1;
} else {
// Inspect the navigation_state on this frame to see if the navigation
@@ -2626,8 +2510,9 @@ void RenderView::didCommitProvisionalLoad(WebFrame* frame,
}
void RenderView::didClearWindowObject(WebFrame* frame) {
- if (BindingsPolicy::is_dom_automation_enabled(enabled_bindings_))
- BindDOMAutomationController(frame);
+ FOR_EACH_OBSERVER(RenderViewObserver, observers_,
+ DidClearWindowObject(frame));
+
GURL frame_url = frame->url();
if (BindingsPolicy::is_web_ui_enabled(enabled_bindings_) &&
(frame_url.SchemeIs(chrome::kChromeUIScheme) ||
@@ -2636,11 +2521,6 @@ void RenderView::didClearWindowObject(WebFrame* frame) {
GetWebUIBindings()->set_routing_id(routing_id_);
GetWebUIBindings()->BindToJavascript(frame, "chrome");
}
- if (BindingsPolicy::is_external_host_enabled(enabled_bindings_)) {
- GetExternalHostBindings()->set_message_sender(this);
- GetExternalHostBindings()->set_routing_id(routing_id_);
- GetExternalHostBindings()->BindToJavascript(frame, "externalHost");
- }
}
void RenderView::didCreateDocumentElement(WebFrame* frame) {
@@ -2663,11 +2543,7 @@ void RenderView::didReceiveTitle(WebFrame* frame, const WebString& title) {
}
void RenderView::didChangeIcons(WebFrame* frame) {
- if (!frame->parent()) {
- std::vector<FaviconURL> urls;
- urls.push_back(FaviconURL(frame->favIconURL(), FAVICON));
- Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, page_id_, urls));
- }
+ FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidChangeIcons(frame));
}
void RenderView::didFinishDocumentLoad(WebFrame* frame) {
@@ -2841,17 +2717,8 @@ void RenderView::didFinishResourceLoad(
}
}
- // Use an internal error page, if we have one for the status code.
- if (LocalizedError::HasStrings(LocalizedError::kHttpErrorDomain,
- http_status_code)) {
- WebURLError error;
- error.unreachableURL = frame->url();
- error.domain = WebString::fromUTF8(LocalizedError::kHttpErrorDomain);
- error.reason = http_status_code;
-
- LoadNavigationErrorPage(frame, frame->dataSource()->request(), error,
- std::string(), true);
- }
+ content::GetContentClient()->renderer()->ShowErrorPage(
+ this, frame, http_status_code);
}
void RenderView::didFailResourceLoad(
@@ -3156,75 +3023,6 @@ void RenderView::SyncNavigationState() {
routing_id_, page_id_, webkit_glue::HistoryItemToString(item)));
}
-bool RenderView::DownloadFavicon(int id, const GURL& image_url,
- int image_size) {
- // Make sure webview was not shut down.
- if (!webview())
- return false;
- // Create an image resource fetcher and assign it with a call back object.
- image_fetchers_.push_back(linked_ptr<ImageResourceFetcher>(
- new ImageResourceFetcher(
- image_url, webview()->mainFrame(), id, image_size,
- WebURLRequest::TargetIsFavicon,
- NewCallback(this, &RenderView::DidDownloadFavicon))));
- return true;
-}
-
-void RenderView::DidDownloadFavicon(ImageResourceFetcher* fetcher,
- const SkBitmap& image) {
- // Notify requester of image download status.
- Send(new ViewHostMsg_DidDownloadFavicon(routing_id_,
- fetcher->id(),
- fetcher->image_url(),
- image.isNull(),
- image));
-
- // Remove the image fetcher from our pending list. We're in the callback from
- // ImageResourceFetcher, best to delay deletion.
- for (ImageResourceFetcherList::iterator iter = image_fetchers_.begin();
- iter != image_fetchers_.end(); ++iter) {
- if (iter->get() == fetcher) {
- iter->release();
- image_fetchers_.erase(iter);
- break;
- }
- }
- MessageLoop::current()->DeleteSoon(FROM_HERE, fetcher);
-}
-
-void RenderView::OnDownloadFavicon(int id,
- const GURL& image_url,
- int image_size) {
- bool data_image_failed = false;
- if (image_url.SchemeIs("data")) {
- SkBitmap data_image = ImageFromDataUrl(image_url);
- data_image_failed = data_image.empty();
- if (!data_image_failed) {
- Send(new ViewHostMsg_DidDownloadFavicon(routing_id_, id, image_url, false,
- data_image));
- }
- }
-
- if (data_image_failed ||
- !DownloadFavicon(id, image_url, image_size)) {
- Send(new ViewHostMsg_DidDownloadFavicon(routing_id_, id, image_url, true,
- SkBitmap()));
- }
-}
-
-SkBitmap RenderView::ImageFromDataUrl(const GURL& url) const {
- std::string mime_type, char_set, data;
- if (net::DataURL::Parse(url, &mime_type, &char_set, &data) && !data.empty()) {
- // Decode the favicon using WebKit's image decoder.
- webkit_glue::ImageDecoder decoder(gfx::Size(kFaviconSize, kFaviconSize));
- const unsigned char* src_data =
- reinterpret_cast<const unsigned char*>(&data[0]);
-
- return decoder.Decode(src_data, data.size());
- }
- return SkBitmap();
-}
-
GURL RenderView::GetAlternateErrorPageURL(const GURL& failed_url,
ErrorPageType error_type) {
if (failed_url.SchemeIsSecure()) {
@@ -3289,13 +3087,6 @@ WebUIBindings* RenderView::GetWebUIBindings() {
return web_ui_bindings_.get();
}
-ExternalHostBindings* RenderView::GetExternalHostBindings() {
- if (!external_host_bindings_.get()) {
- external_host_bindings_.reset(new ExternalHostBindings());
- }
- return external_host_bindings_.get();
-}
-
WebKit::WebPlugin* RenderView::GetWebPluginFromPluginDocument() {
return webview()->mainFrame()->document().to<WebPluginDocument>().plugin();
}
@@ -3814,16 +3605,6 @@ void RenderView::OnFileChooserResponse(const std::vector<FilePath>& paths) {
}
}
-void RenderView::OnEnableViewSourceMode() {
- if (!webview())
- return;
- WebFrame* main_frame = webview()->mainFrame();
- if (!main_frame)
- return;
-
- main_frame->enableViewSourceMode(true);
-}
-
void RenderView::OnEnablePreferredSizeChangedMode(int flags) {
DCHECK(flags != kPreferredSizeNothing);
if (send_preferred_size_changes_)
@@ -3879,14 +3660,6 @@ void RenderView::OnMediaPlayerActionAt(const gfx::Point& location,
webview()->performMediaPlayerAction(action, location);
}
-void RenderView::OnNotifyRendererViewType(ViewType::Type type) {
- view_type_ = type;
-}
-
-void RenderView::OnUpdateBrowserWindowId(int window_id) {
- browser_window_id_ = window_id;
-}
-
void RenderView::OnEnableAccessibility() {
if (WebAccessibilityCache::accessibilityEnabled())
return;
@@ -3937,64 +3710,6 @@ void RenderView::OnAccessibilityNotificationsAck() {
SendPendingAccessibilityNotifications();
}
-void RenderView::OnGetAllSavableResourceLinksForCurrentPage(
- const GURL& page_url) {
- // Prepare list to storage all savable resource links.
- std::vector<GURL> resources_list;
- std::vector<GURL> referrers_list;
- std::vector<GURL> frames_list;
- webkit_glue::SavableResourcesResult result(&resources_list,
- &referrers_list,
- &frames_list);
-
- if (!webkit_glue::GetAllSavableResourceLinksForCurrentPage(
- webview(),
- page_url,
- &result,
- chrome::kSavableSchemes)) {
- // If something is wrong when collecting all savable resource links,
- // send empty list to embedder(browser) to tell it failed.
- referrers_list.clear();
- resources_list.clear();
- frames_list.clear();
- }
-
- // Send result of all savable resource links to embedder.
- Send(new ViewHostMsg_SendCurrentPageAllSavableResourceLinks(routing_id_,
- resources_list,
- referrers_list,
- frames_list));
-}
-
-void RenderView::OnGetSerializedHtmlDataForCurrentPageWithLocalLinks(
- const std::vector<GURL>& links,
- const std::vector<FilePath>& local_paths,
- const FilePath& local_directory_name) {
-
- // Convert std::vector of GURLs to WebVector<WebURL>
- WebVector<WebURL> weburl_links(links);
-
- // Convert std::vector of std::strings to WebVector<WebString>
- WebVector<WebString> webstring_paths(local_paths.size());
- for (size_t i = 0; i < local_paths.size(); i++)
- webstring_paths[i] = webkit_glue::FilePathToWebString(local_paths[i]);
-
- WebPageSerializer::serialize(webview()->mainFrame(),
- true, this, weburl_links, webstring_paths,
- webkit_glue::FilePathToWebString(
- local_directory_name));
-}
-
-void RenderView::didSerializeDataForFrame(const WebURL& frame_url,
- const WebCString& data,
- WebPageSerializerClient::PageSerializationStatus status) {
- Send(new ViewHostMsg_SendSerializedHtmlData(
- routing_id_,
- frame_url,
- data.data(),
- static_cast<int32>(status)));
-}
-
void RenderView::OnShouldClose() {
bool should_close = webview()->dispatchBeforeUnloadEvent();
Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close));
@@ -4025,15 +3740,6 @@ void RenderView::OnThemeChanged() {
#endif
}
-void RenderView::OnHandleMessageFromExternalHost(const std::string& message,
- const std::string& origin,
- const std::string& target) {
- if (message.empty())
- return;
- GetExternalHostBindings()->ForwardMessageFromExternalHost(message, origin,
- target);
-}
-
void RenderView::OnDisassociateFromPopupCount() {
if (decrement_shared_popup_at_destruction_)
shared_popup_counter_->data--;
@@ -4606,14 +4312,6 @@ void RenderView::OnConnectTcpACK(
}
#endif
-void RenderView::OnJavaScriptStressTestControl(int cmd, int param) {
- if (cmd == kJavaScriptStressTestSetStressRunType) {
- v8::Testing::SetStressRunType(static_cast<v8::Testing::StressType>(param));
- } else if (cmd == kJavaScriptStressTestPrepareStressRun) {
- v8::Testing::PrepareStressRun(param);
- }
-}
-
void RenderView::OnContextMenuClosed(
const webkit_glue::CustomContextMenuContext& custom_context) {
if (custom_context.is_pepper_menu)
diff --git a/content/renderer/render_view.h b/content/renderer/render_view.h
index 620ed24..548117e1 100644
--- a/content/renderer/render_view.h
+++ b/content/renderer/render_view.h
@@ -22,8 +22,6 @@
#include "base/timer.h"
#include "build/build_config.h"
#include "chrome/common/content_settings.h"
-#include "chrome/common/search_provider.h"
-#include "chrome/common/view_types.h"
#include "content/renderer/renderer_webcookiejar_impl.h"
#include "content/common/edit_command.h"
#include "content/common/navigation_gesture.h"
@@ -36,7 +34,6 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystem.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializerClient.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h"
@@ -54,8 +51,6 @@
class AudioMessageFilter;
class DeviceOrientationDispatcher;
-class DomAutomationController;
-class ExternalHostBindings;
class ExternalPopupMenu;
class FilePath;
class GeolocationDispatcher;
@@ -170,7 +165,6 @@ typedef base::RefCountedData<int> SharedRenderViewCounter;
class RenderView : public RenderWidget,
public WebKit::WebViewClient,
public WebKit::WebFrameClient,
- public WebKit::WebPageSerializerClient,
public webkit::npapi::WebPluginPageDelegate,
public base::SupportsWeakPtr<RenderView> {
public:
@@ -204,17 +198,9 @@ class RenderView : public RenderWidget,
// May return NULL when the view is closing.
WebKit::WebView* webview() const;
- int browser_window_id() const {
- return browser_window_id_;
- }
-
- ViewType::Type view_type() const {
- return view_type_;
- }
-
- int page_id() const {
- return page_id_;
- }
+ bool is_prerendering() const { return is_prerendering_; }
+ int page_id() const { return page_id_; }
+ PepperPluginDelegateImpl* pepper_delegate() { return &pepper_delegate_; }
AudioMessageFilter* audio_message_filter() {
return audio_message_filter_;
@@ -225,6 +211,8 @@ class RenderView : public RenderWidget,
}
bool content_state_immediately() { return send_content_state_immediately_; }
+ int enabled_bindings() const { return enabled_bindings_; }
+ void set_enabled_bindings(int b) { enabled_bindings_ = b; }
void set_send_content_state_immediately(bool value) {
send_content_state_immediately_ = value;
}
@@ -248,16 +236,6 @@ class RenderView : public RenderWidget,
void AddObserver(RenderViewObserver* observer);
void RemoveObserver(RenderViewObserver* observer);
- // Called from JavaScript window.external.AddSearchProvider() to add a
- // keyword for a provider described in the given OpenSearch document.
- void AddSearchProvider(const std::string& url,
- search_provider::OSDDType provider_type);
-
- // Returns the install state for the given search provider url.
- search_provider::InstallState GetSearchProviderInstallState(
- WebKit::WebFrame* frame,
- const std::string& url);
-
// Evaluates a string of JavaScript in a particular frame.
void EvaluateScript(const string16& frame_xpath,
const string16& jscript,
@@ -277,10 +255,6 @@ class RenderView : public RenderWidget,
// allowPlugins().
void SetContentSettings(const ContentSettings& settings);
- // Notifies the browser that the given action has been performed. This is
- // aggregated to the user metrics service.
- void UserMetricsRecordAction(const std::string& action);
-
// Sets whether the renderer should report load progress to the browser.
void SetReportLoadProgressEnabled(bool enabled);
@@ -291,6 +265,12 @@ class RenderView : public RenderWidget,
// editable div.
bool IsEditableNode(const WebKit::WebNode& node);
+ void LoadNavigationErrorPage(WebKit::WebFrame* frame,
+ const WebKit::WebURLRequest& failed_request,
+ const WebKit::WebURLError& error,
+ const std::string& html,
+ bool replace);
+
// Plugin-related functions --------------------------------------------------
// (See also WebPluginPageDelegate implementation.)
@@ -302,6 +282,19 @@ class RenderView : public RenderWidget,
void OnMissingPluginStatus(WebPluginDelegateProxy* delegate,
int status);
+ // Create a new NPAPI plugin.
+ WebKit::WebPlugin* CreateNPAPIPlugin(WebKit::WebFrame* frame,
+ const WebKit::WebPluginParams& params,
+ const FilePath& path,
+ const std::string& mime_type);
+
+ // Create a new Pepper plugin.
+ WebKit::WebPlugin* CreatePepperPlugin(
+ WebKit::WebFrame* frame,
+ const WebKit::WebPluginParams& params,
+ const FilePath& path,
+ webkit::ppapi::PluginModule* pepper_module);
+
// Creates a fullscreen container for a pepper plugin instance.
RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
webkit::ppapi::PluginInstance* plugin);
@@ -585,12 +578,6 @@ class RenderView : public RenderWidget,
unsigned long long requested_size,
WebKit::WebStorageQuotaCallbacks* callbacks);
- // WebKit::WebPageSerializerClient implementation ----------------------------
-
- virtual void didSerializeDataForFrame(const WebKit::WebURL& frame_url,
- const WebKit::WebCString& data,
- PageSerializationStatus status);
-
// webkit_glue::WebPluginPageDelegate implementation -------------------------
virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate(
@@ -723,11 +710,6 @@ class RenderView : public RenderWidget,
// Sends a message and runs a nested message loop.
bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message);
- // Adds search provider from the given OpenSearch description URL as a
- // keyword search.
- void AddGURLSearchProvider(const GURL& osd_url,
- search_provider::OSDDType provider_type);
-
// Send queued accessibility notifications from the renderer to the browser.
void SendPendingAccessibilityNotifications();
@@ -773,7 +755,6 @@ class RenderView : public RenderWidget,
void OnDisableScrollbarsForSmallWindows(
const gfx::Size& disable_scrollbars_size_limit);
void OnDisassociateFromPopupCount();
- void OnDownloadFavicon(int id, const GURL& image_url, int image_size);
void OnDragSourceEndedOrMoved(const gfx::Point& client_point,
const gfx::Point& screen_point,
bool ended,
@@ -790,21 +771,12 @@ class RenderView : public RenderWidget,
const gfx::Point& screen_pt,
WebKit::WebDragOperationsMask operations_allowed);
void OnEnablePreferredSizeChangedMode(int flags);
- void OnEnableViewSourceMode();
void OnEnumerateDirectoryResponse(int id, const std::vector<FilePath>& paths);
void OnExecuteEditCommand(const std::string& name, const std::string& value);
void OnFileChooserResponse(const std::vector<FilePath>& paths);
void OnFind(int request_id, const string16&, const WebKit::WebFindOptions&);
void OnFindReplyAck();
void OnEnableAccessibility();
- void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url);
- void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks(
- const std::vector<GURL>& links,
- const std::vector<FilePath>& local_paths,
- const FilePath& local_directory_name);
- void OnHandleMessageFromExternalHost(const std::string& message,
- const std::string& origin,
- const std::string& target);
void OnInstallMissingPlugin();
void OnDisplayPrerenderedPage();
void OnMediaPlayerActionAt(const gfx::Point& location,
@@ -812,7 +784,6 @@ class RenderView : public RenderWidget,
void OnMoveOrResizeStarted();
void OnNavigate(const ViewMsg_Navigate_Params& params);
void OnNetworkStateChanged(bool online);
- void OnNotifyRendererViewType(ViewType::Type view_type);
void OnPaste();
#if defined(OS_MACOSX)
void OnPluginImeCompositionCompleted(const string16& text, int plugin_id);
@@ -850,7 +821,6 @@ class RenderView : public RenderWidget,
void OnStopFinding(const ViewMsg_StopFinding_Params& params);
void OnThemeChanged();
void OnUndo();
- void OnUpdateBrowserWindowId(int window_id);
void OnUpdateTargetURLAck();
void OnUpdateWebPreferences(const WebPreferences& prefs);
#if defined(OS_MACOSX)
@@ -859,7 +829,6 @@ class RenderView : public RenderWidget,
void OnSelectPopupMenuItem(int selected_index);
#endif
void OnZoom(PageZoom::Function function);
- void OnJavaScriptStressTestControl(int cmd, int param);
// Adding a new message handler? Please add it in alphabetical order above
// and put it in the same position in the .cc file.
@@ -874,10 +843,6 @@ class RenderView : public RenderWidget,
const WebKit::WebURLError& original_error,
const std::string& html);
- // Exposes the DOMAutomationController object that allows JS to send
- // information to the browser process.
- void BindDOMAutomationController(WebKit::WebFrame* webframe);
-
// Check whether the preferred size has changed. This is called periodically
// by preferred_size_change_timer_.
void CheckPreferredSize();
@@ -885,19 +850,6 @@ class RenderView : public RenderWidget,
// Resets the |content_blocked_| array.
void ClearBlockedContentSettings();
- // Create a new NPAPI plugin.
- WebKit::WebPlugin* CreateNPAPIPlugin(WebKit::WebFrame* frame,
- const WebKit::WebPluginParams& params,
- const FilePath& path,
- const std::string& mime_type);
-
- // Create a new Pepper plugin.
- WebKit::WebPlugin* CreatePepperPlugin(
- WebKit::WebFrame* frame,
- const WebKit::WebPluginParams& params,
- const FilePath& path,
- webkit::ppapi::PluginModule* pepper_module);
-
// Sends an IPC notification that the specified content type was blocked.
// If the content type requires it, |resource_identifier| names the specific
// resource that was blocked (the plugin path in the case of plugins),
@@ -905,21 +857,6 @@ class RenderView : public RenderWidget,
void DidBlockContentType(ContentSettingsType settings_type,
const std::string& resource_identifier);
- // This callback is triggered when DownloadFavicon completes, either
- // succesfully or with a failure. See DownloadFavicon for more
- // details.
- void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher,
- const SkBitmap& image);
-
- // Requests to download a favicon image. When done, the RenderView
- // is notified by way of DidDownloadFavicon. Returns true if the
- // request was successfully started, false otherwise. id is used to
- // uniquely identify the request and passed back to the
- // DidDownloadFavicon method. If the image has multiple frames, the
- // frame whose size is image_size is returned. If the image doesn't
- // have a frame at the specified size, the first is returned.
- bool DownloadFavicon(int id, const GURL& image_url, int image_size);
-
GURL GetAlternateErrorPageURL(const GURL& failed_url,
ErrorPageType error_type);
@@ -928,14 +865,9 @@ class RenderView : public RenderWidget,
WebUIBindings* GetWebUIBindings();
- ExternalHostBindings* GetExternalHostBindings();
-
// Should only be called if this object wraps a PluginDocument.
WebKit::WebPlugin* GetWebPluginFromPluginDocument();
- // Decodes a data: URL image or returns an empty image in case of failure.
- SkBitmap ImageFromDataUrl(const GURL&) const;
-
// Inserts a string of CSS in a particular frame. |id| can be specified to
// give the CSS style element an id, and (if specified) will replace the
// element with the same id.
@@ -948,12 +880,6 @@ class RenderView : public RenderWidget,
WebKit::WebFrame* frame,
WebKit::WebNavigationType type);
- void LoadNavigationErrorPage(WebKit::WebFrame* frame,
- const WebKit::WebURLRequest& failed_request,
- const WebKit::WebURLError& error,
- const std::string& html,
- bool replace);
-
bool MaybeLoadAlternateErrorPage(WebKit::WebFrame* frame,
const WebKit::WebURLError& error,
bool replace);
@@ -1017,15 +943,6 @@ class RenderView : public RenderWidget,
// should be drawn.
gfx::Size disable_scrollbars_size_limit_;
- // We need to prevent windows from closing themselves with a window.close()
- // call while a blocked popup notification is being displayed. We cannot
- // synchronously query the Browser process. We cannot wait for the Browser
- // process to send a message to us saying that a blocked popup notification
- // is being displayed. We instead assume that when we create a window off
- // this RenderView, that it is going to be blocked until we get a message
- // from the Browser process telling us otherwise.
- bool script_can_close_;
-
// Loading state -------------------------------------------------------------
// True if the top level frame is currently being loaded.
@@ -1134,13 +1051,6 @@ class RenderView : public RenderWidget,
// View ----------------------------------------------------------------------
- // Type of view attached with RenderView. See view_types.h
- ViewType::Type view_type_;
-
- // Id number of browser window which RenderView is attached to. This is used
- // for extensions.
- int browser_window_id_;
-
// Cache the preferred size of the page in order to prevent sending the IPC
// when layout() recomputes but doesn't actually change sizes.
gfx::Size preferred_size_;
@@ -1222,9 +1132,6 @@ class RenderView : public RenderWidget,
std::map<int, WebKit::WebFileChooserCompletion*> enumeration_completions_;
int enumeration_completion_id_;
- // ImageResourceFetchers schedule via DownloadImage.
- ImageResourceFetcherList image_fetchers_;
-
// The SessionStorage namespace that we're assigned to has an ID, and that ID
// is passed to us upon creation. WebKit asks for this ID upon first use and
// uses it whenever asking the browser process to allocate new storage areas.
@@ -1249,17 +1156,10 @@ class RenderView : public RenderWidget,
// Shall be cleared as soon as the next key event is processed.
EditCommands edit_commands_;
- // Allows JS to access DOM automation. The JS object is only exposed when the
- // DOM automation bindings are enabled.
- scoped_ptr<DomAutomationController> dom_automation_controller_;
-
// Allows Web UI pages (new tab page, etc.) to talk to the browser. The JS
// object is only exposed when Web UI bindings are enabled.
scoped_ptr<WebUIBindings> web_ui_bindings_;
- // External host exposed through automation controller.
- scoped_ptr<ExternalHostBindings> external_host_bindings_;
-
// The external popup for the currently showing select popup.
scoped_ptr<ExternalPopupMenu> external_popup_menu_;
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc
index f64c0df..afce5c3 100644
--- a/content/renderer/render_view_browsertest.cc
+++ b/content/renderer/render_view_browsertest.cc
@@ -4,46 +4,26 @@
#include "base/basictypes.h"
-#include "base/file_util.h"
#include "base/shared_memory.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
-#include "chrome/common/autofill_messages.h"
-#include "chrome/common/content_settings.h"
#include "chrome/common/render_messages.h"
-#include "chrome/renderer/print_web_view_helper.h"
#include "chrome/test/render_view_test.h"
#include "content/common/native_web_keyboard_event.h"
#include "content/common/view_messages.h"
#include "net/base/net_errors.h"
-#include "printing/image.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "ui/base/keycodes/keyboard_codes.h"
#include "ui/gfx/codec/jpeg_codec.h"
-#include "webkit/glue/form_data.h"
-#include "webkit/glue/form_field.h"
#include "webkit/glue/web_io_operators.h"
-using WebKit::WebDocument;
using WebKit::WebFrame;
-using WebKit::WebInputElement;
using WebKit::WebString;
using WebKit::WebTextDirection;
using WebKit::WebURLError;
-using webkit_glue::FormData;
-using webkit_glue::FormField;
-
-namespace {
-
-const char kPrintWithJSHTML[] =
- "<body>Hello<script>window.print()</script>World</body>";
-
-} // namespace
// Test that we get form state change notifications when input fields change.
TEST_F(RenderViewTest, OnNavStateChanged) {
@@ -394,186 +374,6 @@ TEST_F(RenderViewTest, OnSetTextDirection) {
}
}
-// Tests that printing pages work and sending and receiving messages through
-// that channel all works.
-TEST_F(RenderViewTest, OnPrintPages) {
- // Lets simulate a print pages with Hello world.
- LoadHTML("<body><p>Hello World!</p></body>");
- PrintWebViewHelper::Get(view_)->OnPrintPages();
-
- VerifyPageCount(1);
- VerifyPagesPrinted(true);
-}
-
-// Duplicate of OnPrintPagesTest only using javascript to print.
-TEST_F(RenderViewTest, PrintWithJavascript) {
- // HTML contains a call to window.print()
- LoadHTML(kPrintWithJSHTML);
-
- VerifyPageCount(1);
- VerifyPagesPrinted(true);
-}
-
-// Tests that the renderer blocks window.print() calls if they occur too
-// frequently.
-TEST_F(RenderViewTest, BlockScriptInitiatedPrinting) {
- // Pretend user will cancel printing.
- render_thread_.set_print_dialog_user_response(false);
- // Try to print with window.print() a few times.
- LoadHTML(kPrintWithJSHTML);
- LoadHTML(kPrintWithJSHTML);
- LoadHTML(kPrintWithJSHTML);
- VerifyPagesPrinted(false);
-
- // Pretend user will print. (but printing is blocked.)
- render_thread_.set_print_dialog_user_response(true);
- LoadHTML(kPrintWithJSHTML);
- VerifyPagesPrinted(false);
-
- // Unblock script initiated printing and verify printing works.
- PrintWebViewHelper::Get(view_)->ResetScriptedPrintCount();
- render_thread_.printer()->ResetPrinter();
- LoadHTML(kPrintWithJSHTML);
- VerifyPageCount(1);
- VerifyPagesPrinted(true);
-}
-
-#if defined(OS_WIN) || defined(OS_MACOSX)
-// TODO(estade): I don't think this test is worth porting to Linux. We will have
-// to rip out and replace most of the IPC code if we ever plan to improve
-// printing, and the comment below by sverrir suggests that it doesn't do much
-// for us anyway.
-TEST_F(RenderViewTest, PrintWithIframe) {
- // Document that populates an iframe.
- const char html[] =
- "<html><body>Lorem Ipsum:"
- "<iframe name=\"sub1\" id=\"sub1\"></iframe><script>"
- " document.write(frames['sub1'].name);"
- " frames['sub1'].document.write("
- " '<p>Cras tempus ante eu felis semper luctus!</p>');"
- "</script></body></html>";
-
- LoadHTML(html);
-
- // Find the frame and set it as the focused one. This should mean that that
- // the printout should only contain the contents of that frame.
- WebFrame* sub1_frame =
- view_->webview()->findFrameByName(WebString::fromUTF8("sub1"));
- ASSERT_TRUE(sub1_frame);
- view_->webview()->setFocusedFrame(sub1_frame);
- ASSERT_NE(view_->webview()->focusedFrame(),
- view_->webview()->mainFrame());
-
- // Initiate printing.
- PrintWebViewHelper::Get(view_)->OnPrintPages();
-
- // Verify output through MockPrinter.
- const MockPrinter* printer(render_thread_.printer());
- ASSERT_EQ(1, printer->GetPrintedPages());
- const printing::Image& image1(printer->GetPrintedPage(0)->image());
-
- // TODO(sverrir): Figure out a way to improve this test to actually print
- // only the content of the iframe. Currently image1 will contain the full
- // page.
- EXPECT_NE(0, image1.size().width());
- EXPECT_NE(0, image1.size().height());
-}
-#endif
-
-// Tests if we can print a page and verify its results.
-// This test prints HTML pages into a pseudo printer and check their outputs,
-// i.e. a simplified version of the PrintingLayoutTextTest UI test.
-namespace {
-// Test cases used in this test.
-struct TestPageData {
- const char* page;
- size_t printed_pages;
- int width;
- int height;
- const char* checksum;
- const wchar_t* file;
-};
-
-const TestPageData kTestPages[] = {
- {"<html>"
- "<head>"
- "<meta"
- " http-equiv=\"Content-Type\""
- " content=\"text/html; charset=utf-8\"/>"
- "<title>Test 1</title>"
- "</head>"
- "<body style=\"background-color: white;\">"
- "<p style=\"font-family: arial;\">Hello World!</p>"
- "</body>",
-#if defined(OS_MACOSX)
- // Mac printing code compensates for the WebKit scale factor while generating
- // the metafile, so we expect smaller pages.
- 1, 540, 720,
-#else
- 1, 675, 900,
-#endif
- NULL,
- NULL,
- },
-};
-} // namespace
-
-// TODO(estade): need to port MockPrinter to get this on Linux. This involves
-// hooking up Cairo to read a pdf stream, or accessing the cairo surface in the
-// metafile directly.
-#if defined(OS_WIN) || defined(OS_MACOSX)
-TEST_F(RenderViewTest, PrintLayoutTest) {
- bool baseline = false;
-
- EXPECT_TRUE(render_thread_.printer() != NULL);
- for (size_t i = 0; i < arraysize(kTestPages); ++i) {
- // Load an HTML page and print it.
- LoadHTML(kTestPages[i].page);
- PrintWebViewHelper::Get(view_)->OnPrintPages();
-
- // MockRenderThread::Send() just calls MockRenderThread::OnMsgReceived().
- // So, all IPC messages sent in the above RenderView::OnPrintPages() call
- // has been handled by the MockPrinter object, i.e. this printing job
- // has been already finished.
- // So, we can start checking the output pages of this printing job.
- // Retrieve the number of pages actually printed.
- size_t pages = render_thread_.printer()->GetPrintedPages();
- EXPECT_EQ(kTestPages[i].printed_pages, pages);
-
- // Retrieve the width and height of the output page.
- int width = render_thread_.printer()->GetWidth(0);
- int height = render_thread_.printer()->GetHeight(0);
-
- // Check with margin for error. This has been failing with a one pixel
- // offset on our buildbot.
- const int kErrorMargin = 5; // 5%
- EXPECT_GT(kTestPages[i].width * (100 + kErrorMargin) / 100, width);
- EXPECT_LT(kTestPages[i].width * (100 - kErrorMargin) / 100, width);
- EXPECT_GT(kTestPages[i].height * (100 + kErrorMargin) / 100, height);
- EXPECT_LT(kTestPages[i].height* (100 - kErrorMargin) / 100, height);
-
- // Retrieve the checksum of the bitmap data from the pseudo printer and
- // compare it with the expected result.
- std::string bitmap_actual;
- EXPECT_TRUE(render_thread_.printer()->GetBitmapChecksum(0, &bitmap_actual));
- if (kTestPages[i].checksum)
- EXPECT_EQ(kTestPages[i].checksum, bitmap_actual);
-
- if (baseline) {
- // Save the source data and the bitmap data into temporary files to
- // create base-line results.
- FilePath source_path;
- file_util::CreateTemporaryFile(&source_path);
- render_thread_.printer()->SaveSource(0, source_path);
-
- FilePath bitmap_path;
- file_util::CreateTemporaryFile(&bitmap_path);
- render_thread_.printer()->SaveBitmap(0, bitmap_path);
- }
- }
-}
-#endif
-
// Test that we can receive correct DOM events when we send input events
// through the RenderWidget::OnHandleInputEvent() function.
TEST_F(RenderViewTest, OnHandleKeyboardEvent) {
@@ -1027,213 +827,3 @@ TEST_F(RenderViewTest, UpdateTargetURLWithInvalidURL) {
view_->setMouseOverURL(WebKit::WebURL(invalid_gurl));
EXPECT_EQ(invalid_gurl, view_->target_url_);
}
-
-TEST_F(RenderViewTest, SendForms) {
- // Don't want any delay for form state sync changes. This will still post a
- // message so updates will get coalesced, but as soon as we spin the message
- // loop, it will generate an update.
- view_->set_send_content_state_immediately(true);
-
- LoadHTML("<form method=\"POST\">"
- " <input type=\"text\" id=\"firstname\"/>"
- " <input type=\"text\" id=\"middlename\" autoComplete=\"off\"/>"
- " <input type=\"hidden\" id=\"lastname\"/>"
- " <select id=\"state\"/>"
- " <option>?</option>"
- " <option>California</option>"
- " <option>Texas</option>"
- " </select>"
- "</form>");
-
- // Verify that "FormsSeen" sends the expected number of fields.
- ProcessPendingMessages();
- const IPC::Message* message = render_thread_.sink().GetFirstMessageMatching(
- AutofillHostMsg_FormsSeen::ID);
- ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
- AutofillHostMsg_FormsSeen::Param params;
- AutofillHostMsg_FormsSeen::Read(message, &params);
- const std::vector<FormData>& forms = params.a;
- ASSERT_EQ(1UL, forms.size());
- ASSERT_EQ(3UL, forms[0].fields.size());
- EXPECT_TRUE(forms[0].fields[0].StrictlyEqualsHack(
- FormField(string16(),
- ASCIIToUTF16("firstname"),
- string16(),
- ASCIIToUTF16("text"),
- WebInputElement::defaultMaxLength(),
- false))) << forms[0].fields[0];
- EXPECT_TRUE(forms[0].fields[1].StrictlyEqualsHack(
- FormField(string16(),
- ASCIIToUTF16("middlename"),
- string16(),
- ASCIIToUTF16("text"),
- WebInputElement::defaultMaxLength(),
- false))) << forms[0].fields[1];
- EXPECT_TRUE(forms[0].fields[2].StrictlyEqualsHack(
- FormField(string16(),
- ASCIIToUTF16("state"),
- ASCIIToUTF16("?"),
- ASCIIToUTF16("select-one"),
- 0,
- false))) << forms[0].fields[2];
-
- // Verify that |didAcceptAutoFillSuggestion()| sends the expected number of
- // fields.
- WebFrame* web_frame = GetMainFrame();
- WebDocument document = web_frame->document();
- WebInputElement firstname =
- document.getElementById("firstname").to<WebInputElement>();
-
- // Accept suggestion that contains a label. Labeled items indicate Autofill
- // as opposed to Autocomplete. We're testing this distinction below with
- // the |AutofillHostMsg_FillAutofillFormData::ID| message.
- autofill_agent_->didAcceptAutoFillSuggestion(
- firstname,
- WebKit::WebString::fromUTF8("Johnny"),
- WebKit::WebString::fromUTF8("Home"),
- 1,
- -1);
-
- ProcessPendingMessages();
- const IPC::Message* message2 = render_thread_.sink().GetUniqueMessageMatching(
- AutofillHostMsg_FillAutofillFormData::ID);
- ASSERT_NE(static_cast<IPC::Message*>(NULL), message2);
- AutofillHostMsg_FillAutofillFormData::Param params2;
- AutofillHostMsg_FillAutofillFormData::Read(message2, &params2);
- const FormData& form2 = params2.b;
- ASSERT_EQ(3UL, form2.fields.size());
- EXPECT_TRUE(form2.fields[0].StrictlyEqualsHack(
- FormField(string16(),
- ASCIIToUTF16("firstname"),
- string16(),
- ASCIIToUTF16("text"),
- WebInputElement::defaultMaxLength(),
- false))) << form2.fields[0];
- EXPECT_TRUE(form2.fields[1].StrictlyEqualsHack(
- FormField(string16(),
- ASCIIToUTF16("middlename"),
- string16(),
- ASCIIToUTF16("text"),
- WebInputElement::defaultMaxLength(),
- false))) << form2.fields[1];
- EXPECT_TRUE(form2.fields[2].StrictlyEqualsHack(
- FormField(string16(),
- ASCIIToUTF16("state"),
- ASCIIToUTF16("?"),
- ASCIIToUTF16("select-one"),
- 0,
- false))) << form2.fields[2];
-}
-
-TEST_F(RenderViewTest, FillFormElement) {
- // Don't want any delay for form state sync changes. This will still post a
- // message so updates will get coalesced, but as soon as we spin the message
- // loop, it will generate an update.
- view_->set_send_content_state_immediately(true);
-
- LoadHTML("<form method=\"POST\">"
- " <input type=\"text\" id=\"firstname\"/>"
- " <input type=\"text\" id=\"middlename\"/>"
- "</form>");
-
- // Verify that "FormsSeen" isn't sent, as there are too few fields.
- ProcessPendingMessages();
- const IPC::Message* message = render_thread_.sink().GetFirstMessageMatching(
- AutofillHostMsg_FormsSeen::ID);
- ASSERT_EQ(static_cast<IPC::Message*>(NULL), message);
-
- // Verify that |didAcceptAutoFillSuggestion()| sets the value of the expected
- // field.
- WebFrame* web_frame = GetMainFrame();
- WebDocument document = web_frame->document();
- WebInputElement firstname =
- document.getElementById("firstname").to<WebInputElement>();
- WebInputElement middlename =
- document.getElementById("middlename").to<WebInputElement>();
- middlename.setAutofilled(true);
-
- // Accept a suggestion in a form that has been auto-filled. This triggers
- // the direct filling of the firstname element with value parameter.
- autofill_agent_->didAcceptAutoFillSuggestion(firstname,
- WebString::fromUTF8("David"),
- WebString(),
- 0,
- 0);
-
- ProcessPendingMessages();
- const IPC::Message* message2 = render_thread_.sink().GetUniqueMessageMatching(
- AutofillHostMsg_FillAutofillFormData::ID);
-
- // No message should be sent in this case. |firstname| is filled directly.
- ASSERT_EQ(static_cast<IPC::Message*>(NULL), message2);
- EXPECT_EQ(firstname.value(), WebKit::WebString::fromUTF8("David"));
-}
-
-// Tests that we send the right translatable for a page and that we respect the
-// "no translate" meta-tag.
-TEST_F(RenderViewTest, TranslatablePage) {
- // Suppress the normal delay that occurs when the page is loaded before which
- // the renderer sends the page contents to the browser.
- view_->set_send_content_state_immediately(true);
-
- LoadHTML("<html><body>A random page with random content.</body></html>");
- ProcessPendingMessages();
- const IPC::Message* message = render_thread_.sink().GetUniqueMessageMatching(
- ViewHostMsg_TranslateLanguageDetermined::ID);
- ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
- ViewHostMsg_TranslateLanguageDetermined::Param params;
- ViewHostMsg_TranslateLanguageDetermined::Read(message, &params);
- EXPECT_TRUE(params.b); // Translatable should be true.
- render_thread_.sink().ClearMessages();
-
- // Now the page specifies the META tag to prevent translation.
- LoadHTML("<html><head><meta name=\"google\" value=\"notranslate\"></head>"
- "<body>A random page with random content.</body></html>");
- ProcessPendingMessages();
- message = render_thread_.sink().GetUniqueMessageMatching(
- ViewHostMsg_TranslateLanguageDetermined::ID);
- ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
- ViewHostMsg_TranslateLanguageDetermined::Read(message, &params);
- EXPECT_FALSE(params.b); // Translatable should be false.
- render_thread_.sink().ClearMessages();
-
- // Try the alternate version of the META tag (content instead of value).
- LoadHTML("<html><head><meta name=\"google\" content=\"notranslate\"></head>"
- "<body>A random page with random content.</body></html>");
- ProcessPendingMessages();
- message = render_thread_.sink().GetUniqueMessageMatching(
- ViewHostMsg_TranslateLanguageDetermined::ID);
- ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
- ViewHostMsg_TranslateLanguageDetermined::Read(message, &params);
- EXPECT_FALSE(params.b); // Translatable should be false.
-}
-
-// Tests that the language meta tag takes precedence over the CLD when reporting
-// the page's language.
-TEST_F(RenderViewTest, LanguageMetaTag) {
- // Suppress the normal delay that occurs when the page is loaded before which
- // the renderer sends the page contents to the browser.
- view_->set_send_content_state_immediately(true);
-
- LoadHTML("<html><head><meta http-equiv=\"content-language\" content=\"es\">"
- "</head><body>A random page with random content.</body></html>");
- ProcessPendingMessages();
- const IPC::Message* message = render_thread_.sink().GetUniqueMessageMatching(
- ViewHostMsg_TranslateLanguageDetermined::ID);
- ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
- ViewHostMsg_TranslateLanguageDetermined::Param params;
- ViewHostMsg_TranslateLanguageDetermined::Read(message, &params);
- EXPECT_EQ("es", params.a);
- render_thread_.sink().ClearMessages();
-
- // Makes sure we support multiple languages specified.
- LoadHTML("<html><head><meta http-equiv=\"content-language\" "
- "content=\" fr , es,en \">"
- "</head><body>A random page with random content.</body></html>");
- ProcessPendingMessages();
- message = render_thread_.sink().GetUniqueMessageMatching(
- ViewHostMsg_TranslateLanguageDetermined::ID);
- ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
- ViewHostMsg_TranslateLanguageDetermined::Read(message, &params);
- EXPECT_EQ("fr", params.a);
-}
diff --git a/content/renderer/render_view_browsertest_mac.mm b/content/renderer/render_view_browsertest_mac.mm
index 56fe589..174a02e 100644
--- a/content/renderer/render_view_browsertest_mac.mm
+++ b/content/renderer/render_view_browsertest_mac.mm
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/string_util.h"
#include "base/string16.h"
-#include "chrome/common/render_messages.h"
#include "chrome/test/render_view_test.h"
#include "content/common/native_web_keyboard_event.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/content/renderer/render_view_observer.h b/content/renderer/render_view_observer.h
index a1ddafd..cdb0b51 100644
--- a/content/renderer/render_view_observer.h
+++ b/content/renderer/render_view_observer.h
@@ -34,6 +34,7 @@ class RenderViewObserver : public IPC::Channel::Listener,
// These match the WebKit API notifications
virtual void DidStartLoading() {}
virtual void DidStopLoading() {}
+ virtual void DidChangeIcons(WebKit::WebFrame* frame) {}
virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame) {}
virtual void DidFailLoad(WebKit::WebFrame* frame,
const WebKit::WebURLError& error) {}
@@ -43,6 +44,7 @@ class RenderViewObserver : public IPC::Channel::Listener,
const WebKit::WebURLError& error) {}
virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame,
bool is_new_navigation) {}
+ virtual void DidClearWindowObject(WebKit::WebFrame* frame) {}
virtual void WillPerformClientRedirect(
WebKit::WebFrame* frame, const WebKit::WebURL& from,
const WebKit::WebURL& to, double interval, double fire_time) {}
diff --git a/content/renderer/render_widget_unittest.cc b/content/renderer/render_widget_unittest.cc
deleted file mode 100644
index 0998c6a..0000000
--- a/content/renderer/render_widget_unittest.cc
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) 2011 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 "testing/gtest/include/gtest/gtest.h"
-
-#include "base/memory/ref_counted.h"
-#include "chrome/renderer/mock_render_process.h"
-#include "chrome/renderer/mock_render_thread.h"
-#include "content/renderer/render_thread.h"
-#include "content/renderer/render_widget.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h"
-
-namespace {
-
-const int32 kRouteId = 5;
-const int32 kOpenerId = 7;
-
-class RenderWidgetTest : public testing::Test {
- public:
-
- protected:
- MessageLoop msg_loop_;
- MockRenderThread render_thread_;
-
- // The widget, each test should verify this is non-NULL before continuing.
- scoped_refptr<RenderWidget> widget_;
-
- private:
- // testing::Test
- virtual void SetUp() {
- mock_process_.reset(new MockRenderProcess);
- render_thread_.set_routing_id(kRouteId);
- widget_ = RenderWidget::Create(kOpenerId, &render_thread_,
- WebKit::WebPopupTypeNone);
- ASSERT_TRUE(widget_);
- }
- virtual void TearDown() {
- widget_ = NULL;
- mock_process_.reset();
- }
-
- scoped_ptr<MockRenderProcess> mock_process_;
-};
-
-TEST_F(RenderWidgetTest, CreateAndCloseWidget) {
- // After the RenderWidget it must have sent a message to the render thread
- // that sets the opener id.
- EXPECT_EQ(kOpenerId, render_thread_.opener_id());
- ASSERT_TRUE(render_thread_.has_widget());
-
- // Now simulate a close of the Widget.
- render_thread_.SendCloseMessage();
- EXPECT_FALSE(render_thread_.has_widget());
-
- // Run the loop so the release task from the renderwidget executes.
- msg_loop_.PostTask(FROM_HERE, new MessageLoop::QuitTask());
- msg_loop_.Run();
-}
-
-} // namespace
diff --git a/content/worker/worker_uitest.cc b/content/worker/worker_uitest.cc
index f3b2c7c..73e20ac 100644
--- a/content/worker/worker_uitest.cc
+++ b/content/worker/worker_uitest.cc
@@ -7,12 +7,12 @@
#include "base/test/test_timeouts.h"
#include "base/threading/platform_thread.h"
#include "chrome/app/chrome_command_ids.h"
-#include "chrome/common/url_constants.h"
#include "chrome/test/automation/browser_proxy.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/ui/ui_layout_test.h"
#include "chrome/test/ui_test_utils.h"
#include "content/browser/worker_host/worker_service.h"
+#include "content/common/url_constants.h"
#include "net/test/test_server.h"
namespace {