Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: chrome/renderer/render_view.h

Issue 181014: Eliminate remaining WebCore dependencies from webplugin_impl.cc... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/plugin/webplugin_proxy.cc ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_RENDERER_RENDER_VIEW_H_ 5 #ifndef CHROME_RENDERER_RENDER_VIEW_H_
6 #define CHROME_RENDERER_RENDER_VIEW_H_ 6 #define CHROME_RENDERER_RENDER_VIEW_H_
7 7
8 #include <string> 8 #include <string>
9 #include <queue> 9 #include <queue>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/gfx/point.h" 14 #include "base/gfx/point.h"
15 #include "base/gfx/rect.h" 15 #include "base/gfx/rect.h"
16 #include "base/id_map.h" 16 #include "base/id_map.h"
17 #include "base/shared_memory.h" 17 #include "base/shared_memory.h"
18 #include "base/timer.h" 18 #include "base/timer.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #include "base/weak_ptr.h"
20 #include "build/build_config.h" 21 #include "build/build_config.h"
21 #include "chrome/common/renderer_preferences.h" 22 #include "chrome/common/renderer_preferences.h"
22 #include "chrome/common/view_types.h" 23 #include "chrome/common/view_types.h"
23 #include "chrome/renderer/automation/dom_automation_controller.h" 24 #include "chrome/renderer/automation/dom_automation_controller.h"
24 #include "chrome/renderer/dom_ui_bindings.h" 25 #include "chrome/renderer/dom_ui_bindings.h"
25 #include "chrome/renderer/extensions/extension_process_bindings.h" 26 #include "chrome/renderer/extensions/extension_process_bindings.h"
26 #include "chrome/renderer/external_host_bindings.h" 27 #include "chrome/renderer/external_host_bindings.h"
27 #include "chrome/renderer/render_widget.h" 28 #include "chrome/renderer/render_widget.h"
28 #include "third_party/skia/include/core/SkBitmap.h" 29 #include "third_party/skia/include/core/SkBitmap.h"
29 #include "testing/gtest/include/gtest/gtest_prod.h" 30 #include "testing/gtest/include/gtest/gtest_prod.h"
30 #include "webkit/api/public/WebConsoleMessage.h" 31 #include "webkit/api/public/WebConsoleMessage.h"
31 #include "webkit/api/public/WebTextDirection.h" 32 #include "webkit/api/public/WebTextDirection.h"
32 #include "webkit/glue/dom_serializer_delegate.h" 33 #include "webkit/glue/dom_serializer_delegate.h"
33 #include "webkit/glue/form_data.h" 34 #include "webkit/glue/form_data.h"
34 #include "webkit/glue/password_form_dom_manager.h" 35 #include "webkit/glue/password_form_dom_manager.h"
35 #include "webkit/glue/webaccessibilitymanager.h" 36 #include "webkit/glue/webaccessibilitymanager.h"
37 #include "webkit/glue/webplugin_page_delegate.h"
36 #include "webkit/glue/webpreferences.h" 38 #include "webkit/glue/webpreferences.h"
37 #include "webkit/glue/webview_delegate.h" 39 #include "webkit/glue/webview_delegate.h"
38 #include "webkit/glue/webview.h" 40 #include "webkit/glue/webview.h"
39 41
40 #if defined(OS_WIN) 42 #if defined(OS_WIN)
41 // RenderView is a diamond-shaped hierarchy, with WebWidgetClient at the root. 43 // RenderView is a diamond-shaped hierarchy, with WebWidgetClient at the root.
42 // VS warns when we inherit the WebWidgetClient method implementations from 44 // VS warns when we inherit the WebWidgetClient method implementations from
43 // RenderWidget. It's safe to ignore that warning. 45 // RenderWidget. It's safe to ignore that warning.
44 #pragma warning(disable: 4250) 46 #pragma warning(disable: 4250)
45 #endif 47 #endif
46 48
47 class AudioMessageFilter; 49 class AudioMessageFilter;
48 class DictionaryValue; 50 class DictionaryValue;
49 class DevToolsAgent; 51 class DevToolsAgent;
50 class DevToolsClient; 52 class DevToolsClient;
51 class FilePath; 53 class FilePath;
52 class GURL; 54 class GURL;
53 class ListValue; 55 class ListValue;
54 class NavigationState; 56 class NavigationState;
55 class PrintWebViewHelper; 57 class PrintWebViewHelper;
56 class WebPluginDelegate;
57 class WebPluginDelegateProxy; 58 class WebPluginDelegateProxy;
58 class WebDevToolsAgentDelegate; 59 class WebDevToolsAgentDelegate;
59 struct ContextMenuMediaParams; 60 struct ContextMenuMediaParams;
60 struct ThumbnailScore; 61 struct ThumbnailScore;
61 struct ViewMsg_ClosePage_Params; 62 struct ViewMsg_ClosePage_Params;
62 struct ViewMsg_Navigate_Params; 63 struct ViewMsg_Navigate_Params;
63 struct ViewMsg_UploadFile_Params; 64 struct ViewMsg_UploadFile_Params;
64 struct WebDropData; 65 struct WebDropData;
65 66
66 namespace base { 67 namespace base {
(...skipping 24 matching lines...) Expand all
91 // This is a RefCounted holder of an int because I can't say 92 // This is a RefCounted holder of an int because I can't say
92 // scoped_refptr<int>. 93 // scoped_refptr<int>.
93 typedef base::RefCountedData<int> SharedRenderViewCounter; 94 typedef base::RefCountedData<int> SharedRenderViewCounter;
94 95
95 // 96 //
96 // RenderView is an object that manages a WebView object, and provides a 97 // RenderView is an object that manages a WebView object, and provides a
97 // communication interface with an embedding application process 98 // communication interface with an embedding application process
98 // 99 //
99 class RenderView : public RenderWidget, 100 class RenderView : public RenderWidget,
100 public WebViewDelegate, 101 public WebViewDelegate,
101 public webkit_glue::DomSerializerDelegate { 102 public webkit_glue::WebPluginPageDelegate,
103 public webkit_glue::DomSerializerDelegate,
104 public base::SupportsWeakPtr<RenderView> {
102 public: 105 public:
103 struct RenderViewSet { 106 struct RenderViewSet {
104 std::set<RenderView* > render_view_set_; 107 std::set<RenderView*> render_view_set_;
105 }; 108 };
109
106 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the 110 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the
107 // parent of the WebView HWND that will be created. The modal_dialog_event 111 // parent of the WebView HWND that will be created. The modal_dialog_event
108 // is set by the RenderView whenever a modal dialog alert is shown, so that 112 // is set by the RenderView whenever a modal dialog alert is shown, so that
109 // the renderer and plugin processes know to pump window messages. If this 113 // the renderer and plugin processes know to pump window messages. If this
110 // is a constrained popup or as a new tab, opener_id is the routing ID of the 114 // is a constrained popup or as a new tab, opener_id is the routing ID of the
111 // RenderView responsible for creating this RenderView (corresponding to the 115 // RenderView responsible for creating this RenderView (corresponding to the
112 // parent_hwnd). |counter| is either a currently initialized counter, or NULL 116 // parent_hwnd). |counter| is either a currently initialized counter, or NULL
113 // (in which case we treat this RenderView as a top level window). 117 // (in which case we treat this RenderView as a top level window).
114 static RenderView* Create( 118 static RenderView* Create(
115 RenderThreadBase* render_thread, 119 RenderThreadBase* render_thread,
(...skipping 27 matching lines...) Expand all
143 147
144 ViewType::Type view_type() { 148 ViewType::Type view_type() {
145 return view_type_; 149 return view_type_;
146 } 150 }
147 151
148 // IPC::Channel::Listener 152 // IPC::Channel::Listener
149 virtual void OnMessageReceived(const IPC::Message& msg); 153 virtual void OnMessageReceived(const IPC::Message& msg);
150 154
151 // WebViewDelegate 155 // WebViewDelegate
152 virtual bool CanAcceptLoadDrops() const; 156 virtual bool CanAcceptLoadDrops() const;
153 virtual void ShowModalHTMLDialog(const GURL& url, int width, int height,
154 const std::string& json_arguments,
155 std::string* json_retval);
156 virtual void RunJavaScriptAlert(WebKit::WebFrame* webframe, 157 virtual void RunJavaScriptAlert(WebKit::WebFrame* webframe,
157 const std::wstring& message); 158 const std::wstring& message);
158 virtual bool RunJavaScriptConfirm(WebKit::WebFrame* webframe, 159 virtual bool RunJavaScriptConfirm(WebKit::WebFrame* webframe,
159 const std::wstring& message); 160 const std::wstring& message);
160 virtual bool RunJavaScriptPrompt(WebKit::WebFrame* webframe, 161 virtual bool RunJavaScriptPrompt(WebKit::WebFrame* webframe,
161 const std::wstring& message, 162 const std::wstring& message,
162 const std::wstring& default_value, 163 const std::wstring& default_value,
163 std::wstring* result); 164 std::wstring* result);
164 virtual bool RunBeforeUnloadConfirm(WebKit::WebFrame* webframe, 165 virtual bool RunBeforeUnloadConfirm(WebKit::WebFrame* webframe,
165 const std::wstring& message); 166 const std::wstring& message);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 257
257 virtual WebView* CreateWebView(WebView* webview, 258 virtual WebView* CreateWebView(WebView* webview,
258 bool user_gesture, 259 bool user_gesture,
259 const GURL& creator_url); 260 const GURL& creator_url);
260 virtual WebKit::WebWidget* CreatePopupWidget( 261 virtual WebKit::WebWidget* CreatePopupWidget(
261 WebView* webview, 262 WebView* webview,
262 bool activatable); 263 bool activatable);
263 virtual WebKit::WebWidget* CreatePopupWidgetWithInfo( 264 virtual WebKit::WebWidget* CreatePopupWidgetWithInfo(
264 WebView* webview, 265 WebView* webview,
265 const WebKit::WebPopupMenuInfo& info); 266 const WebKit::WebPopupMenuInfo& info);
266 virtual WebPluginDelegate* CreatePluginDelegate( 267 virtual WebKit::WebPlugin* CreatePlugin(
267 WebView* webview, 268 WebKit::WebFrame* frame,
268 const GURL& url, 269 const WebKit::WebPluginParams& params);
269 const std::string& mime_type,
270 const std::string& clsid,
271 std::string* actual_mime_type);
272 virtual WebKit::WebWorker* CreateWebWorker(WebKit::WebWorkerClient* client); 270 virtual WebKit::WebWorker* CreateWebWorker(WebKit::WebWorkerClient* client);
273 virtual WebKit::WebMediaPlayer* CreateWebMediaPlayer( 271 virtual WebKit::WebMediaPlayer* CreateWebMediaPlayer(
274 WebKit::WebMediaPlayerClient* client); 272 WebKit::WebMediaPlayerClient* client);
275 virtual void OnMissingPluginStatus(WebPluginDelegate* delegate, int status); 273 virtual void OnMissingPluginStatus(
274 WebPluginDelegateProxy* delegate,
275 int status);
276 virtual void OpenURL(WebView* webview, const GURL& url, 276 virtual void OpenURL(WebView* webview, const GURL& url,
277 const GURL& referrer, 277 const GURL& referrer,
278 WebKit::WebNavigationPolicy policy); 278 WebKit::WebNavigationPolicy policy);
279 virtual void DidDownloadImage(int id, 279 virtual void DidDownloadImage(int id,
280 const GURL& image_url, 280 const GURL& image_url,
281 bool errored, 281 bool errored,
282 const SkBitmap& image); 282 const SkBitmap& image);
283 283
284 virtual void ShowContextMenu(WebView* webview, 284 virtual void ShowContextMenu(WebView* webview,
285 ContextNodeType node_type, 285 ContextNodeType node_type,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 320
321 virtual void PasteFromSelectionClipboard(); 321 virtual void PasteFromSelectionClipboard();
322 322
323 virtual void ReportFindInPageMatchCount(int count, int request_id, 323 virtual void ReportFindInPageMatchCount(int count, int request_id,
324 bool final_update); 324 bool final_update);
325 virtual void ReportFindInPageSelection(int request_id, 325 virtual void ReportFindInPageSelection(int request_id,
326 int active_match_ordinal, 326 int active_match_ordinal,
327 const WebKit::WebRect& selection); 327 const WebKit::WebRect& selection);
328 virtual bool WasOpenedByUserGesture() const; 328 virtual bool WasOpenedByUserGesture() const;
329 virtual void FocusAccessibilityObject(WebCore::AccessibilityObject* acc_obj); 329 virtual void FocusAccessibilityObject(WebCore::AccessibilityObject* acc_obj);
330 virtual void DidMovePlugin(const WebPluginGeometry& move);
331 virtual void CreatedPluginWindow(gfx::PluginWindowHandle handle);
332 virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle);
333 virtual void SpellCheck(const std::wstring& word, int* misspell_location, 330 virtual void SpellCheck(const std::wstring& word, int* misspell_location,
334 int* misspell_length); 331 int* misspell_length);
335 virtual std::wstring GetAutoCorrectWord(const std::wstring& word); 332 virtual std::wstring GetAutoCorrectWord(const std::wstring& word);
336 virtual void SetInputMethodState(bool enabled); 333 virtual void SetInputMethodState(bool enabled);
337 virtual void ScriptedPrint(WebKit::WebFrame* frame); 334 virtual void ScriptedPrint(WebKit::WebFrame* frame);
338 virtual void UserMetricsRecordAction(const std::wstring& action); 335 virtual void UserMetricsRecordAction(const std::wstring& action);
339 virtual void DnsPrefetch(const std::vector<std::string>& host_names); 336 virtual void DnsPrefetch(const std::vector<std::string>& host_names);
340 337
341 // DomSerializerDelegate
342 virtual void DidSerializeDataForFrame(const GURL& frame_url,
343 const std::string& data, PageSavingSerializationStatus status);
344
345 // WebKit::WebWidgetClient 338 // WebKit::WebWidgetClient
346 // Most methods are handled by RenderWidget. 339 // Most methods are handled by RenderWidget.
347 virtual void show(WebKit::WebNavigationPolicy policy); 340 virtual void show(WebKit::WebNavigationPolicy policy);
348 virtual void closeWidgetSoon(); 341 virtual void closeWidgetSoon();
349 virtual void runModal(); 342 virtual void runModal();
350 343
344 // WebPluginPageDelegate:
345 virtual webkit_glue::WebPluginDelegate* CreatePluginDelegate(
346 const GURL& url,
347 const std::string& mime_type,
348 const std::string& clsid,
349 std::string* actual_mime_type);
350 virtual void CreatedPluginWindow(gfx::PluginWindowHandle handle);
351 virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle);
352 virtual void DidMovePlugin(const webkit_glue::WebPluginGeometry& move);
353 virtual void DidStartLoadingForPlugin();
354 virtual void DidStopLoadingForPlugin();
355 virtual void ShowModalHTMLDialogForPlugin(
356 const GURL& url,
357 const gfx::Size& size,
358 const std::string& json_arguments,
359 std::string* json_retval);
360
361 // DomSerializerDelegate
362 virtual void DidSerializeDataForFrame(const GURL& frame_url,
363 const std::string& data, PageSavingSerializationStatus status);
364
351 // Do not delete directly. This class is reference counted. 365 // Do not delete directly. This class is reference counted.
352 virtual ~RenderView(); 366 virtual ~RenderView();
353 367
354 // Called when a plugin is destroyed. 368 // Called when a plugin is destroyed.
355 void PluginDestroyed(WebPluginDelegateProxy* proxy); 369 //XXX void PluginDestroyed(WebPluginDelegateProxy* proxy);
jam 2009/09/02 17:06:31 nit: remove
356 370
357 // Called when a plugin has crashed. 371 // Called when a plugin has crashed.
358 void PluginCrashed(base::ProcessId pid, const FilePath& plugin_path); 372 void PluginCrashed(base::ProcessId pid, const FilePath& plugin_path);
359 373
360 // Called from JavaScript window.external.AddSearchProvider() to add a 374 // Called from JavaScript window.external.AddSearchProvider() to add a
361 // keyword for a provider described in the given OpenSearch document. 375 // keyword for a provider described in the given OpenSearch document.
362 void AddSearchProvider(const std::string& url); 376 void AddSearchProvider(const std::string& url);
363 377
364 // Asks the browser for the CPBrowsingContext associated with this renderer. 378 // Asks the browser for the CPBrowsingContext associated with this renderer.
365 uint32 GetCPBrowsingContext(); 379 uint32 GetCPBrowsingContext();
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 GURL alternate_error_page_url_; 761 GURL alternate_error_page_url_;
748 762
749 // The pending file upload. 763 // The pending file upload.
750 scoped_ptr<webkit_glue::FileUploadData> pending_upload_data_; 764 scoped_ptr<webkit_glue::FileUploadData> pending_upload_data_;
751 765
752 ScopedRunnableMethodFactory<RenderView> method_factory_; 766 ScopedRunnableMethodFactory<RenderView> method_factory_;
753 767
754 // Timer used to delay the updating of nav state (see SyncNavigationState). 768 // Timer used to delay the updating of nav state (see SyncNavigationState).
755 base::OneShotTimer<RenderView> nav_state_sync_timer_; 769 base::OneShotTimer<RenderView> nav_state_sync_timer_;
756 770
757 typedef std::vector<WebPluginDelegateProxy*> PluginDelegateList;
758 PluginDelegateList plugin_delegates_;
759
760 // Remember the first uninstalled plugin, so that we can ask the plugin 771 // Remember the first uninstalled plugin, so that we can ask the plugin
761 // to install itself when user clicks on the info bar. 772 // to install itself when user clicks on the info bar.
762 WebPluginDelegate* first_default_plugin_; 773 base::WeakPtr<webkit_glue::WebPluginDelegate> first_default_plugin_;
763 774
764 // If the browser hasn't sent us an ACK for the last FindReply we sent 775 // If the browser hasn't sent us an ACK for the last FindReply we sent
765 // to it, then we need to queue up the message (keeping only the most 776 // to it, then we need to queue up the message (keeping only the most
766 // recent message if new ones come in). 777 // recent message if new ones come in).
767 scoped_ptr<IPC::Message> queued_find_reply_message_; 778 scoped_ptr<IPC::Message> queued_find_reply_message_;
768 779
769 // Handle to an event that's set when the page is showing a modal dialog (or 780 // Handle to an event that's set when the page is showing a modal dialog (or
770 // equivalent constrained window). The renderer and any plugin processes 781 // equivalent constrained window). The renderer and any plugin processes
771 // check this to know if they should pump messages/tasks then. 782 // check this to know if they should pump messages/tasks then.
772 scoped_ptr<base::WaitableEvent> modal_dialog_event_; 783 scoped_ptr<base::WaitableEvent> modal_dialog_event_;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 // page id for the last navigation sent to the browser. 878 // page id for the last navigation sent to the browser.
868 int32 last_top_level_navigation_page_id_; 879 int32 last_top_level_navigation_page_id_;
869 880
870 // The settings this render view initialized WebKit with. 881 // The settings this render view initialized WebKit with.
871 WebPreferences webkit_preferences_; 882 WebPreferences webkit_preferences_;
872 883
873 DISALLOW_COPY_AND_ASSIGN(RenderView); 884 DISALLOW_COPY_AND_ASSIGN(RenderView);
874 }; 885 };
875 886
876 #endif // CHROME_RENDERER_RENDER_VIEW_H_ 887 #endif // CHROME_RENDERER_RENDER_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/plugin/webplugin_proxy.cc ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698