diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-19 00:43:36 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-19 00:43:36 +0000 |
commit | 6091604d9afaa69457389d83f1a9d6453150e6f4 (patch) | |
tree | a008aad369c12d1d12f0adeb9fa276b9c8305e50 /chrome | |
parent | 611cc90419870d40c0048c01ce72def49b8b5dd3 (diff) | |
download | chromium_src-6091604d9afaa69457389d83f1a9d6453150e6f4.zip chromium_src-6091604d9afaa69457389d83f1a9d6453150e6f4.tar.gz chromium_src-6091604d9afaa69457389d83f1a9d6453150e6f4.tar.bz2 |
Move a bunch of remaining files from chrome\renderer to content\renderer.
TBR=avi
Review URL: http://codereview.chromium.org/6688047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78781 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
61 files changed, 54 insertions, 1792 deletions
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc index 5455bef..167a84f 100644 --- a/chrome/browser/instant/instant_loader.cc +++ b/chrome/browser/instant/instant_loader.cc @@ -22,7 +22,6 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/render_messages.h" -#include "chrome/common/renderer_preferences.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" @@ -38,6 +37,7 @@ #include "content/common/notification_source.h" #include "content/common/notification_type.h" #include "content/common/page_transition_types.h" +#include "content/common/renderer_preferences.h" #include "net/http/http_util.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/codec/png_codec.h" diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc index a4aa634..7b2adea 100644 --- a/chrome/browser/notifications/balloon_host.cc +++ b/chrome/browser/notifications/balloon_host.cc @@ -15,13 +15,13 @@ #include "chrome/common/bindings_policy.h" #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" -#include "chrome/common/renderer_preferences.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/notification_service.h" #include "content/common/notification_source.h" #include "content/common/notification_type.h" +#include "content/common/renderer_preferences.h" #include "webkit/glue/webpreferences.h" BalloonHost::BalloonHost(Balloon* balloon) diff --git a/chrome/browser/renderer_preferences_util.h b/chrome/browser/renderer_preferences_util.h index f1ba8c7..ccca11a 100644 --- a/chrome/browser/renderer_preferences_util.h +++ b/chrome/browser/renderer_preferences_util.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_RENDERER_PREFERENCES_UTIL_H_ #pragma once -#include "chrome/common/renderer_preferences.h" +#include "content/common/renderer_preferences.h" class Profile; diff --git a/chrome/browser/ui/gtk/gtk_util.cc b/chrome/browser/ui/gtk/gtk_util.cc index a1e338c..a7b46eb 100644 --- a/chrome/browser/ui/gtk/gtk_util.cc +++ b/chrome/browser/ui/gtk/gtk_util.cc @@ -26,10 +26,10 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/gtk/cairo_cached_surface.h" #include "chrome/browser/ui/gtk/gtk_theme_provider.h" -#include "chrome/common/renderer_preferences.h" #include "content/browser/disposition_utils.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/renderer_preferences.h" #include "googleurl/src/gurl.h" #include "grit/theme_resources.h" #include "third_party/skia/include/core/SkBitmap.h" diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 6733292..a845f31 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -211,8 +211,6 @@ 'common/render_messages.h', 'common/render_messages_params.cc', 'common/render_messages_params.h', - 'common/renderer_preferences.cc', - 'common/renderer_preferences.h', 'common/security_style.h', 'common/service_messages.h', 'common/service_process_util.cc', diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi index c5c4a98..7646398 100644 --- a/chrome/chrome_renderer.gypi +++ b/chrome/chrome_renderer.gypi @@ -114,9 +114,6 @@ 'renderer/render_process_impl.h', 'renderer/render_thread.cc', 'renderer/render_thread.h', - 'renderer/render_view_linux.cc', - 'renderer/render_view_observer.cc', - 'renderer/render_view_observer.h', 'renderer/renderer_glue.cc', 'renderer/renderer_histogram_snapshots.cc', 'renderer/renderer_histogram_snapshots.h', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 7f2d305..6de97be 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -2290,8 +2290,6 @@ 'renderer/autofill/form_manager_browsertest.cc', 'renderer/autofill/password_autofill_manager_unittest.cc', 'renderer/page_click_tracker_browsertest.cc', - 'renderer/render_view_browsertest.cc', - 'renderer/render_view_browsertest_mac.mm', 'renderer/safe_browsing/malware_dom_details_browsertest.cc', 'renderer/safe_browsing/phishing_classifier_browsertest.cc', 'renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc', @@ -2319,6 +2317,8 @@ '../content/browser/webui/web_ui_handler_browsertest.cc', '../content/browser/webui/web_ui_handler_browsertest.h', '../content/common/file_path_watcher/file_path_watcher_browsertest.cc', + '../content/renderer/render_view_browsertest.cc', + '../content/renderer/render_view_browsertest_mac.mm', '../content/renderer/render_widget_browsertest.cc', '../content/renderer/render_widget_browsertest.h', ], diff --git a/chrome/common/render_messages_params.h b/chrome/common/render_messages_params.h index 596f5d6..2362d18 100644 --- a/chrome/common/render_messages_params.h +++ b/chrome/common/render_messages_params.h @@ -18,11 +18,11 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_extent.h" #include "chrome/common/extensions/url_pattern.h" -#include "chrome/common/renderer_preferences.h" #include "chrome/common/window_container_type.h" #include "content/common/navigation_gesture.h" #include "content/common/navigation_types.h" #include "content/common/page_transition_types.h" +#include "content/common/renderer_preferences.h" #include "content/common/serialized_script_value.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_param_traits.h" diff --git a/chrome/common/renderer_preferences.cc b/chrome/common/renderer_preferences.cc deleted file mode 100644 index 4c29dd8..0000000 --- a/chrome/common/renderer_preferences.cc +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/common/renderer_preferences.h" - -RendererPreferences::RendererPreferences() - : can_accept_load_drops(true), - should_antialias_text(true), - hinting(RENDERER_PREFERENCES_HINTING_SYSTEM_DEFAULT), - subpixel_rendering( - RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT), - focus_ring_color(0), - thumb_active_color(0), - thumb_inactive_color(0), - track_color(0), - active_selection_bg_color(0), - active_selection_fg_color(0), - inactive_selection_bg_color(0), - inactive_selection_fg_color(0), - browser_handles_top_level_requests(false), - caret_blink_interval(0) { -} diff --git a/chrome/common/renderer_preferences.h b/chrome/common/renderer_preferences.h deleted file mode 100644 index 0bb72ef..0000000 --- a/chrome/common/renderer_preferences.h +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2006-2008 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. -// -// A struct for managing browser's settings that apply to the renderer or its -// webview. These differ from WebPreferences since they apply to Chromium's -// glue layer rather than applying to just WebKit. -// -// Adding new values to this class probably involves updating -// common/render_messages.h, browser/browser.cc, etc. - -#ifndef CHROME_COMMON_RENDERER_PREFERENCES_H_ -#define CHROME_COMMON_RENDERER_PREFERENCES_H_ -#pragma once - -#include "third_party/skia/include/core/SkColor.h" - -enum RendererPreferencesHintingEnum { - RENDERER_PREFERENCES_HINTING_SYSTEM_DEFAULT = 0, - RENDERER_PREFERENCES_HINTING_NONE, - RENDERER_PREFERENCES_HINTING_SLIGHT, - RENDERER_PREFERENCES_HINTING_MEDIUM, - RENDERER_PREFERENCES_HINTING_FULL, -}; - -enum RendererPreferencesSubpixelRenderingEnum { - RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT = 0, - RENDERER_PREFERENCES_SUBPIXEL_RENDERING_NONE, - RENDERER_PREFERENCES_SUBPIXEL_RENDERING_RGB, - RENDERER_PREFERENCES_SUBPIXEL_RENDERING_BGR, - RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VRGB, - RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VBGR, -}; - -struct RendererPreferences { - RendererPreferences(); - - // Whether the renderer's current browser context accept drops from the OS - // that result in navigations away from the current page. - bool can_accept_load_drops; - - // Whether text should be antialiased. - // Currently only used by Linux. - bool should_antialias_text; - - // The level of hinting to use when rendering text. - // Currently only used by Linux. - RendererPreferencesHintingEnum hinting; - - // The type of subpixel rendering to use for text. - // Currently only used by Linux. - RendererPreferencesSubpixelRenderingEnum subpixel_rendering; - - // The color of the focus ring. Currently only used on Linux. - SkColor focus_ring_color; - - // The color of different parts of the scrollbar. Currently only used on - // Linux. - SkColor thumb_active_color; - SkColor thumb_inactive_color; - SkColor track_color; - - // The colors used in selection text. Currently only used on Linux. - SkColor active_selection_bg_color; - SkColor active_selection_fg_color; - SkColor inactive_selection_bg_color; - SkColor inactive_selection_fg_color; - - // Browser wants a look at all top level requests - bool browser_handles_top_level_requests; - - // Cursor blink rate in seconds. - // Currently only changed from default on Linux. Uses |gtk-cursor-blink| - // from GtkSettings. - double caret_blink_interval; -}; - -#endif // CHROME_COMMON_RENDERER_PREFERENCES_H_ diff --git a/chrome/renderer/autofill/autofill_agent.cc b/chrome/renderer/autofill/autofill_agent.cc index e5798b8..0cb4830 100644 --- a/chrome/renderer/autofill/autofill_agent.cc +++ b/chrome/renderer/autofill/autofill_agent.cc @@ -8,7 +8,7 @@ #include "chrome/common/autofill_messages.h" #include "chrome/common/chrome_constants.h" #include "chrome/renderer/autofill/password_autofill_manager.h" -#include "chrome/renderer/render_view.h" +#include "content/renderer/render_view.h" #include "grit/generated_resources.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement.h" diff --git a/chrome/renderer/autofill/autofill_agent.h b/chrome/renderer/autofill/autofill_agent.h index 298a800..e41afcd 100644 --- a/chrome/renderer/autofill/autofill_agent.h +++ b/chrome/renderer/autofill/autofill_agent.h @@ -13,7 +13,7 @@ #include "base/task.h" #include "chrome/renderer/autofill/form_manager.h" #include "chrome/renderer/page_click_listener.h" -#include "chrome/renderer/render_view_observer.h" +#include "content/renderer/render_view_observer.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutoFillClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" diff --git a/chrome/renderer/autofill/password_autofill_manager.cc b/chrome/renderer/autofill/password_autofill_manager.cc index 8fd6c86..235e856 100644 --- a/chrome/renderer/autofill/password_autofill_manager.cc +++ b/chrome/renderer/autofill/password_autofill_manager.cc @@ -7,7 +7,7 @@ #include "base/message_loop.h" #include "base/scoped_ptr.h" #include "chrome/common/autofill_messages.h" -#include "chrome/renderer/render_view.h" +#include "content/renderer/render_view.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" diff --git a/chrome/renderer/autofill/password_autofill_manager.h b/chrome/renderer/autofill/password_autofill_manager.h index 15bad82..a1e9312 100644 --- a/chrome/renderer/autofill/password_autofill_manager.h +++ b/chrome/renderer/autofill/password_autofill_manager.h @@ -11,7 +11,7 @@ #include "base/task.h" #include "chrome/renderer/page_click_listener.h" -#include "chrome/renderer/render_view_observer.h" +#include "content/renderer/render_view_observer.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" #include "webkit/glue/password_form_dom_manager.h" diff --git a/chrome/renderer/blocked_plugin.cc b/chrome/renderer/blocked_plugin.cc index fa2b31a..e3c21f8 100644 --- a/chrome/renderer/blocked_plugin.cc +++ b/chrome/renderer/blocked_plugin.cc @@ -9,7 +9,7 @@ #include "base/values.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/render_messages.h" -#include "chrome/renderer/render_view.h" +#include "content/renderer/render_view.h" #include "grit/generated_resources.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" diff --git a/chrome/renderer/blocked_plugin.h b/chrome/renderer/blocked_plugin.h index eecff79..deda427 100644 --- a/chrome/renderer/blocked_plugin.h +++ b/chrome/renderer/blocked_plugin.h @@ -6,7 +6,7 @@ #define CHROME_RENDERER_BLOCKED_PLUGIN_H_ #pragma once -#include "chrome/renderer/render_view_observer.h" +#include "content/renderer/render_view_observer.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" #include "webkit/glue/cpp_bound_class.h" #include "webkit/plugins/npapi/webview_plugin.h" diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index bfb146e..a821735 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -14,7 +14,7 @@ #include "chrome/renderer/blocked_plugin.h" #include "chrome/renderer/localized_error.h" #include "chrome/renderer/render_thread.h" -#include "chrome/renderer/render_view.h" +#include "content/renderer/render_view.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "grit/renderer_resources.h" diff --git a/chrome/renderer/devtools_agent.cc b/chrome/renderer/devtools_agent.cc index 5934946..6d29061 100644 --- a/chrome/renderer/devtools_agent.cc +++ b/chrome/renderer/devtools_agent.cc @@ -11,7 +11,7 @@ #include "chrome/common/devtools_messages.h" #include "chrome/common/render_messages.h" #include "chrome/renderer/devtools_agent_filter.h" -#include "chrome/renderer/render_view.h" +#include "content/renderer/render_view.h" #include "grit/webkit_chromium_resources.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgent.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h" diff --git a/chrome/renderer/devtools_agent.h b/chrome/renderer/devtools_agent.h index 84507c7..8f268c5 100644 --- a/chrome/renderer/devtools_agent.h +++ b/chrome/renderer/devtools_agent.h @@ -10,7 +10,7 @@ #include <string> #include "base/basictypes.h" -#include "chrome/renderer/render_view_observer.h" +#include "content/renderer/render_view_observer.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgentClient.h" namespace WebKit { diff --git a/chrome/renderer/devtools_agent_filter.cc b/chrome/renderer/devtools_agent_filter.cc index 5f7de8e..4300461 100644 --- a/chrome/renderer/devtools_agent_filter.cc +++ b/chrome/renderer/devtools_agent_filter.cc @@ -8,8 +8,8 @@ #include "chrome/common/devtools_messages.h" #include "chrome/common/render_messages.h" #include "chrome/renderer/devtools_agent.h" -#include "chrome/renderer/render_view.h" #include "content/renderer/plugin_channel_host.h" +#include "content/renderer/render_view.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgent.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" diff --git a/chrome/renderer/devtools_client.cc b/chrome/renderer/devtools_client.cc index 307ed07..4352098 100644 --- a/chrome/renderer/devtools_client.cc +++ b/chrome/renderer/devtools_client.cc @@ -11,7 +11,7 @@ #include "chrome/common/devtools_messages.h" #include "chrome/common/render_messages.h" #include "chrome/renderer/render_thread.h" -#include "chrome/renderer/render_view.h" +#include "content/renderer/render_view.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsFrontend.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" #include "ui/base/ui_base_switches.h" diff --git a/chrome/renderer/devtools_client.h b/chrome/renderer/devtools_client.h index a9eedb6..b15e15e 100644 --- a/chrome/renderer/devtools_client.h +++ b/chrome/renderer/devtools_client.h @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "base/scoped_ptr.h" -#include "chrome/renderer/render_view_observer.h" +#include "content/renderer/render_view_observer.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h" class MessageLoop; diff --git a/chrome/renderer/extensions/bindings_utils.cc b/chrome/renderer/extensions/bindings_utils.cc index 82c313f..b4e8039 100644 --- a/chrome/renderer/extensions/bindings_utils.cc +++ b/chrome/renderer/extensions/bindings_utils.cc @@ -7,7 +7,7 @@ #include "base/lazy_instance.h" #include "base/string_split.h" #include "base/string_util.h" -#include "chrome/renderer/render_view.h" +#include "content/renderer/render_view.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" using WebKit::WebFrame; diff --git a/chrome/renderer/extensions/chrome_app_bindings.cc b/chrome/renderer/extensions/chrome_app_bindings.cc index b183d98..f6a169b 100644 --- a/chrome/renderer/extensions/chrome_app_bindings.cc +++ b/chrome/renderer/extensions/chrome_app_bindings.cc @@ -9,7 +9,7 @@ #include "chrome/common/extensions/extension_set.h" #include "chrome/renderer/extensions/bindings_utils.h" #include "chrome/renderer/render_thread.h" -#include "chrome/renderer/render_view.h" +#include "content/renderer/render_view.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "v8/include/v8.h" diff --git a/chrome/renderer/extensions/event_bindings.cc b/chrome/renderer/extensions/event_bindings.cc index 49f2fea..62787b1 100644 --- a/chrome/renderer/extensions/event_bindings.cc +++ b/chrome/renderer/extensions/event_bindings.cc @@ -14,7 +14,7 @@ #include "chrome/renderer/extensions/extension_process_bindings.h" #include "chrome/renderer/extensions/js_only_v8_extensions.h" #include "chrome/renderer/render_thread.h" -#include "chrome/renderer/render_view.h" +#include "content/renderer/render_view.h" #include "googleurl/src/gurl.h" #include "grit/renderer_resources.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc index dc2484f..1a1d7e5 100644 --- a/chrome/renderer/extensions/extension_process_bindings.cc +++ b/chrome/renderer/extensions/extension_process_bindings.cc @@ -28,8 +28,8 @@ #include "chrome/renderer/extensions/renderer_extension_bindings.h" #include "chrome/renderer/user_script_slave.h" #include "chrome/renderer/render_thread.h" -#include "chrome/renderer/render_view.h" -#include "chrome/renderer/render_view_visitor.h" +#include "content/renderer/render_view.h" +#include "content/renderer/render_view_visitor.h" #include "grit/common_resources.h" #include "grit/renderer_resources.h" #include "third_party/skia/include/core/SkBitmap.h" diff --git a/chrome/renderer/extensions/renderer_extension_bindings.cc b/chrome/renderer/extensions/renderer_extension_bindings.cc index 8b40f85..f8cfe14 100644 --- a/chrome/renderer/extensions/renderer_extension_bindings.cc +++ b/chrome/renderer/extensions/renderer_extension_bindings.cc @@ -16,7 +16,7 @@ #include "chrome/renderer/extensions/bindings_utils.h" #include "chrome/renderer/extensions/event_bindings.h" #include "chrome/renderer/render_thread.h" -#include "chrome/renderer/render_view.h" +#include "content/renderer/render_view.h" #include "grit/renderer_resources.h" using bindings_utils::GetStringResource; diff --git a/chrome/renderer/external_extension.cc b/chrome/renderer/external_extension.cc index a713495..86abf89 100644 --- a/chrome/renderer/external_extension.cc +++ b/chrome/renderer/external_extension.cc @@ -7,7 +7,7 @@ #include "base/command_line.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/render_messages_params.h" -#include "chrome/renderer/render_view.h" +#include "content/renderer/render_view.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "v8/include/v8.h" diff --git a/chrome/renderer/external_popup_menu.cc b/chrome/renderer/external_popup_menu.cc index d3245d4..fd26bbd 100644 --- a/chrome/renderer/external_popup_menu.cc +++ b/chrome/renderer/external_popup_menu.cc @@ -6,7 +6,7 @@ #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" -#include "chrome/renderer/render_view.h" +#include "content/renderer/render_view.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebExternalPopupMenuClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" diff --git a/chrome/renderer/page_click_tracker.cc b/chrome/renderer/page_click_tracker.cc index 2ba1349..5213dbd 100644 --- a/chrome/renderer/page_click_tracker.cc +++ b/chrome/renderer/page_click_tracker.cc @@ -6,7 +6,7 @@ #include "chrome/common/render_messages.h" #include "chrome/renderer/page_click_listener.h" -#include "chrome/renderer/render_view.h" +#include "content/renderer/render_view.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMMouseEvent.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" diff --git a/chrome/renderer/page_click_tracker.h b/chrome/renderer/page_click_tracker.h index c2ae9d9..ac2a80d 100644 --- a/chrome/renderer/page_click_tracker.h +++ b/chrome/renderer/page_click_tracker.h @@ -9,7 +9,7 @@ #include "base/basictypes.h" #include "base/observer_list.h" -#include "chrome/renderer/render_view_observer.h" +#include "content/renderer/render_view_observer.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMEventListener.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc index 17e55d8..834da83 100644 --- a/chrome/renderer/print_web_view_helper.cc +++ b/chrome/renderer/print_web_view_helper.cc @@ -13,7 +13,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" -#include "chrome/renderer/render_view.h" +#include "content/renderer/render_view.h" #include "grit/generated_resources.h" #include "printing/units.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" diff --git a/chrome/renderer/print_web_view_helper.h b/chrome/renderer/print_web_view_helper.h index 24bc593..2f71c2e 100644 --- a/chrome/renderer/print_web_view_helper.h +++ b/chrome/renderer/print_web_view_helper.h @@ -9,7 +9,7 @@ #include "base/scoped_ptr.h" #include "base/shared_memory.h" #include "base/time.h" -#include "chrome/renderer/render_view_observer.h" +#include "content/renderer/render_view_observer.h" #include "printing/native_metafile.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" diff --git a/chrome/renderer/render_process_impl.cc b/chrome/renderer/render_process_impl.cc index aa890fc..6da0ba1 100644 --- a/chrome/renderer/render_process_impl.cc +++ b/chrome/renderer/render_process_impl.cc @@ -27,7 +27,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/render_messages.h" #include "chrome/renderer/render_thread.h" -#include "chrome/renderer/render_view.h" +#include "content/renderer/render_view.h" #include "ipc/ipc_channel.h" #include "ipc/ipc_message_utils.h" #include "media/base/media.h" diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index e321c84..2b6fefa 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -29,7 +29,6 @@ #include "chrome/common/extensions/extension_set.h" #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" -#include "chrome/common/renderer_preferences.h" #include "chrome/common/url_constants.h" #include "chrome/renderer/automation/dom_automation_v8_extension.h" #include "chrome/renderer/devtools_agent_filter.h" @@ -43,8 +42,6 @@ #include "chrome/renderer/loadtimes_extension_bindings.h" #include "chrome/renderer/net/renderer_net_predictor.h" #include "chrome/renderer/render_process_impl.h" -#include "chrome/renderer/render_view.h" -#include "chrome/renderer/render_view_visitor.h" #include "chrome/renderer/renderer_histogram_snapshots.h" #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" #include "chrome/renderer/search_extension.h" @@ -58,6 +55,7 @@ #include "content/common/dom_storage_messages.h" #include "content/common/gpu_messages.h" #include "content/common/plugin_messages.h" +#include "content/common/renderer_preferences.h" #include "content/common/resource_dispatcher.h" #include "content/common/resource_messages.h" #include "content/common/web_database_observer_impl.h" @@ -67,6 +65,8 @@ #include "content/renderer/gpu_video_service_host.h" #include "content/renderer/indexed_db_dispatcher.h" #include "content/renderer/plugin_channel_host.h" +#include "content/renderer/render_view.h" +#include "content/renderer/render_view_visitor.h" #include "content/renderer/renderer_webidbfactory_impl.h" #include "content/renderer/renderer_webkitclient_impl.h" #include "ipc/ipc_channel_handle.h" diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h deleted file mode 100644 index cc7f278..0000000 --- a/chrome/renderer/render_view.h +++ /dev/null @@ -1,12 +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. - -#ifndef CHROME_RENDERER_RENDER_VIEW_H_ -#define CHROME_RENDERER_RENDER_VIEW_H_ -#pragma once - -// TODO(jam): remove me -#include "content/renderer/render_view.h" - -#endif // CHROME_RENDERER_RENDER_VIEW_H_ diff --git a/chrome/renderer/render_view_browsertest.cc b/chrome/renderer/render_view_browsertest.cc deleted file mode 100644 index 0efb6de..0000000 --- a/chrome/renderer/render_view_browsertest.cc +++ /dev/null @@ -1,1241 +0,0 @@ -// Copyright (c) 2010 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/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/common/render_messages_params.h" -#include "chrome/renderer/autofill/autofill_agent.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 "net/base/net_errors.h" -#include "printing/image.h" -#include "printing/native_metafile.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) { - // 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("<input type=\"text\" id=\"elt_text\"></input>"); - - // We should NOT have gotten a form state change notification yet. - EXPECT_FALSE(render_thread_.sink().GetFirstMessageMatching( - ViewHostMsg_UpdateState::ID)); - render_thread_.sink().ClearMessages(); - - // Change the value of the input. We should have gotten an update state - // notification. We need to spin the message loop to catch this update. - ExecuteJavaScript("document.getElementById('elt_text').value = 'foo';"); - ProcessPendingMessages(); - EXPECT_TRUE(render_thread_.sink().GetUniqueMessageMatching( - ViewHostMsg_UpdateState::ID)); -} - -// Test that we get the correct UpdateState message when we go back twice -// quickly without committing. Regression test for http://crbug.com/58082. -TEST_F(RenderViewTest, LastCommittedUpdateState) { - // Load page A. - LoadHTML("<div>Page A</div>"); - - // Load page B, which will trigger an UpdateState message for page A. - LoadHTML("<div>Page B</div>"); - - // Check for a valid UpdateState message for page A. - const IPC::Message* msg_A = render_thread_.sink().GetUniqueMessageMatching( - ViewHostMsg_UpdateState::ID); - ASSERT_TRUE(msg_A); - int page_id_A; - std::string state_A; - ViewHostMsg_UpdateState::Read(msg_A, &page_id_A, &state_A); - EXPECT_EQ(1, page_id_A); - render_thread_.sink().ClearMessages(); - - // Load page C, which will trigger an UpdateState message for page B. - LoadHTML("<div>Page C</div>"); - - // Check for a valid UpdateState for page B. - const IPC::Message* msg_B = render_thread_.sink().GetUniqueMessageMatching( - ViewHostMsg_UpdateState::ID); - ASSERT_TRUE(msg_B); - int page_id_B; - std::string state_B; - ViewHostMsg_UpdateState::Read(msg_B, &page_id_B, &state_B); - EXPECT_EQ(2, page_id_B); - EXPECT_NE(state_A, state_B); - render_thread_.sink().ClearMessages(); - - // Load page D, which will trigger an UpdateState message for page C. - LoadHTML("<div>Page D</div>"); - - // Check for a valid UpdateState for page C. - const IPC::Message* msg_C = render_thread_.sink().GetUniqueMessageMatching( - ViewHostMsg_UpdateState::ID); - ASSERT_TRUE(msg_C); - int page_id_C; - std::string state_C; - ViewHostMsg_UpdateState::Read(msg_C, &page_id_C, &state_C); - EXPECT_EQ(3, page_id_C); - EXPECT_NE(state_B, state_C); - render_thread_.sink().ClearMessages(); - - // Go back to C and commit, preparing for our real test. - ViewMsg_Navigate_Params params_C; - params_C.transition = PageTransition::FORWARD_BACK; - params_C.page_id = 3; - params_C.state = state_C; - view_->OnNavigate(params_C); - ProcessPendingMessages(); - render_thread_.sink().ClearMessages(); - - // Go back twice quickly, such that page B does not have a chance to commit. - // This leads to two changes to the back/forward list but only one change to - // the RenderView's page ID. - - // Back to page B (page_id 2), without committing. - ViewMsg_Navigate_Params params_B; - params_B.transition = PageTransition::FORWARD_BACK; - params_B.page_id = 2; - params_B.state = state_B; - view_->OnNavigate(params_B); - - // Back to page A (page_id 1) and commit. - ViewMsg_Navigate_Params params; - params.transition = PageTransition::FORWARD_BACK; - params.page_id = 1; - params.state = state_A; - view_->OnNavigate(params); - ProcessPendingMessages(); - - // Now ensure that the UpdateState message we receive is consistent - // and represents page C in both page_id and state. - const IPC::Message* msg = render_thread_.sink().GetUniqueMessageMatching( - ViewHostMsg_UpdateState::ID); - ASSERT_TRUE(msg); - int page_id; - std::string state; - ViewHostMsg_UpdateState::Read(msg, &page_id, &state); - EXPECT_EQ(page_id_C, page_id); - EXPECT_NE(state_A, state); - EXPECT_NE(state_B, state); - EXPECT_EQ(state_C, state); -} - -// Test that our IME backend sends a notification message when the input focus -// changes. -TEST_F(RenderViewTest, OnImeStateChanged) { - // Enable our IME backend code. - view_->OnSetInputMethodActive(true); - - // Load an HTML page consisting of two input fields. - view_->set_send_content_state_immediately(true); - LoadHTML("<html>" - "<head>" - "</head>" - "<body>" - "<input id=\"test1\" type=\"text\"></input>" - "<input id=\"test2\" type=\"password\"></input>" - "</body>" - "</html>"); - render_thread_.sink().ClearMessages(); - - const int kRepeatCount = 10; - for (int i = 0; i < kRepeatCount; i++) { - // Move the input focus to the first <input> element, where we should - // activate IMEs. - ExecuteJavaScript("document.getElementById('test1').focus();"); - ProcessPendingMessages(); - render_thread_.sink().ClearMessages(); - - // Update the IME status and verify if our IME backend sends an IPC message - // to activate IMEs. - view_->UpdateInputMethod(); - const IPC::Message* msg = render_thread_.sink().GetMessageAt(0); - EXPECT_TRUE(msg != NULL); - EXPECT_EQ(ViewHostMsg_ImeUpdateTextInputState::ID, msg->type()); - ViewHostMsg_ImeUpdateTextInputState::Param params; - ViewHostMsg_ImeUpdateTextInputState::Read(msg, ¶ms); - EXPECT_EQ(params.a, WebKit::WebTextInputTypeText); - EXPECT_TRUE(params.b.x() > 0 && params.b.y() > 0); - - // Move the input focus to the second <input> element, where we should - // de-activate IMEs. - ExecuteJavaScript("document.getElementById('test2').focus();"); - ProcessPendingMessages(); - render_thread_.sink().ClearMessages(); - - // Update the IME status and verify if our IME backend sends an IPC message - // to de-activate IMEs. - view_->UpdateInputMethod(); - msg = render_thread_.sink().GetMessageAt(0); - EXPECT_TRUE(msg != NULL); - EXPECT_EQ(ViewHostMsg_ImeUpdateTextInputState::ID, msg->type()); - ViewHostMsg_ImeUpdateTextInputState::Read(msg, ¶ms); - EXPECT_EQ(params.a, WebKit::WebTextInputTypePassword); - } -} - -// Test that our IME backend can compose CJK words. -// Our IME front-end sends many platform-independent messages to the IME backend -// while it composes CJK words. This test sends the minimal messages captured -// on my local environment directly to the IME backend to verify if the backend -// can compose CJK words without any problems. -// This test uses an array of command sets because an IME composotion does not -// only depends on IME events, but also depends on window events, e.g. moving -// the window focus while composing a CJK text. To handle such complicated -// cases, this test should not only call IME-related functions in the -// RenderWidget class, but also call some RenderWidget members, e.g. -// ExecuteJavaScript(), RenderWidget::OnSetFocus(), etc. -TEST_F(RenderViewTest, ImeComposition) { - enum ImeCommand { - IME_INITIALIZE, - IME_SETINPUTMODE, - IME_SETFOCUS, - IME_SETCOMPOSITION, - IME_CONFIRMCOMPOSITION, - IME_CANCELCOMPOSITION - }; - struct ImeMessage { - ImeCommand command; - bool enable; - int selection_start; - int selection_end; - const wchar_t* ime_string; - const wchar_t* result; - }; - static const ImeMessage kImeMessages[] = { - // Scenario 1: input a Chinese word with Microsoft IME (on Vista). - {IME_INITIALIZE, true, 0, 0, NULL, NULL}, - {IME_SETINPUTMODE, true, 0, 0, NULL, NULL}, - {IME_SETFOCUS, true, 0, 0, NULL, NULL}, - {IME_SETCOMPOSITION, false, 1, 1, L"n", L"n"}, - {IME_SETCOMPOSITION, false, 2, 2, L"ni", L"ni"}, - {IME_SETCOMPOSITION, false, 3, 3, L"nih", L"nih"}, - {IME_SETCOMPOSITION, false, 4, 4, L"niha", L"niha"}, - {IME_SETCOMPOSITION, false, 5, 5, L"nihao", L"nihao"}, - {IME_CONFIRMCOMPOSITION, false, -1, -1, L"\x4F60\x597D", L"\x4F60\x597D"}, - // Scenario 2: input a Japanese word with Microsoft IME (on Vista). - {IME_INITIALIZE, true, 0, 0, NULL, NULL}, - {IME_SETINPUTMODE, true, 0, 0, NULL, NULL}, - {IME_SETFOCUS, true, 0, 0, NULL, NULL}, - {IME_SETCOMPOSITION, false, 0, 1, L"\xFF4B", L"\xFF4B"}, - {IME_SETCOMPOSITION, false, 0, 1, L"\x304B", L"\x304B"}, - {IME_SETCOMPOSITION, false, 0, 2, L"\x304B\xFF4E", L"\x304B\xFF4E"}, - {IME_SETCOMPOSITION, false, 0, 3, L"\x304B\x3093\xFF4A", - L"\x304B\x3093\xFF4A"}, - {IME_SETCOMPOSITION, false, 0, 3, L"\x304B\x3093\x3058", - L"\x304B\x3093\x3058"}, - {IME_SETCOMPOSITION, false, 0, 2, L"\x611F\x3058", L"\x611F\x3058"}, - {IME_SETCOMPOSITION, false, 0, 2, L"\x6F22\x5B57", L"\x6F22\x5B57"}, - {IME_CONFIRMCOMPOSITION, false, -1, -1, L"", L"\x6F22\x5B57"}, - {IME_CANCELCOMPOSITION, false, -1, -1, L"", L"\x6F22\x5B57"}, - // Scenario 3: input a Korean word with Microsot IME (on Vista). - {IME_INITIALIZE, true, 0, 0, NULL, NULL}, - {IME_SETINPUTMODE, true, 0, 0, NULL, NULL}, - {IME_SETFOCUS, true, 0, 0, NULL, NULL}, - {IME_SETCOMPOSITION, false, 0, 1, L"\x3147", L"\x3147"}, - {IME_SETCOMPOSITION, false, 0, 1, L"\xC544", L"\xC544"}, - {IME_SETCOMPOSITION, false, 0, 1, L"\xC548", L"\xC548"}, - {IME_CONFIRMCOMPOSITION, false, -1, -1, L"", L"\xC548"}, - {IME_SETCOMPOSITION, false, 0, 1, L"\x3134", L"\xC548\x3134"}, - {IME_SETCOMPOSITION, false, 0, 1, L"\xB140", L"\xC548\xB140"}, - {IME_SETCOMPOSITION, false, 0, 1, L"\xB155", L"\xC548\xB155"}, - {IME_CANCELCOMPOSITION, false, -1, -1, L"", L"\xC548"}, - {IME_SETCOMPOSITION, false, 0, 1, L"\xB155", L"\xC548\xB155"}, - {IME_CONFIRMCOMPOSITION, false, -1, -1, L"", L"\xC548\xB155"}, - }; - - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kImeMessages); i++) { - const ImeMessage* ime_message = &kImeMessages[i]; - switch (ime_message->command) { - case IME_INITIALIZE: - // Load an HTML page consisting of a content-editable <div> element, - // and move the input focus to the <div> element, where we can use - // IMEs. - view_->OnSetInputMethodActive(ime_message->enable); - view_->set_send_content_state_immediately(true); - LoadHTML("<html>" - "<head>" - "</head>" - "<body>" - "<div id=\"test1\" contenteditable=\"true\"></div>" - "</body>" - "</html>"); - ExecuteJavaScript("document.getElementById('test1').focus();"); - break; - - case IME_SETINPUTMODE: - // Activate (or deactivate) our IME back-end. - view_->OnSetInputMethodActive(ime_message->enable); - break; - - case IME_SETFOCUS: - // Update the window focus. - view_->OnSetFocus(ime_message->enable); - break; - - case IME_SETCOMPOSITION: - view_->OnImeSetComposition( - WideToUTF16Hack(ime_message->ime_string), - std::vector<WebKit::WebCompositionUnderline>(), - ime_message->selection_start, - ime_message->selection_end); - break; - - case IME_CONFIRMCOMPOSITION: - view_->OnImeConfirmComposition( - WideToUTF16Hack(ime_message->ime_string)); - break; - - case IME_CANCELCOMPOSITION: - view_->OnImeSetComposition(string16(), - std::vector<WebKit::WebCompositionUnderline>(), - 0, 0); - break; - } - - // Update the status of our IME back-end. - // TODO(hbono): we should verify messages to be sent from the back-end. - view_->UpdateInputMethod(); - ProcessPendingMessages(); - render_thread_.sink().ClearMessages(); - - if (ime_message->result) { - // Retrieve the content of this page and compare it with the expected - // result. - const int kMaxOutputCharacters = 128; - std::wstring output = UTF16ToWideHack( - GetMainFrame()->contentAsText(kMaxOutputCharacters)); - EXPECT_EQ(output, ime_message->result); - } - } -} - -// Test that the RenderView::OnSetTextDirection() function can change the text -// direction of the selected input element. -TEST_F(RenderViewTest, OnSetTextDirection) { - // Load an HTML page consisting of a <textarea> element and a <div> element. - // This test changes the text direction of the <textarea> element, and - // writes the values of its 'dir' attribute and its 'direction' property to - // verify that the text direction is changed. - view_->set_send_content_state_immediately(true); - LoadHTML("<html>" - "<head>" - "</head>" - "<body>" - "<textarea id=\"test\"></textarea>" - "<div id=\"result\" contenteditable=\"true\"></div>" - "</body>" - "</html>"); - render_thread_.sink().ClearMessages(); - - static const struct { - WebTextDirection direction; - const wchar_t* expected_result; - } kTextDirection[] = { - { WebKit::WebTextDirectionRightToLeft, L"\x000A" L"rtl,rtl" }, - { WebKit::WebTextDirectionLeftToRight, L"\x000A" L"ltr,ltr" }, - }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTextDirection); ++i) { - // Set the text direction of the <textarea> element. - ExecuteJavaScript("document.getElementById('test').focus();"); - view_->OnSetTextDirection(kTextDirection[i].direction); - - // Write the values of its DOM 'dir' attribute and its CSS 'direction' - // property to the <div> element. - ExecuteJavaScript("var result = document.getElementById('result');" - "var node = document.getElementById('test');" - "var style = getComputedStyle(node, null);" - "result.innerText =" - " node.getAttribute('dir') + ',' +" - " style.getPropertyValue('direction');"); - - // Copy the document content to std::wstring and compare with the - // expected result. - const int kMaxOutputCharacters = 16; - std::wstring output = UTF16ToWideHack( - GetMainFrame()->contentAsText(kMaxOutputCharacters)); - EXPECT_EQ(output, kTextDirection[i].expected_result); - } -} - -// 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>"); - view_->print_helper_->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. - view_->print_helper_->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. - view_->print_helper_->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); - view_->print_helper_->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) { -#if defined(OS_WIN) || defined(OS_LINUX) - // Load an HTML page consisting of one <input> element and three - // contentediable <div> elements. - // The <input> element is used for sending keyboard events, and the <div> - // elements are used for writing DOM events in the following format: - // "<keyCode>,<shiftKey>,<controlKey>,<altKey>". - // TODO(hbono): <http://crbug.com/2215> Our WebKit port set |ev.metaKey| to - // true when pressing an alt key, i.e. the |ev.metaKey| value is not - // trustworthy. We will check the |ev.metaKey| value when this issue is fixed. - view_->set_send_content_state_immediately(true); - LoadHTML("<html>" - "<head>" - "<title></title>" - "<script type='text/javascript' language='javascript'>" - "function OnKeyEvent(ev) {" - " var result = document.getElementById(ev.type);" - " result.innerText =" - " (ev.which || ev.keyCode) + ',' +" - " ev.shiftKey + ',' +" - " ev.ctrlKey + ',' +" - " ev.altKey;" - " return true;" - "}" - "</script>" - "</head>" - "<body>" - "<input id='test' type='text'" - " onkeydown='return OnKeyEvent(event);'" - " onkeypress='return OnKeyEvent(event);'" - " onkeyup='return OnKeyEvent(event);'>" - "</input>" - "<div id='keydown' contenteditable='true'>" - "</div>" - "<div id='keypress' contenteditable='true'>" - "</div>" - "<div id='keyup' contenteditable='true'>" - "</div>" - "</body>" - "</html>"); - ExecuteJavaScript("document.getElementById('test').focus();"); - render_thread_.sink().ClearMessages(); - - static const MockKeyboard::Layout kLayouts[] = { -#if defined(OS_WIN) - // Since we ignore the mock keyboard layout on Linux and instead just use - // the screen's keyboard layout, these trivially pass. They are commented - // out to avoid the illusion that they work. - MockKeyboard::LAYOUT_ARABIC, - MockKeyboard::LAYOUT_CANADIAN_FRENCH, - MockKeyboard::LAYOUT_FRENCH, - MockKeyboard::LAYOUT_HEBREW, - MockKeyboard::LAYOUT_RUSSIAN, -#endif - MockKeyboard::LAYOUT_UNITED_STATES, - }; - - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kLayouts); ++i) { - // For each key code, we send three keyboard events. - // * we press only the key; - // * we press the key and a left-shift key, and; - // * we press the key and a right-alt (AltGr) key. - // For each modifiers, we need a string used for formatting its expected - // result. (See the above comment for its format.) - static const struct { - MockKeyboard::Modifiers modifiers; - const char* expected_result; - } kModifierData[] = { - {MockKeyboard::NONE, "false,false,false"}, - {MockKeyboard::LEFT_SHIFT, "true,false,false"}, -#if defined(OS_WIN) - {MockKeyboard::RIGHT_ALT, "false,false,true"}, -#endif - }; - - MockKeyboard::Layout layout = kLayouts[i]; - for (size_t j = 0; j < ARRAYSIZE_UNSAFE(kModifierData); ++j) { - // Virtual key codes used for this test. - static const int kKeyCodes[] = { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', - 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', - 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', - 'W', 'X', 'Y', 'Z', - ui::VKEY_OEM_1, - ui::VKEY_OEM_PLUS, - ui::VKEY_OEM_COMMA, - ui::VKEY_OEM_MINUS, - ui::VKEY_OEM_PERIOD, - ui::VKEY_OEM_2, - ui::VKEY_OEM_3, - ui::VKEY_OEM_4, - ui::VKEY_OEM_5, - ui::VKEY_OEM_6, - ui::VKEY_OEM_7, -#if defined(OS_WIN) - // Not sure how to handle this key on Linux. - ui::VKEY_OEM_8, -#endif - }; - - MockKeyboard::Modifiers modifiers = kModifierData[j].modifiers; - for (size_t k = 0; k < ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { - // Send a keyboard event to the RenderView object. - // We should test a keyboard event only when the given keyboard-layout - // driver is installed in a PC and the driver can assign a Unicode - // charcter for the given tuple (key-code and modifiers). - int key_code = kKeyCodes[k]; - std::wstring char_code; - if (SendKeyEvent(layout, key_code, modifiers, &char_code) < 0) - continue; - - // Create an expected result from the virtual-key code, the character - // code, and the modifier-key status. - // We format a string that emulates a DOM-event string produced hy - // our JavaScript function. (See the above comment for the format.) - static char expected_result[1024]; - expected_result[0] = 0; - base::snprintf(&expected_result[0], - sizeof(expected_result), - "\n" // texts in the <input> element - "%d,%s\n" // texts in the first <div> element - "%d,%s\n" // texts in the second <div> element - "%d,%s", // texts in the third <div> element - key_code, kModifierData[j].expected_result, - static_cast<int>(char_code[0]), - kModifierData[j].expected_result, - key_code, kModifierData[j].expected_result); - - // Retrieve the text in the test page and compare it with the expected - // text created from a virtual-key code, a character code, and the - // modifier-key status. - const int kMaxOutputCharacters = 1024; - std::string output = UTF16ToUTF8( - GetMainFrame()->contentAsText(kMaxOutputCharacters)); - EXPECT_EQ(expected_result, output); - } - } - } -#else - NOTIMPLEMENTED(); -#endif -} - -// Test that our EditorClientImpl class can insert characters when we send -// keyboard events through the RenderWidget::OnHandleInputEvent() function. -// This test is for preventing regressions caused only when we use non-US -// keyboards, such as Issue 10846. -TEST_F(RenderViewTest, InsertCharacters) { -#if defined(OS_WIN) || defined(OS_LINUX) - static const struct { - MockKeyboard::Layout layout; - const wchar_t* expected_result; - } kLayouts[] = { -#if 0 - // Disabled these keyboard layouts because buildbots do not have their - // keyboard-layout drivers installed. - {MockKeyboard::LAYOUT_ARABIC, - L"\x0030\x0031\x0032\x0033\x0034\x0035\x0036\x0037" - L"\x0038\x0039\x0634\x0624\x064a\x062b\x0628\x0644" - L"\x0627\x0647\x062a\x0646\x0645\x0629\x0649\x062e" - L"\x062d\x0636\x0642\x0633\x0641\x0639\x0631\x0635" - L"\x0621\x063a\x0626\x0643\x003d\x0648\x002d\x0632" - L"\x0638\x0630\x062c\x005c\x062f\x0637\x0028\x0021" - L"\x0040\x0023\x0024\x0025\x005e\x0026\x002a\x0029" - L"\x0650\x007d\x005d\x064f\x005b\x0623\x00f7\x0640" - L"\x060c\x002f\x2019\x0622\x00d7\x061b\x064e\x064c" - L"\x064d\x2018\x007b\x064b\x0652\x0625\x007e\x003a" - L"\x002b\x002c\x005f\x002e\x061f\x0651\x003c\x007c" - L"\x003e\x0022\x0030\x0031\x0032\x0033\x0034\x0035" - L"\x0036\x0037\x0038\x0039\x0634\x0624\x064a\x062b" - L"\x0628\x0644\x0627\x0647\x062a\x0646\x0645\x0629" - L"\x0649\x062e\x062d\x0636\x0642\x0633\x0641\x0639" - L"\x0631\x0635\x0621\x063a\x0626\x0643\x003d\x0648" - L"\x002d\x0632\x0638\x0630\x062c\x005c\x062f\x0637" - }, - {MockKeyboard::LAYOUT_HEBREW, - L"\x0030\x0031\x0032\x0033\x0034\x0035\x0036\x0037" - L"\x0038\x0039\x05e9\x05e0\x05d1\x05d2\x05e7\x05db" - L"\x05e2\x05d9\x05df\x05d7\x05dc\x05da\x05e6\x05de" - L"\x05dd\x05e4\x002f\x05e8\x05d3\x05d0\x05d5\x05d4" - L"\x0027\x05e1\x05d8\x05d6\x05e3\x003d\x05ea\x002d" - L"\x05e5\x002e\x003b\x005d\x005c\x005b\x002c\x0028" - L"\x0021\x0040\x0023\x0024\x0025\x005e\x0026\x002a" - L"\x0029\x0041\x0042\x0043\x0044\x0045\x0046\x0047" - L"\x0048\x0049\x004a\x004b\x004c\x004d\x004e\x004f" - L"\x0050\x0051\x0052\x0053\x0054\x0055\x0056\x0057" - L"\x0058\x0059\x005a\x003a\x002b\x003e\x005f\x003c" - L"\x003f\x007e\x007d\x007c\x007b\x0022\x0030\x0031" - L"\x0032\x0033\x0034\x0035\x0036\x0037\x0038\x0039" - L"\x05e9\x05e0\x05d1\x05d2\x05e7\x05db\x05e2\x05d9" - L"\x05df\x05d7\x05dc\x05da\x05e6\x05de\x05dd\x05e4" - L"\x002f\x05e8\x05d3\x05d0\x05d5\x05d4\x0027\x05e1" - L"\x05d8\x05d6\x05e3\x003d\x05ea\x002d\x05e5\x002e" - L"\x003b\x005d\x005c\x005b\x002c" - }, -#endif -#if defined(OS_WIN) - // On Linux, the only way to test alternate keyboard layouts is to change - // the keyboard layout of the whole screen. I'm worried about the side - // effects this may have on the buildbots. - {MockKeyboard::LAYOUT_CANADIAN_FRENCH, - L"\x0030\x0031\x0032\x0033\x0034\x0035\x0036\x0037" - L"\x0038\x0039\x0061\x0062\x0063\x0064\x0065\x0066" - L"\x0067\x0068\x0069\x006a\x006b\x006c\x006d\x006e" - L"\x006f\x0070\x0071\x0072\x0073\x0074\x0075\x0076" - L"\x0077\x0078\x0079\x007a\x003b\x003d\x002c\x002d" - L"\x002e\x00e9\x003c\x0029\x0021\x0022\x002f\x0024" - L"\x0025\x003f\x0026\x002a\x0028\x0041\x0042\x0043" - L"\x0044\x0045\x0046\x0047\x0048\x0049\x004a\x004b" - L"\x004c\x004d\x004e\x004f\x0050\x0051\x0052\x0053" - L"\x0054\x0055\x0056\x0057\x0058\x0059\x005a\x003a" - L"\x002b\x0027\x005f\x002e\x00c9\x003e\x0030\x0031" - L"\x0032\x0033\x0034\x0035\x0036\x0037\x0038\x0039" - L"\x0061\x0062\x0063\x0064\x0065\x0066\x0067\x0068" - L"\x0069\x006a\x006b\x006c\x006d\x006e\x006f\x0070" - L"\x0071\x0072\x0073\x0074\x0075\x0076\x0077\x0078" - L"\x0079\x007a\x003b\x003d\x002c\x002d\x002e\x00e9" - L"\x003c" - }, - {MockKeyboard::LAYOUT_FRENCH, - L"\x00e0\x0026\x00e9\x0022\x0027\x0028\x002d\x00e8" - L"\x005f\x00e7\x0061\x0062\x0063\x0064\x0065\x0066" - L"\x0067\x0068\x0069\x006a\x006b\x006c\x006d\x006e" - L"\x006f\x0070\x0071\x0072\x0073\x0074\x0075\x0076" - L"\x0077\x0078\x0079\x007a\x0024\x003d\x002c\x003b" - L"\x003a\x00f9\x0029\x002a\x0021\x0030\x0031\x0032" - L"\x0033\x0034\x0035\x0036\x0037\x0038\x0039\x0041" - L"\x0042\x0043\x0044\x0045\x0046\x0047\x0048\x0049" - L"\x004a\x004b\x004c\x004d\x004e\x004f\x0050\x0051" - L"\x0052\x0053\x0054\x0055\x0056\x0057\x0058\x0059" - L"\x005a\x00a3\x002b\x003f\x002e\x002f\x0025\x00b0" - L"\x00b5\x00e0\x0026\x00e9\x0022\x0027\x0028\x002d" - L"\x00e8\x005f\x00e7\x0061\x0062\x0063\x0064\x0065" - L"\x0066\x0067\x0068\x0069\x006a\x006b\x006c\x006d" - L"\x006e\x006f\x0070\x0071\x0072\x0073\x0074\x0075" - L"\x0076\x0077\x0078\x0079\x007a\x0024\x003d\x002c" - L"\x003b\x003a\x00f9\x0029\x002a\x0021" - }, - {MockKeyboard::LAYOUT_RUSSIAN, - L"\x0030\x0031\x0032\x0033\x0034\x0035\x0036\x0037" - L"\x0038\x0039\x0444\x0438\x0441\x0432\x0443\x0430" - L"\x043f\x0440\x0448\x043e\x043b\x0434\x044c\x0442" - L"\x0449\x0437\x0439\x043a\x044b\x0435\x0433\x043c" - L"\x0446\x0447\x043d\x044f\x0436\x003d\x0431\x002d" - L"\x044e\x002e\x0451\x0445\x005c\x044a\x044d\x0029" - L"\x0021\x0022\x2116\x003b\x0025\x003a\x003f\x002a" - L"\x0028\x0424\x0418\x0421\x0412\x0423\x0410\x041f" - L"\x0420\x0428\x041e\x041b\x0414\x042c\x0422\x0429" - L"\x0417\x0419\x041a\x042b\x0415\x0413\x041c\x0426" - L"\x0427\x041d\x042f\x0416\x002b\x0411\x005f\x042e" - L"\x002c\x0401\x0425\x002f\x042a\x042d\x0030\x0031" - L"\x0032\x0033\x0034\x0035\x0036\x0037\x0038\x0039" - L"\x0444\x0438\x0441\x0432\x0443\x0430\x043f\x0440" - L"\x0448\x043e\x043b\x0434\x044c\x0442\x0449\x0437" - L"\x0439\x043a\x044b\x0435\x0433\x043c\x0446\x0447" - L"\x043d\x044f\x0436\x003d\x0431\x002d\x044e\x002e" - L"\x0451\x0445\x005c\x044a\x044d" - }, -#endif // defined(OS_WIN) - {MockKeyboard::LAYOUT_UNITED_STATES, - L"\x0030\x0031\x0032\x0033\x0034\x0035\x0036\x0037" - L"\x0038\x0039\x0061\x0062\x0063\x0064\x0065\x0066" - L"\x0067\x0068\x0069\x006a\x006b\x006c\x006d\x006e" - L"\x006f\x0070\x0071\x0072\x0073\x0074\x0075\x0076" - L"\x0077\x0078\x0079\x007a\x003b\x003d\x002c\x002d" - L"\x002e\x002f\x0060\x005b\x005c\x005d\x0027\x0029" - L"\x0021\x0040\x0023\x0024\x0025\x005e\x0026\x002a" - L"\x0028\x0041\x0042\x0043\x0044\x0045\x0046\x0047" - L"\x0048\x0049\x004a\x004b\x004c\x004d\x004e\x004f" - L"\x0050\x0051\x0052\x0053\x0054\x0055\x0056\x0057" - L"\x0058\x0059\x005a\x003a\x002b\x003c\x005f\x003e" - L"\x003f\x007e\x007b\x007c\x007d\x0022" -#if defined(OS_WIN) - // This is ifdefed out for Linux to correspond to the fact that we don't - // test alt+keystroke for now. - L"\x0030\x0031\x0032\x0033\x0034\x0035\x0036\x0037" - L"\x0038\x0039\x0061\x0062\x0063\x0064\x0065\x0066" - L"\x0067\x0068\x0069\x006a\x006b\x006c\x006d\x006e" - L"\x006f\x0070\x0071\x0072\x0073\x0074\x0075\x0076" - L"\x0077\x0078\x0079\x007a\x003b\x003d\x002c\x002d" - L"\x002e\x002f\x0060\x005b\x005c\x005d\x0027" -#endif - }, - }; - - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kLayouts); ++i) { - // Load an HTML page consisting of one <div> element. - // This <div> element is used by the EditorClientImpl class to insert - // characters received through the RenderWidget::OnHandleInputEvent() - // function. - view_->set_send_content_state_immediately(true); - LoadHTML("<html>" - "<head>" - "<title></title>" - "</head>" - "<body>" - "<div id='test' contenteditable='true'>" - "</div>" - "</body>" - "</html>"); - ExecuteJavaScript("document.getElementById('test').focus();"); - render_thread_.sink().ClearMessages(); - - // For each key code, we send three keyboard events. - // * Pressing only the key; - // * Pressing the key and a left-shift key, and; - // * Pressing the key and a right-alt (AltGr) key. - static const MockKeyboard::Modifiers kModifiers[] = { - MockKeyboard::NONE, - MockKeyboard::LEFT_SHIFT, -#if defined(OS_WIN) - MockKeyboard::RIGHT_ALT, -#endif - }; - - MockKeyboard::Layout layout = kLayouts[i].layout; - for (size_t j = 0; j < ARRAYSIZE_UNSAFE(kModifiers); ++j) { - // Virtual key codes used for this test. - static const int kKeyCodes[] = { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', - 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', - 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', - 'W', 'X', 'Y', 'Z', - ui::VKEY_OEM_1, - ui::VKEY_OEM_PLUS, - ui::VKEY_OEM_COMMA, - ui::VKEY_OEM_MINUS, - ui::VKEY_OEM_PERIOD, - ui::VKEY_OEM_2, - ui::VKEY_OEM_3, - ui::VKEY_OEM_4, - ui::VKEY_OEM_5, - ui::VKEY_OEM_6, - ui::VKEY_OEM_7, -#if defined(OS_WIN) - // Unclear how to handle this on Linux. - ui::VKEY_OEM_8, -#endif - }; - - MockKeyboard::Modifiers modifiers = kModifiers[j]; - for (size_t k = 0; k < ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { - // Send a keyboard event to the RenderView object. - // We should test a keyboard event only when the given keyboard-layout - // driver is installed in a PC and the driver can assign a Unicode - // charcter for the given tuple (layout, key-code, and modifiers). - int key_code = kKeyCodes[k]; - std::wstring char_code; - if (SendKeyEvent(layout, key_code, modifiers, &char_code) < 0) - continue; - } - } - - // Retrieve the text in the test page and compare it with the expected - // text created from a virtual-key code, a character code, and the - // modifier-key status. - const int kMaxOutputCharacters = 4096; - std::wstring output = UTF16ToWideHack( - GetMainFrame()->contentAsText(kMaxOutputCharacters)); - EXPECT_EQ(kLayouts[i].expected_result, output); - } -#else - NOTIMPLEMENTED(); -#endif -} - -// Crashy, http://crbug.com/53247. -TEST_F(RenderViewTest, DISABLED_DidFailProvisionalLoadWithErrorForError) { - GetMainFrame()->enableViewSourceMode(true); - WebURLError error; - error.domain.fromUTF8("test_domain"); - error.reason = net::ERR_FILE_NOT_FOUND; - error.unreachableURL = GURL("http://foo"); - WebFrame* web_frame = GetMainFrame(); - // An error occurred. - view_->didFailProvisionalLoad(web_frame, error); - // Frame should exit view-source mode. - EXPECT_FALSE(web_frame->isViewSourceModeEnabled()); -} - -TEST_F(RenderViewTest, DidFailProvisionalLoadWithErrorForCancellation) { - GetMainFrame()->enableViewSourceMode(true); - WebURLError error; - error.domain.fromUTF8("test_domain"); - error.reason = net::ERR_ABORTED; - error.unreachableURL = GURL("http://foo"); - WebFrame* web_frame = GetMainFrame(); - // A cancellation occurred. - view_->didFailProvisionalLoad(web_frame, error); - // Frame should stay in view-source mode. - EXPECT_TRUE(web_frame->isViewSourceModeEnabled()); -} - -// Regression test for http://crbug.com/35011 -TEST_F(RenderViewTest, JSBlockSentAfterPageLoad) { - // 1. Load page with JS. - std::string html = "<html>" - "<head>" - "<script>document.createElement('div');</script>" - "</head>" - "<body>" - "</body>" - "</html>"; - render_thread_.sink().ClearMessages(); - LoadHTML(html.c_str()); - - // 2. Block JavaScript. - ContentSettings settings; - for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) - settings.settings[i] = CONTENT_SETTING_ALLOW; - settings.settings[CONTENT_SETTINGS_TYPE_JAVASCRIPT] = CONTENT_SETTING_BLOCK; - view_->SetContentSettings(settings); - - // Make sure no pending messages are in the queue. - ProcessPendingMessages(); - render_thread_.sink().ClearMessages(); - - // 3. Reload page. - ViewMsg_Navigate_Params params; - std::string url_str = "data:text/html;charset=utf-8,"; - url_str.append(html); - GURL url(url_str); - params.url = url; - params.navigation_type = ViewMsg_Navigate_Params::RELOAD; - view_->OnNavigate(params); - ProcessPendingMessages(); - - // 4. Verify that the notification that javascript was blocked is sent after - // the navigation notifiction is sent. - int navigation_index = -1; - int block_index = -1; - for (size_t i = 0; i < render_thread_.sink().message_count(); ++i) { - const IPC::Message* msg = render_thread_.sink().GetMessageAt(i); - if (msg->type() == ViewHostMsg_FrameNavigate::ID) - navigation_index = i; - if (msg->type() == ViewHostMsg_ContentBlocked::ID) - block_index = i; - } - EXPECT_NE(-1, navigation_index); - EXPECT_NE(-1, block_index); - EXPECT_LT(navigation_index, block_index); -} - -// Regression test for http://crbug.com/41562 -TEST_F(RenderViewTest, UpdateTargetURLWithInvalidURL) { - const GURL invalid_gurl("http://"); - 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, ¶ms); - 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, ¶ms2); - 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_PageContents::ID); - ASSERT_NE(static_cast<IPC::Message*>(NULL), message); - ViewHostMsg_PageContents::Param params; - ViewHostMsg_PageContents::Read(message, ¶ms); - EXPECT_TRUE(params.e); // 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_PageContents::ID); - ASSERT_NE(static_cast<IPC::Message*>(NULL), message); - ViewHostMsg_PageContents::Read(message, ¶ms); - EXPECT_FALSE(params.e); // 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_PageContents::ID); - ASSERT_NE(static_cast<IPC::Message*>(NULL), message); - ViewHostMsg_PageContents::Read(message, ¶ms); - EXPECT_FALSE(params.e); // 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_PageContents::ID); - ASSERT_NE(static_cast<IPC::Message*>(NULL), message); - ViewHostMsg_PageContents::Param params; - ViewHostMsg_PageContents::Read(message, ¶ms); - EXPECT_EQ("es", params.d); - 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_PageContents::ID); - ASSERT_NE(static_cast<IPC::Message*>(NULL), message); - ViewHostMsg_PageContents::Read(message, ¶ms); - EXPECT_EQ("fr", params.d); -} diff --git a/chrome/renderer/render_view_browsertest_mac.mm b/chrome/renderer/render_view_browsertest_mac.mm deleted file mode 100644 index 56fe589..0000000 --- a/chrome/renderer/render_view_browsertest_mac.mm +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "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" - -#include <Cocoa/Cocoa.h> -#include <Carbon/Carbon.h> // for the kVK_* constants. - -NSEvent* CmdDeadKeyEvent(NSEventType type, unsigned short code) { - UniChar uniChar = 0; - switch(code) { - case kVK_UpArrow: - uniChar = NSUpArrowFunctionKey; - break; - case kVK_DownArrow: - uniChar = NSDownArrowFunctionKey; - break; - default: - CHECK(false); - } - NSString* s = [NSString stringWithFormat:@"%C", uniChar]; - - return [NSEvent keyEventWithType:type - location:NSMakePoint(0, 0) - modifierFlags:NSCommandKeyMask - timestamp:0.0 - windowNumber:0 - context:nil - characters:s - charactersIgnoringModifiers:s - isARepeat:NO - keyCode:code]; -} - -// Test that cmd-up/down scrolls the page exactly if it is not intercepted by -// javascript. -TEST_F(RenderViewTest, MacTestCmdUp) { - // Some preprocessor trickery so that we can have literal html in our source, - // makes it easier to copy html to and from an html file for testing (the - // preprocessor will remove the newlines at the line ends, turning this into - // a single long line). - #define HTML(s) #s - const char* kRawHtml = HTML( - <html> - <head><title></title> - <script type='text/javascript' language='javascript'> - function OnKeyEvent(ev) { - var result = document.getElementById(ev.type); - result.innerText = (ev.which || ev.keyCode) + ',' + - ev.shiftKey + ',' + - ev.ctrlKey + ',' + - ev.metaKey + ',' + - ev.altKey; - return %s; /* Replace with "return true;" when testing in an html file. */ - } - function OnScroll(ev) { - var result = document.getElementById("scroll"); - result.innerText = window.pageYOffset; - return true; - } - </script> - <style type="text/css"> - p { border-bottom:5000px solid black; } /* enforce vertical scroll bar */ - </style> - </head> - <body - onscroll='return OnScroll(event);' - onkeydown='return OnKeyEvent(event);'> - <div id='keydown' contenteditable='true'> </div> - <div id='scroll' contenteditable='true'> </div> - <p>p1 - <p>p2 - </body> - </html> - ); - #undef HTML - - const int kMaxOutputCharacters = 1024; - string16 output; - char htmlBuffer[2048]; - - NSEvent* arrowDownKeyDown = CmdDeadKeyEvent(NSKeyDown, kVK_DownArrow); - NSEvent* arrowUpKeyDown = CmdDeadKeyEvent(NSKeyDown, kVK_UpArrow); - - // First test when javascript does not eat keypresses -- should scroll. - sprintf(htmlBuffer, kRawHtml, "true"); - view_->set_send_content_state_immediately(true); - LoadHTML(htmlBuffer); - render_thread_.sink().ClearMessages(); - - const char* kArrowDownScrollDown = - "40,false,false,true,false\n1936\np1\n\np2"; - view_->OnSetEditCommandsForNextKeyEvent( - EditCommands(1, EditCommand("moveToEndOfDocument", ""))); - SendNativeKeyEvent(NativeWebKeyboardEvent(arrowDownKeyDown)); - ProcessPendingMessages(); - output = GetMainFrame()->contentAsText(kMaxOutputCharacters); - EXPECT_EQ(kArrowDownScrollDown, UTF16ToASCII(output)); - - const char* kArrowUpScrollUp = - "38,false,false,true,false\n0\np1\n\np2"; - view_->OnSetEditCommandsForNextKeyEvent( - EditCommands(1, EditCommand("moveToBeginningOfDocument", ""))); - SendNativeKeyEvent(NativeWebKeyboardEvent(arrowUpKeyDown)); - ProcessPendingMessages(); - output = GetMainFrame()->contentAsText(kMaxOutputCharacters); - EXPECT_EQ(kArrowUpScrollUp, UTF16ToASCII(output)); - - - // Now let javascript eat the key events -- no scrolling should happen - sprintf(htmlBuffer, kRawHtml, "false"); - view_->set_send_content_state_immediately(true); - LoadHTML(htmlBuffer); - render_thread_.sink().ClearMessages(); - - const char* kArrowDownNoScroll = - "40,false,false,true,false\np1\n\np2"; - view_->OnSetEditCommandsForNextKeyEvent( - EditCommands(1, EditCommand("moveToEndOfDocument", ""))); - SendNativeKeyEvent(NativeWebKeyboardEvent(arrowDownKeyDown)); - ProcessPendingMessages(); - output = GetMainFrame()->contentAsText(kMaxOutputCharacters); - EXPECT_EQ(kArrowDownNoScroll, UTF16ToASCII(output)); - - const char* kArrowUpNoScroll = - "38,false,false,true,false\np1\n\np2"; - view_->OnSetEditCommandsForNextKeyEvent( - EditCommands(1, EditCommand("moveToBeginningOfDocument", ""))); - SendNativeKeyEvent(NativeWebKeyboardEvent(arrowUpKeyDown)); - ProcessPendingMessages(); - output = GetMainFrame()->contentAsText(kMaxOutputCharacters); - EXPECT_EQ(kArrowUpNoScroll, UTF16ToASCII(output)); -} - diff --git a/chrome/renderer/render_view_linux.cc b/chrome/renderer/render_view_linux.cc deleted file mode 100644 index fc9e955..0000000 --- a/chrome/renderer/render_view_linux.cc +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/renderer/render_view.h" - -#include "chrome/common/renderer_preferences.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebFontRendering.h" - -using WebKit::WebFontRendering; - -static SkPaint::Hinting RendererPreferencesToSkiaHinting( - const RendererPreferences& prefs) { - if (!prefs.should_antialias_text) { - // When anti-aliasing is off, GTK maps all non-zero hinting settings to - // 'Normal' hinting so we do the same. Otherwise, folks who have 'Slight' - // hinting selected will see readable text in everything expect Chromium. - switch (prefs.hinting) { - case RENDERER_PREFERENCES_HINTING_NONE: - return SkPaint::kNo_Hinting; - case RENDERER_PREFERENCES_HINTING_SYSTEM_DEFAULT: - case RENDERER_PREFERENCES_HINTING_SLIGHT: - case RENDERER_PREFERENCES_HINTING_MEDIUM: - case RENDERER_PREFERENCES_HINTING_FULL: - return SkPaint::kNormal_Hinting; - default: - NOTREACHED(); - return SkPaint::kNormal_Hinting; - } - } - - switch (prefs.hinting) { - case RENDERER_PREFERENCES_HINTING_SYSTEM_DEFAULT: - return SkPaint::kNormal_Hinting; - case RENDERER_PREFERENCES_HINTING_NONE: - return SkPaint::kNo_Hinting; - case RENDERER_PREFERENCES_HINTING_SLIGHT: - return SkPaint::kSlight_Hinting; - case RENDERER_PREFERENCES_HINTING_MEDIUM: - return SkPaint::kNormal_Hinting; - case RENDERER_PREFERENCES_HINTING_FULL: - return SkPaint::kFull_Hinting; - default: - NOTREACHED(); - return SkPaint::kNormal_Hinting; - } -} - -static SkFontHost::LCDOrder RendererPreferencesToSkiaLCDOrder( - RendererPreferencesSubpixelRenderingEnum subpixel) { - switch (subpixel) { - case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT: - case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_NONE: - case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_RGB: - case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VRGB: - return SkFontHost::kRGB_LCDOrder; - case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_BGR: - case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VBGR: - return SkFontHost::kBGR_LCDOrder; - default: - NOTREACHED(); - return SkFontHost::kRGB_LCDOrder; - } -} - -static SkFontHost::LCDOrientation - RendererPreferencesToSkiaLCDOrientation( - RendererPreferencesSubpixelRenderingEnum subpixel) { - switch (subpixel) { - case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT: - case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_NONE: - case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_RGB: - case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_BGR: - return SkFontHost::kHorizontal_LCDOrientation; - case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VRGB: - case RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VBGR: - return SkFontHost::kVertical_LCDOrientation; - default: - NOTREACHED(); - return SkFontHost::kHorizontal_LCDOrientation; - } -} - -static bool RendererPreferencesToAntiAliasFlag( - const RendererPreferences& prefs) { - return prefs.should_antialias_text; -} - -static bool RendererPreferencesToSubpixelGlyphsFlag( - const RendererPreferences& prefs) { - if (prefs.subpixel_rendering != - RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT && - prefs.subpixel_rendering != - RENDERER_PREFERENCES_SUBPIXEL_RENDERING_NONE) { - return true; - } - - return false; -} - -void RenderView::UpdateFontRenderingFromRendererPrefs() { - const RendererPreferences& prefs = renderer_preferences_; - WebFontRendering::setHinting( - RendererPreferencesToSkiaHinting(prefs)); - WebFontRendering::setLCDOrder( - RendererPreferencesToSkiaLCDOrder(prefs.subpixel_rendering)); - WebFontRendering::setLCDOrientation( - RendererPreferencesToSkiaLCDOrientation(prefs.subpixel_rendering)); - WebFontRendering::setAntiAlias(RendererPreferencesToAntiAliasFlag(prefs)); - WebFontRendering::setSubpixelGlyphs( - RendererPreferencesToSubpixelGlyphsFlag(prefs)); -} diff --git a/chrome/renderer/render_view_observer.cc b/chrome/renderer/render_view_observer.cc deleted file mode 100644 index 9c9a4a8..0000000 --- a/chrome/renderer/render_view_observer.cc +++ /dev/null @@ -1,36 +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 "chrome/renderer/render_view_observer.h" - -#include "chrome/renderer/render_view.h" - -RenderViewObserver::RenderViewObserver(RenderView* render_view) - : render_view_(render_view), - routing_id_(render_view ? render_view->routing_id() : 0) { - // |render_view| can be NULL on unit testing. - if (render_view_) - render_view_->AddObserver(this); -} - -RenderViewObserver::~RenderViewObserver() { - if (render_view_) - render_view_->RemoveObserver(this); -} - -void RenderViewObserver::OnDestruct() { - delete this; -} - -bool RenderViewObserver::OnMessageReceived(const IPC::Message& message) { - return false; -} - -bool RenderViewObserver::Send(IPC::Message* message) { - if (render_view_) - return render_view_->Send(message); - - delete message; - return false; -} diff --git a/chrome/renderer/render_view_observer.h b/chrome/renderer/render_view_observer.h deleted file mode 100644 index a65ccb9..0000000 --- a/chrome/renderer/render_view_observer.h +++ /dev/null @@ -1,72 +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. - -#ifndef CHROME_RENDERER_RENDER_VIEW_OBSERVER_H_ -#define CHROME_RENDERER_RENDER_VIEW_OBSERVER_H_ -#pragma once - -#include "base/basictypes.h" -#include "ipc/ipc_channel.h" - -class RenderView; - -namespace WebKit { -class WebFrame; -class WebMouseEvent; -struct WebURLError; -} - -// Base class for objects that want to filter incoming IPCs, and also get -// notified of changes to the frame. -class RenderViewObserver : public IPC::Channel::Listener, - public IPC::Message::Sender { - public: - // By default, observers will be deleted when the RenderView goes away. If - // they want to outlive it, they can override this function. - virtual void OnDestruct(); - - // These match the WebKit API notifications. - virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame) {} - virtual void DidFailLoad(WebKit::WebFrame* frame, - const WebKit::WebURLError& error) {} - virtual void DidFinishLoad(WebKit::WebFrame* frame) {} - virtual void DidStartProvisionalLoad(WebKit::WebFrame* frame) {} - virtual void DidFailProvisionalLoad(WebKit::WebFrame* frame, - const WebKit::WebURLError& error) {} - virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame, - bool is_new_navigation) {} - virtual void FrameDetached(WebKit::WebFrame* frame) {} - virtual void FrameWillClose(WebKit::WebFrame* frame) {} - - // These match the RenderView methods below. - virtual void FrameTranslated(WebKit::WebFrame* frame) {} - virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) {} - virtual void PageCaptured(const string16& page_text) {} - - protected: - RenderViewObserver(RenderView* render_view); - virtual ~RenderViewObserver(); - - // IPC::Channel::Listener implementation. - virtual bool OnMessageReceived(const IPC::Message& message); - - // IPC::Message::Sender implementation. - virtual bool Send(IPC::Message* message); - - RenderView* render_view() { return render_view_; } - int routing_id() { return routing_id_; } - - private: - friend class RenderView; - - void set_render_view(RenderView* rv) { render_view_ = rv; } - - RenderView* render_view_; - // The routing ID of the associated RenderView. - int routing_id_; - - DISALLOW_COPY_AND_ASSIGN(RenderViewObserver); -}; - -#endif // CHROME_RENDERER_RENDER_VIEW_OBSERVER_H_ diff --git a/chrome/renderer/render_view_visitor.h b/chrome/renderer/render_view_visitor.h deleted file mode 100644 index d94ae3b..0000000 --- a/chrome/renderer/render_view_visitor.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_RENDERER_RENDER_VIEW_VISITOR_H_ -#define CHROME_RENDERER_RENDER_VIEW_VISITOR_H_ -#pragma once - -class RenderView; - -class RenderViewVisitor { - public: - // Return true to continue visiting RenderViews or false to stop. - virtual bool Visit(RenderView* render_view) = 0; - - protected: - virtual ~RenderViewVisitor() {} -}; - -#endif // CHROME_RENDERER_RENDER_VIEW_VISITOR_H_ diff --git a/chrome/renderer/safe_browsing/malware_dom_details.cc b/chrome/renderer/safe_browsing/malware_dom_details.cc index 2488766..79624dd 100644 --- a/chrome/renderer/safe_browsing/malware_dom_details.cc +++ b/chrome/renderer/safe_browsing/malware_dom_details.cc @@ -8,7 +8,7 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" -#include "chrome/renderer/render_view.h" +#include "content/renderer/render_view.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" diff --git a/chrome/renderer/safe_browsing/malware_dom_details.h b/chrome/renderer/safe_browsing/malware_dom_details.h index b53a117..b042cba 100644 --- a/chrome/renderer/safe_browsing/malware_dom_details.h +++ b/chrome/renderer/safe_browsing/malware_dom_details.h @@ -16,7 +16,7 @@ #include "base/callback.h" #include "base/scoped_ptr.h" #include "base/task.h" -#include "chrome/renderer/render_view_observer.h" +#include "content/renderer/render_view_observer.h" class GURL; class RenderView; diff --git a/chrome/renderer/safe_browsing/phishing_classifier.cc b/chrome/renderer/safe_browsing/phishing_classifier.cc index 668d231..94f9392 100644 --- a/chrome/renderer/safe_browsing/phishing_classifier.cc +++ b/chrome/renderer/safe_browsing/phishing_classifier.cc @@ -12,13 +12,13 @@ #include "base/sha2.h" #include "base/string_util.h" #include "chrome/common/url_constants.h" -#include "chrome/renderer/render_view.h" #include "chrome/renderer/safe_browsing/feature_extractor_clock.h" #include "chrome/renderer/safe_browsing/features.h" #include "chrome/renderer/safe_browsing/phishing_dom_feature_extractor.h" #include "chrome/renderer/safe_browsing/phishing_term_feature_extractor.h" #include "chrome/renderer/safe_browsing/phishing_url_feature_extractor.h" #include "chrome/renderer/safe_browsing/scorer.h" +#include "content/renderer/render_view.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" diff --git a/chrome/renderer/safe_browsing/phishing_classifier_delegate.cc b/chrome/renderer/safe_browsing/phishing_classifier_delegate.cc index 05997e0..e47e422 100644 --- a/chrome/renderer/safe_browsing/phishing_classifier_delegate.cc +++ b/chrome/renderer/safe_browsing/phishing_classifier_delegate.cc @@ -13,11 +13,11 @@ #include "chrome/common/render_messages.h" #include "chrome/common/safebrowsing_messages.h" #include "chrome/renderer/render_thread.h" -#include "chrome/renderer/render_view.h" #include "chrome/renderer/safe_browsing/feature_extractor_clock.h" #include "chrome/renderer/safe_browsing/phishing_classifier.h" #include "chrome/renderer/safe_browsing/scorer.h" #include "content/renderer/navigation_state.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/WebURL.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" diff --git a/chrome/renderer/safe_browsing/phishing_classifier_delegate.h b/chrome/renderer/safe_browsing/phishing_classifier_delegate.h index 7d2c078..4dc6b2c 100644 --- a/chrome/renderer/safe_browsing/phishing_classifier_delegate.h +++ b/chrome/renderer/safe_browsing/phishing_classifier_delegate.h @@ -10,7 +10,7 @@ #include "base/scoped_ptr.h" #include "base/string16.h" -#include "chrome/renderer/render_view_observer.h" +#include "content/renderer/render_view_observer.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_platform_file.h" diff --git a/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc b/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc index fdcc370..241078e 100644 --- a/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc +++ b/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc @@ -10,11 +10,11 @@ #include "base/scoped_ptr.h" #include "base/utf_string_conversions.h" #include "chrome/common/safebrowsing_messages.h" -#include "chrome/renderer/render_view.h" #include "chrome/renderer/safe_browsing/features.h" #include "chrome/renderer/safe_browsing/phishing_classifier.h" #include "chrome/renderer/safe_browsing/render_view_fake_resources_test.h" #include "chrome/renderer/safe_browsing/scorer.h" +#include "content/renderer/render_view.h" #include "googleurl/src/gurl.h" #include "testing/gmock/include/gmock/gmock.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" diff --git a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc index a5e0ad4..e7f6d32 100644 --- a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc +++ b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc @@ -11,9 +11,9 @@ #include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/time.h" -#include "chrome/renderer/render_view.h" #include "chrome/renderer/safe_browsing/feature_extractor_clock.h" #include "chrome/renderer/safe_browsing/features.h" +#include "content/renderer/render_view.h" #include "net/base/registry_controlled_domain.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" diff --git a/chrome/renderer/safe_browsing/phishing_thumbnailer.cc b/chrome/renderer/safe_browsing/phishing_thumbnailer.cc index de8c70b..d02878e 100644 --- a/chrome/renderer/safe_browsing/phishing_thumbnailer.cc +++ b/chrome/renderer/safe_browsing/phishing_thumbnailer.cc @@ -7,7 +7,7 @@ #include "base/logging.h" #include "base/metrics/histogram.h" #include "base/time.h" -#include "chrome/renderer/render_view.h" +#include "content/renderer/render_view.h" #include "skia/ext/bitmap_platform_device.h" #include "skia/ext/image_operations.h" #include "third_party/skia/include/core/SkBitmap.h" diff --git a/chrome/renderer/safe_browsing/render_view_fake_resources_test.cc b/chrome/renderer/safe_browsing/render_view_fake_resources_test.cc index e689196..504431a 100644 --- a/chrome/renderer/safe_browsing/render_view_fake_resources_test.cc +++ b/chrome/renderer/safe_browsing/render_view_fake_resources_test.cc @@ -13,13 +13,13 @@ #include "chrome/common/render_messages_params.h" #include "chrome/renderer/mock_render_process.h" #include "chrome/renderer/render_thread.h" -#include "chrome/renderer/render_view.h" #include "chrome/renderer/renderer_main_platform_delegate.h" #include "content/common/dom_storage_common.h" #include "content/common/main_function_params.h" #include "content/common/resource_messages.h" #include "content/common/resource_response.h" #include "content/common/sandbox_init_wrapper.h" +#include "content/renderer/render_view.h" #include "googleurl/src/gurl.h" #include "net/base/upload_data.h" #include "net/http/http_response_headers.h" diff --git a/chrome/renderer/safe_browsing/render_view_fake_resources_test.h b/chrome/renderer/safe_browsing/render_view_fake_resources_test.h index 34e964b..6c96a01 100644 --- a/chrome/renderer/safe_browsing/render_view_fake_resources_test.h +++ b/chrome/renderer/safe_browsing/render_view_fake_resources_test.h @@ -47,7 +47,7 @@ #include "base/message_loop.h" #include "base/scoped_ptr.h" -#include "chrome/renderer/render_view_visitor.h" +#include "content/renderer/render_view_visitor.h" #include "ipc/ipc_channel.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/renderer/search_extension.cc b/chrome/renderer/search_extension.cc index 4c9e28f..bdb4c97 100644 --- a/chrome/renderer/search_extension.cc +++ b/chrome/renderer/search_extension.cc @@ -9,8 +9,8 @@ #include "base/command_line.h" #include "chrome/common/render_messages_params.h" -#include "chrome/renderer/render_view.h" #include "chrome/renderer/searchbox.h" +#include "content/renderer/render_view.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "v8/include/v8.h" diff --git a/chrome/renderer/searchbox.cc b/chrome/renderer/searchbox.cc index dd5bf08..1e51208 100644 --- a/chrome/renderer/searchbox.cc +++ b/chrome/renderer/searchbox.cc @@ -5,8 +5,8 @@ #include "chrome/renderer/searchbox.h" #include "chrome/common/render_messages.h" -#include "chrome/renderer/render_view.h" #include "chrome/renderer/searchbox_extension.h" +#include "content/renderer/render_view.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" using WebKit::WebView; diff --git a/chrome/renderer/searchbox.h b/chrome/renderer/searchbox.h index 5903682..959abcc 100644 --- a/chrome/renderer/searchbox.h +++ b/chrome/renderer/searchbox.h @@ -9,8 +9,8 @@ #include <vector> #include "base/string16.h" -#include "chrome/renderer/render_view_observer.h" #include "chrome/common/instant_types.h" +#include "content/renderer/render_view_observer.h" #include "ui/gfx/rect.h" class SearchBox : public RenderViewObserver { diff --git a/chrome/renderer/searchbox_extension.cc b/chrome/renderer/searchbox_extension.cc index d866c49..4fe2552 100644 --- a/chrome/renderer/searchbox_extension.cc +++ b/chrome/renderer/searchbox_extension.cc @@ -11,8 +11,8 @@ #include "base/string_split.h" #include "base/stringprintf.h" #include "chrome/common/render_messages_params.h" -#include "chrome/renderer/render_view.h" #include "chrome/renderer/searchbox.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/WebScriptSource.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" diff --git a/chrome/renderer/spellchecker/spellcheck_provider.h b/chrome/renderer/spellchecker/spellcheck_provider.h index 9496dda..f51b594 100644 --- a/chrome/renderer/spellchecker/spellcheck_provider.h +++ b/chrome/renderer/spellchecker/spellcheck_provider.h @@ -9,7 +9,7 @@ #include <vector> #include "base/id_map.h" -#include "chrome/renderer/render_view_observer.h" +#include "content/renderer/render_view_observer.h" class RenderView; class SpellCheck; diff --git a/chrome/renderer/translate_helper.h b/chrome/renderer/translate_helper.h index 7f42bc7..4636fa1 100644 --- a/chrome/renderer/translate_helper.h +++ b/chrome/renderer/translate_helper.h @@ -10,7 +10,7 @@ #include "base/task.h" #include "chrome/common/translate_errors.h" -#include "chrome/renderer/render_view_observer.h" +#include "content/renderer/render_view_observer.h" class RenderView; namespace WebKit { diff --git a/chrome/renderer/user_script_idle_scheduler.cc b/chrome/renderer/user_script_idle_scheduler.cc index b2989a4..38a81f6 100644 --- a/chrome/renderer/user_script_idle_scheduler.cc +++ b/chrome/renderer/user_script_idle_scheduler.cc @@ -5,7 +5,7 @@ #include "chrome/renderer/user_script_idle_scheduler.h" #include "base/message_loop.h" -#include "chrome/renderer/render_view.h" +#include "content/renderer/render_view.h" namespace { // The length of time to wait after the DOM is complete to try and run user diff --git a/chrome/test/render_view_test.cc b/chrome/test/render_view_test.cc index dfca7ee..af71771 100644 --- a/chrome/test/render_view_test.cc +++ b/chrome/test/render_view_test.cc @@ -8,7 +8,6 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" -#include "chrome/common/renderer_preferences.h" #include "chrome/renderer/autofill/autofill_agent.h" #include "chrome/renderer/autofill/password_autofill_manager.h" #include "chrome/renderer/extensions/event_bindings.h" @@ -19,6 +18,7 @@ #include "chrome/renderer/renderer_main_platform_delegate.h" #include "content/common/dom_storage_common.h" #include "content/common/native_web_keyboard_event.h" +#include "content/common/renderer_preferences.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" diff --git a/chrome/test/render_view_test.h b/chrome/test/render_view_test.h index 296f41f..2bc248c 100644 --- a/chrome/test/render_view_test.h +++ b/chrome/test/render_view_test.h @@ -12,12 +12,12 @@ #include "base/scoped_ptr.h" #include "chrome/renderer/mock_keyboard.h" #include "chrome/renderer/mock_render_thread.h" -#include "chrome/renderer/render_view.h" #include "chrome/renderer/renderer_main_platform_delegate.h" #include "content/common/main_function_params.h" #include "content/common/native_web_keyboard_event.h" #include "content/common/sandbox_init_wrapper.h" #include "content/renderer/content_renderer_client.h" +#include "content/renderer/render_view.h" #include "content/renderer/renderer_webkitclient_impl.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |