summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-01 23:55:55 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-01 23:55:55 +0000
commit2a5b173eacab4d8d10f8830a8416cf358a6da945 (patch)
tree59378066c09bc10b3d543648d1cef5faa2adef4e
parent03fd0b387c8a0d052cc565ec35f65eddcf40f64b (diff)
downloadchromium_src-2a5b173eacab4d8d10f8830a8416cf358a6da945.zip
chromium_src-2a5b173eacab4d8d10f8830a8416cf358a6da945.tar.gz
chromium_src-2a5b173eacab4d8d10f8830a8416cf358a6da945.tar.bz2
Move a few RenderViewObservers to ChromeContentRendererClient so that we can tighten up the DEPS checking a little more.
Review URL: http://codereview.chromium.org/6677114 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80243 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/renderer/autofill/autofill_agent.cc15
-rw-r--r--chrome/renderer/autofill/autofill_agent.h2
-rw-r--r--chrome/renderer/chrome_content_renderer_client.cc36
-rw-r--r--chrome/renderer/devtools_agent.cc10
-rw-r--r--chrome/renderer/devtools_agent.h3
-rw-r--r--chrome/test/render_view_test.cc1
-rw-r--r--chrome/test/render_view_test.h1
-rw-r--r--content/renderer/DEPS7
-rw-r--r--content/renderer/render_view.cc59
-rw-r--r--content/renderer/render_view.h12
-rw-r--r--content/renderer/render_view_browsertest.cc1
-rw-r--r--content/renderer/render_view_observer.h3
12 files changed, 75 insertions, 75 deletions
diff --git a/chrome/renderer/autofill/autofill_agent.cc b/chrome/renderer/autofill/autofill_agent.cc
index 50e6663..e874e52 100644
--- a/chrome/renderer/autofill/autofill_agent.cc
+++ b/chrome/renderer/autofill/autofill_agent.cc
@@ -29,6 +29,7 @@ using WebKit::WebInputElement;
using WebKit::WebKeyboardEvent;
using WebKit::WebNode;
using WebKit::WebString;
+using webkit_glue::FormData;
namespace {
@@ -52,6 +53,7 @@ AutofillAgent::AutofillAgent(
suggestions_clear_index_(-1),
suggestions_options_index_(-1),
ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
+ render_view->webview()->setAutoFillClient(this);
}
AutofillAgent::~AutofillAgent() {}
@@ -81,6 +83,19 @@ void AutofillAgent::FrameWillClose(WebKit::WebFrame* frame) {
form_manager_.ResetFrame(frame);
}
+void AutofillAgent::WillSubmitForm(WebFrame* frame,
+ const WebFormElement& form) {
+ FormData form_data;
+ if (FormManager::WebFormElementToFormData(
+ form,
+ FormManager::REQUIRE_AUTOCOMPLETE,
+ static_cast<FormManager::ExtractMask>(
+ FormManager::EXTRACT_VALUE | FormManager::EXTRACT_OPTION_TEXT),
+ &form_data)) {
+ Send(new AutofillHostMsg_FormSubmitted(routing_id(), form_data));
+ }
+}
+
void AutofillAgent::FrameTranslated(WebKit::WebFrame* frame) {
// The page is translated, so try to extract the form data again.
DidFinishDocumentLoad(frame);
diff --git a/chrome/renderer/autofill/autofill_agent.h b/chrome/renderer/autofill/autofill_agent.h
index 4dff071..c3255fb 100644
--- a/chrome/renderer/autofill/autofill_agent.h
+++ b/chrome/renderer/autofill/autofill_agent.h
@@ -69,6 +69,8 @@ class AutofillAgent : public RenderViewObserver,
virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame);
virtual void FrameDetached(WebKit::WebFrame* frame);
virtual void FrameWillClose(WebKit::WebFrame* frame);
+ virtual void WillSubmitForm(WebKit::WebFrame* frame,
+ const WebKit::WebFormElement& form);
virtual void FrameTranslated(WebKit::WebFrame* frame);
// PageClickListener implementation:
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index 137a319..c62755b 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -15,7 +15,11 @@
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
+#include "chrome/renderer/autofill/autofill_agent.h"
+#include "chrome/renderer/autofill/form_manager.h"
+#include "chrome/renderer/autofill/password_autofill_manager.h"
#include "chrome/renderer/blocked_plugin.h"
+#include "chrome/renderer/devtools_agent.h"
#include "chrome/renderer/extensions/bindings_utils.h"
#include "chrome/renderer/extensions/event_bindings.h"
#include "chrome/renderer/extensions/extension_dispatcher.h"
@@ -24,6 +28,10 @@
#include "chrome/renderer/extensions/extension_resource_request_policy.h"
#include "chrome/renderer/extensions/renderer_extension_bindings.h"
#include "chrome/renderer/localized_error.h"
+#include "chrome/renderer/page_click_tracker.h"
+#include "chrome/renderer/safe_browsing/malware_dom_details.h"
+#include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
+#include "chrome/renderer/translate_helper.h"
#include "content/common/view_messages.h"
#include "content/renderer/render_view.h"
#include "grit/generated_resources.h"
@@ -41,6 +49,9 @@
#include "webkit/plugins/npapi/plugin_list.h"
#include "webkit/plugins/ppapi/plugin_module.h"
+using autofill::AutofillAgent;
+using autofill::FormManager;
+using autofill::PasswordAutofillManager;
using WebKit::WebFrame;
using WebKit::WebPlugin;
using WebKit::WebPluginParams;
@@ -77,6 +88,31 @@ static bool CrossesExtensionExtents(WebFrame* frame, const GURL& new_url) {
namespace chrome {
void ChromeContentRendererClient::RenderViewCreated(RenderView* render_view) {
+ new DevToolsAgent(render_view);
+
+ PasswordAutofillManager* password_autofill_manager =
+ new PasswordAutofillManager(render_view);
+ AutofillAgent* autofill_agent = new AutofillAgent(render_view,
+ password_autofill_manager);
+ PageClickTracker* page_click_tracker = new PageClickTracker(render_view);
+ // Note that the order of insertion of the listeners is important.
+ // The password_autocomplete_manager takes the first shot at processing the
+ // notification and can stop the propagation.
+ page_click_tracker->AddListener(password_autofill_manager);
+ page_click_tracker->AddListener(autofill_agent);
+
+ new TranslateHelper(render_view);
+
+#ifndef OS_CHROMEOS
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableClientSidePhishingDetection)) {
+ new safe_browsing::PhishingClassifierDelegate(render_view, NULL);
+ }
+#endif
+
+ // Observer for Malware DOM details messages.
+ new safe_browsing::MalwareDOMDetails(render_view);
+
new ExtensionHelper(render_view);
}
diff --git a/chrome/renderer/devtools_agent.cc b/chrome/renderer/devtools_agent.cc
index 3928bd6..11b8fd8 100644
--- a/chrome/renderer/devtools_agent.cc
+++ b/chrome/renderer/devtools_agent.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,6 +10,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/devtools_messages.h"
#include "chrome/renderer/devtools_agent_filter.h"
+#include "chrome/renderer/devtools_client.h"
#include "content/common/view_messages.h"
#include "content/renderer/render_view.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgent.h"
@@ -58,6 +59,8 @@ DevToolsAgent::DevToolsAgent(RenderView* render_view)
CommandLine* cmd = CommandLine::ForCurrentProcess();
expose_v8_debugger_protocol_ = cmd->HasSwitch(switches::kRemoteShellPort);
+
+ render_view->webview()->setDevToolsAgentClient(this);
}
DevToolsAgent::~DevToolsAgent() {
@@ -74,6 +77,7 @@ bool DevToolsAgent::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DispatchOnInspectorBackend,
OnDispatchOnInspectorBackend)
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_InspectElement, OnInspectElement)
+ IPC_MESSAGE_HANDLER(DevToolsMsg_SetupDevToolsClient, OnSetupDevToolsClient)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -185,6 +189,10 @@ void DevToolsAgent::OnNavigate() {
}
}
+void DevToolsAgent::OnSetupDevToolsClient() {
+ new DevToolsClient(render_view());
+}
+
WebDevToolsAgent* DevToolsAgent::GetWebAgent() {
WebView* web_view = render_view()->webview();
if (!web_view)
diff --git a/chrome/renderer/devtools_agent.h b/chrome/renderer/devtools_agent.h
index ce455b3..2b46ba3 100644
--- a/chrome/renderer/devtools_agent.h
+++ b/chrome/renderer/devtools_agent.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -62,6 +62,7 @@ class DevToolsAgent : public RenderViewObserver,
void OnInspectElement(int x, int y);
void OnSetApuAgentEnabled(bool enabled);
void OnNavigate();
+ void OnSetupDevToolsClient();
static std::map<int, DevToolsAgent*> agent_for_routing_id_;
diff --git a/chrome/test/render_view_test.cc b/chrome/test/render_view_test.cc
index 774042b0..27b2ef2 100644
--- a/chrome/test/render_view_test.cc
+++ b/chrome/test/render_view_test.cc
@@ -9,7 +9,6 @@
#include "chrome/common/gfx_resource_provider.h"
#include "chrome/common/print_messages.h"
#include "chrome/common/render_messages.h"
-#include "chrome/renderer/autofill/autofill_agent.h"
#include "chrome/renderer/autofill/password_autofill_manager.h"
#include "chrome/renderer/extensions/event_bindings.h"
#include "chrome/renderer/extensions/extension_dispatcher.h"
diff --git a/chrome/test/render_view_test.h b/chrome/test/render_view_test.h
index f71a042..9fb4e2b 100644
--- a/chrome/test/render_view_test.h
+++ b/chrome/test/render_view_test.h
@@ -10,6 +10,7 @@
#include "base/command_line.h"
#include "base/memory/scoped_ptr.h"
+#include "chrome/renderer/autofill/autofill_agent.h"
#include "chrome/renderer/mock_keyboard.h"
#include "chrome/renderer/mock_render_thread.h"
#include "chrome/renderer/renderer_main_platform_delegate.h"
diff --git a/content/renderer/DEPS b/content/renderer/DEPS
index 7c83852..bda91c8 100644
--- a/content/renderer/DEPS
+++ b/content/renderer/DEPS
@@ -1,7 +1,10 @@
include_rules = [
- # The following directories have been refactored, so no new dependencies
- # should be added from these directories.
+ # The following directories have been refactored, so no new dependencies
+ # should be added from these directories.
+ "-chrome/renderer/autofill",
"-chrome/renderer/extensions",
+ "-chrome/renderer/safe_browsing",
"+content/plugin", # For shared npruntime proxying code.
+ "+v8/include",
]
diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc
index 75d8e6d..d0cf681 100644
--- a/content/renderer/render_view.cc
+++ b/content/renderer/render_view.cc
@@ -27,7 +27,6 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/devtools_messages.h"
#include "chrome/common/extensions/extension_messages.h"
#include "chrome/common/json_value_serializer.h"
#include "chrome/common/pepper_plugin_registry.h"
@@ -37,21 +36,13 @@
#include "chrome/common/url_constants.h"
#include "chrome/common/web_apps.h"
#include "chrome/renderer/about_handler.h"
-#include "chrome/renderer/autofill/autofill_agent.h"
-#include "chrome/renderer/autofill/form_manager.h"
-#include "chrome/renderer/autofill/password_autofill_manager.h"
#include "chrome/renderer/automation/dom_automation_controller.h"
-#include "chrome/renderer/devtools_agent.h"
-#include "chrome/renderer/devtools_client.h"
#include "chrome/renderer/external_host_bindings.h"
#include "chrome/renderer/localized_error.h"
-#include "chrome/renderer/page_click_tracker.h"
#include "chrome/renderer/page_load_histograms.h"
#include "chrome/renderer/print_web_view_helper.h"
#include "chrome/renderer/render_process.h"
#include "chrome/renderer/render_thread.h"
-#include "chrome/renderer/safe_browsing/malware_dom_details.h"
-#include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
#include "chrome/renderer/searchbox.h"
#include "chrome/renderer/spellchecker/spellcheck.h"
#include "chrome/renderer/spellchecker/spellcheck_provider.h"
@@ -107,7 +98,6 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObject.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgent.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
@@ -206,7 +196,6 @@ using WebKit::WebContextMenuData;
using WebKit::WebCookieJar;
using WebKit::WebData;
using WebKit::WebDataSource;
-using WebKit::WebDevToolsAgent;
using WebKit::WebDocument;
using WebKit::WebDragData;
using WebKit::WebDragOperation;
@@ -263,13 +252,9 @@ using WebKit::WebWindowFeatures;
using WebKit::WebWorker;
using WebKit::WebWorkerClient;
using appcache::WebApplicationCacheHostImpl;
-using autofill::AutofillAgent;
-using autofill::FormManager;
-using autofill::PasswordAutofillManager;
using base::Time;
using base::TimeDelta;
using webkit_glue::AltErrorPageResourceFetcher;
-using webkit_glue::FormData;
using webkit_glue::FormField;
using webkit_glue::ImageResourceFetcher;
using webkit_glue::PasswordForm;
@@ -511,7 +496,6 @@ RenderView::RenderView(RenderThreadBase* render_thread,
ALLOW_THIS_IN_INITIALIZER_LIST(page_info_method_factory_(this)),
ALLOW_THIS_IN_INITIALIZER_LIST(accessibility_method_factory_(this)),
ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)),
- devtools_client_(NULL),
geolocation_dispatcher_(NULL),
speech_input_dispatcher_(NULL),
device_orientation_dispatcher_(NULL),
@@ -542,15 +526,6 @@ RenderView::RenderView(RenderThreadBase* render_thread,
notification_provider_ = new NotificationProvider(this);
- devtools_agent_ = new DevToolsAgent(this);
- webview()->setDevToolsAgentClient(devtools_agent_);
-
- PasswordAutofillManager* password_autofill_manager =
- new PasswordAutofillManager(this);
- AutofillAgent* autofill_agent = new AutofillAgent(this,
- password_autofill_manager);
- webview()->setAutoFillClient(autofill_agent);
-
g_view_map.Get().insert(std::make_pair(webview(), this));
webkit_preferences_.Apply(webview());
webview()->initializeMainFrame(this);
@@ -585,13 +560,6 @@ RenderView::RenderView(RenderThreadBase* render_thread,
audio_message_filter_ = new AudioMessageFilter(routing_id_);
render_thread_->AddFilter(audio_message_filter_);
- PageClickTracker* page_click_tracker = new PageClickTracker(this);
- // Note that the order of insertion of the listeners is important.
- // The password_autocomplete_manager takes the first shot at processing the
- // notification and can stop the propagation.
- page_click_tracker->AddListener(password_autofill_manager);
- page_click_tracker->AddListener(autofill_agent);
- new TranslateHelper(this);
print_helper_ = new PrintWebViewHelper(this);
searchbox_ = new SearchBox(this);
@@ -605,16 +573,6 @@ RenderView::RenderView(RenderThreadBase* render_thread,
p2p_socket_dispatcher_ = new P2PSocketDispatcher(this);
}
-#ifndef OS_CHROMEOS
- if (!CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableClientSidePhishingDetection)) {
- new safe_browsing::PhishingClassifierDelegate(this, NULL);
- }
-#endif
-
- // Observer for Malware DOM details messages.
- new safe_browsing::MalwareDOMDetails(this);
-
content::GetContentClient()->renderer()->RenderViewCreated(this);
}
@@ -958,7 +916,6 @@ bool RenderView::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding)
IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault,
OnResetPageEncodingToDefault)
- IPC_MESSAGE_HANDLER(DevToolsMsg_SetupDevToolsClient, OnSetupDevToolsClient)
IPC_MESSAGE_HANDLER(ViewMsg_DownloadFavicon, OnDownloadFavicon)
IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest)
IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest)
@@ -1406,11 +1363,6 @@ void RenderView::OnExecuteEditCommand(const std::string& name,
WebString::fromUTF8(name), WebString::fromUTF8(value));
}
-void RenderView::OnSetupDevToolsClient() {
- DCHECK(!devtools_client_);
- devtools_client_ = new DevToolsClient(this);
-}
-
void RenderView::OnUpdateTargetURLAck() {
// Check if there is a targeturl waiting to be sent.
if (target_url_status_ == TARGET_PENDING) {
@@ -2839,15 +2791,8 @@ void RenderView::willSubmitForm(WebFrame* frame, const WebFormElement& form) {
}
}
- FormData form_data;
- if (FormManager::WebFormElementToFormData(
- form,
- FormManager::REQUIRE_AUTOCOMPLETE,
- static_cast<FormManager::ExtractMask>(
- FormManager::EXTRACT_VALUE | FormManager::EXTRACT_OPTION_TEXT),
- &form_data)) {
- Send(new AutofillHostMsg_FormSubmitted(routing_id_, form_data));
- }
+ FOR_EACH_OBSERVER(
+ RenderViewObserver, observers_, WillSubmitForm(frame, form));
}
void RenderView::willPerformClientRedirect(
diff --git a/content/renderer/render_view.h b/content/renderer/render_view.h
index a47b601..c7bbce1 100644
--- a/content/renderer/render_view.h
+++ b/content/renderer/render_view.h
@@ -863,7 +863,6 @@ class RenderView : public RenderWidget,
void OnScrollFocusedEditableNodeIntoView();
void OnSetPageEncoding(const std::string& encoding_name);
void OnSetRendererPrefs(const RendererPreferences& renderer_prefs);
- void OnSetupDevToolsClient();
#if defined(OS_MACOSX)
void OnSetWindowVisibility(bool visible);
#endif
@@ -909,10 +908,6 @@ class RenderView : public RenderWidget,
// Resets the |content_blocked_| array.
void ClearBlockedContentSettings();
- // Creates DevToolsClient and sets up JavaScript bindings for developer tools
- // UI that is going to be hosted by this RenderView.
- void CreateDevToolsClient();
-
// Create a new NPAPI plugin.
WebKit::WebPlugin* CreateNPAPIPlugin(WebKit::WebFrame* frame,
const WebKit::WebPluginParams& params,
@@ -1230,13 +1225,6 @@ class RenderView : public RenderWidget,
// along with the RenderView automatically. This is why we just store weak
// references.
- // Provides access to this renderer from the remote Inspector UI.
- DevToolsAgent* devtools_agent_;
-
- // DevToolsClient for renderer hosting developer tools UI. It's NULL for other
- // render views.
- DevToolsClient* devtools_client_;
-
// Holds a reference to the service which provides desktop notifications.
NotificationProvider* notification_provider_;
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc
index ae23dc4..96cd1d2 100644
--- a/content/renderer/render_view_browsertest.cc
+++ b/content/renderer/render_view_browsertest.cc
@@ -11,7 +11,6 @@
#include "chrome/common/autofill_messages.h"
#include "chrome/common/content_settings.h"
#include "chrome/common/render_messages.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"
diff --git a/content/renderer/render_view_observer.h b/content/renderer/render_view_observer.h
index e8c7375..d503b4e 100644
--- a/content/renderer/render_view_observer.h
+++ b/content/renderer/render_view_observer.h
@@ -14,6 +14,7 @@ class RenderView;
namespace WebKit {
class WebDataSource;
class WebFrame;
+class WebFormElement;
class WebMouseEvent;
struct WebURLError;
}
@@ -40,6 +41,8 @@ class RenderViewObserver : public IPC::Channel::Listener,
virtual void DidCreateDocumentElement(WebKit::WebFrame* frame) {}
virtual void FrameDetached(WebKit::WebFrame* frame) {}
virtual void FrameWillClose(WebKit::WebFrame* frame) {}
+ virtual void WillSubmitForm(WebKit::WebFrame* frame,
+ const WebKit::WebFormElement& form) {}
virtual void DidCreateDataSource(WebKit::WebFrame* frame,
WebKit::WebDataSource* ds) {}