OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_RENDERER_RENDER_VIEW_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_VIEW_H_ |
6 #define CONTENT_RENDERER_RENDER_VIEW_H_ | 6 #define CONTENT_RENDERER_RENDER_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <map> | 10 #include <map> |
11 #include <queue> | 11 #include <queue> |
12 #include <set> | 12 #include <set> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
18 #include "base/id_map.h" | 18 #include "base/id_map.h" |
19 #include "base/memory/linked_ptr.h" | 19 #include "base/memory/linked_ptr.h" |
20 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
21 #include "base/observer_list.h" | 21 #include "base/observer_list.h" |
22 #include "base/timer.h" | 22 #include "base/timer.h" |
23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
24 #include "content/renderer/render_view_selection.h" | 24 #include "content/renderer/render_view_selection.h" |
25 #include "content/renderer/renderer_webcookiejar_impl.h" | 25 #include "content/renderer/renderer_webcookiejar_impl.h" |
| 26 #include "content/common/content_export.h" |
26 #include "content/common/edit_command.h" | 27 #include "content/common/edit_command.h" |
27 #include "content/common/navigation_gesture.h" | 28 #include "content/common/navigation_gesture.h" |
28 #include "content/common/page_zoom.h" | 29 #include "content/common/page_zoom.h" |
29 #include "content/common/renderer_preferences.h" | 30 #include "content/common/renderer_preferences.h" |
30 #include "content/renderer/pepper_plugin_delegate_impl.h" | 31 #include "content/renderer/pepper_plugin_delegate_impl.h" |
31 #include "content/renderer/render_widget.h" | 32 #include "content/renderer/render_widget.h" |
32 #include "ipc/ipc_platform_file.h" | 33 #include "ipc/ipc_platform_file.h" |
33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityNotif
ication.h" | 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityNotif
ication.h" |
34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" | 35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" |
35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystem.h" | 36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystem.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 int32 opener_id, | 183 int32 opener_id, |
183 const RendererPreferences& renderer_prefs, | 184 const RendererPreferences& renderer_prefs, |
184 const WebPreferences& webkit_prefs, | 185 const WebPreferences& webkit_prefs, |
185 SharedRenderViewCounter* counter, | 186 SharedRenderViewCounter* counter, |
186 int32 routing_id, | 187 int32 routing_id, |
187 int64 session_storage_namespace_id, | 188 int64 session_storage_namespace_id, |
188 const string16& frame_name); | 189 const string16& frame_name); |
189 | 190 |
190 // Visit all RenderViews with a live WebView (i.e., RenderViews that have | 191 // Visit all RenderViews with a live WebView (i.e., RenderViews that have |
191 // been closed but not yet destroyed are excluded). | 192 // been closed but not yet destroyed are excluded). |
192 static void ForEach(RenderViewVisitor* visitor); | 193 CONTENT_EXPORT static void ForEach(RenderViewVisitor* visitor); |
193 | 194 |
194 // Returns the RenderView containing the given WebView. | 195 // Returns the RenderView containing the given WebView. |
195 static RenderView* FromWebView(WebKit::WebView* webview); | 196 CONTENT_EXPORT static RenderView* FromWebView(WebKit::WebView* webview); |
196 | 197 |
197 // Sets the "next page id" counter. | 198 // Sets the "next page id" counter. |
198 static void SetNextPageID(int32 next_page_id); | 199 static void SetNextPageID(int32 next_page_id); |
199 | 200 |
200 // May return NULL when the view is closing. | 201 // May return NULL when the view is closing. |
201 WebKit::WebView* webview() const; | 202 CONTENT_EXPORT WebKit::WebView* webview() const; |
202 | 203 |
203 // Called by a GraphicsContext associated with this view when swapbuffers | 204 // Called by a GraphicsContext associated with this view when swapbuffers |
204 // is posted, completes or is aborted. | 205 // is posted, completes or is aborted. |
205 void OnViewContextSwapBuffersPosted(); | 206 void OnViewContextSwapBuffersPosted(); |
206 void OnViewContextSwapBuffersComplete(); | 207 void OnViewContextSwapBuffersComplete(); |
207 void OnViewContextSwapBuffersAborted(); | 208 void OnViewContextSwapBuffersAborted(); |
208 | 209 |
209 int page_id() const { return page_id_; } | 210 int page_id() const { return page_id_; } |
210 int history_list_offset() const { return history_list_offset_; } | 211 int history_list_offset() const { return history_list_offset_; } |
211 PepperPluginDelegateImpl* pepper_delegate() { return &pepper_delegate_; } | 212 PepperPluginDelegateImpl* pepper_delegate() { return &pepper_delegate_; } |
(...skipping 22 matching lines...) Expand all Loading... |
234 // Current P2PSocketDispatcher. Set to NULL if P2P API is disabled. | 235 // Current P2PSocketDispatcher. Set to NULL if P2P API is disabled. |
235 content::P2PSocketDispatcher* p2p_socket_dispatcher() { | 236 content::P2PSocketDispatcher* p2p_socket_dispatcher() { |
236 return p2p_socket_dispatcher_; | 237 return p2p_socket_dispatcher_; |
237 } | 238 } |
238 | 239 |
239 // Functions to add and remove observers for this object. | 240 // Functions to add and remove observers for this object. |
240 void AddObserver(RenderViewObserver* observer); | 241 void AddObserver(RenderViewObserver* observer); |
241 void RemoveObserver(RenderViewObserver* observer); | 242 void RemoveObserver(RenderViewObserver* observer); |
242 | 243 |
243 // Evaluates a string of JavaScript in a particular frame. | 244 // Evaluates a string of JavaScript in a particular frame. |
244 void EvaluateScript(const string16& frame_xpath, | 245 CONTENT_EXPORT void EvaluateScript(const string16& frame_xpath, |
245 const string16& jscript, | 246 const string16& jscript, |
246 int id, | 247 int id, |
247 bool notify_result); | 248 bool notify_result); |
248 | 249 |
249 // Adds the given file chooser request to the file_chooser_completion_ queue | 250 // Adds the given file chooser request to the file_chooser_completion_ queue |
250 // (see that var for more) and requests the chooser be displayed if there are | 251 // (see that var for more) and requests the chooser be displayed if there are |
251 // no other waiting items in the queue. | 252 // no other waiting items in the queue. |
252 // | 253 // |
253 // Returns true if the chooser was successfully scheduled. False means we | 254 // Returns true if the chooser was successfully scheduled. False means we |
254 // didn't schedule anything. | 255 // didn't schedule anything. |
255 bool ScheduleFileChooser(const ViewHostMsg_RunFileChooser_Params& params, | 256 bool ScheduleFileChooser(const ViewHostMsg_RunFileChooser_Params& params, |
256 WebKit::WebFileChooserCompletion* completion); | 257 WebKit::WebFileChooserCompletion* completion); |
257 | 258 |
258 // Sets whether the renderer should report load progress to the browser. | 259 // Sets whether the renderer should report load progress to the browser. |
259 void SetReportLoadProgressEnabled(bool enabled); | 260 void SetReportLoadProgressEnabled(bool enabled); |
260 | 261 |
261 // Gets the focused node. If no such node exists then the node will be isNull. | 262 // Gets the focused node. If no such node exists then the node will be isNull. |
262 WebKit::WebNode GetFocusedNode() const; | 263 CONTENT_EXPORT WebKit::WebNode GetFocusedNode() const; |
263 | 264 |
264 // Returns true if the parameter node is a textfield, text area or a content | 265 // Returns true if the parameter node is a textfield, text area or a content |
265 // editable div. | 266 // editable div. |
266 bool IsEditableNode(const WebKit::WebNode& node); | 267 CONTENT_EXPORT bool IsEditableNode(const WebKit::WebNode& node); |
267 | 268 |
268 void LoadNavigationErrorPage(WebKit::WebFrame* frame, | 269 CONTENT_EXPORT void LoadNavigationErrorPage( |
269 const WebKit::WebURLRequest& failed_request, | 270 WebKit::WebFrame* frame, |
270 const WebKit::WebURLError& error, | 271 const WebKit::WebURLRequest& failed_request, |
271 const std::string& html, | 272 const WebKit::WebURLError& error, |
272 bool replace); | 273 const std::string& html, |
| 274 bool replace); |
273 | 275 |
274 // Plugin-related functions -------------------------------------------------- | 276 // Plugin-related functions -------------------------------------------------- |
275 // (See also WebPluginPageDelegate implementation.) | 277 // (See also WebPluginPageDelegate implementation.) |
276 | 278 |
277 // Notification that the given plugin has crashed. | 279 // Notification that the given plugin has crashed. |
278 void PluginCrashed(const FilePath& plugin_path); | 280 void PluginCrashed(const FilePath& plugin_path); |
279 | 281 |
280 // Create a new NPAPI plugin. | 282 // Create a new NPAPI plugin. |
281 WebKit::WebPlugin* CreateNPAPIPlugin(WebKit::WebFrame* frame, | 283 CONTENT_EXPORT WebKit::WebPlugin* CreateNPAPIPlugin( |
282 const WebKit::WebPluginParams& params, | |
283 const FilePath& path, | |
284 const std::string& mime_type); | |
285 | |
286 // Create a new Pepper plugin. | |
287 WebKit::WebPlugin* CreatePepperPlugin( | |
288 WebKit::WebFrame* frame, | 284 WebKit::WebFrame* frame, |
289 const WebKit::WebPluginParams& params, | 285 const WebKit::WebPluginParams& params, |
290 const FilePath& path, | 286 const FilePath& path, |
| 287 const std::string& mime_type); |
| 288 |
| 289 // Create a new Pepper plugin. |
| 290 CONTENT_EXPORT WebKit::WebPlugin* CreatePepperPlugin( |
| 291 WebKit::WebFrame* frame, |
| 292 const WebKit::WebPluginParams& params, |
| 293 const FilePath& path, |
291 webkit::ppapi::PluginModule* pepper_module); | 294 webkit::ppapi::PluginModule* pepper_module); |
292 | 295 |
293 // Creates a fullscreen container for a pepper plugin instance. | 296 // Creates a fullscreen container for a pepper plugin instance. |
294 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer( | 297 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer( |
295 webkit::ppapi::PluginInstance* plugin); | 298 webkit::ppapi::PluginInstance* plugin); |
296 | 299 |
297 // Create a new plugin without checking the content settings. | 300 // Create a new plugin without checking the content settings. |
298 WebKit::WebPlugin* CreatePluginNoCheck(WebKit::WebFrame* frame, | 301 CONTENT_EXPORT WebKit::WebPlugin* CreatePluginNoCheck( |
299 const WebKit::WebPluginParams& params); | 302 WebKit::WebFrame* frame, |
| 303 const WebKit::WebPluginParams& params); |
300 | 304 |
301 // Informs the render view that a PPAPI plugin has gained or lost focus. | 305 // Informs the render view that a PPAPI plugin has gained or lost focus. |
302 void PpapiPluginFocusChanged(); | 306 void PpapiPluginFocusChanged(); |
303 | 307 |
304 // Request updated policy regarding firewall NAT traversal being enabled. | 308 // Request updated policy regarding firewall NAT traversal being enabled. |
305 void RequestRemoteAccessClientFirewallTraversal(); | 309 void RequestRemoteAccessClientFirewallTraversal(); |
306 | 310 |
307 #if defined(OS_MACOSX) | 311 #if defined(OS_MACOSX) |
308 // Informs the render view that the given plugin has gained or lost focus. | 312 // Informs the render view that the given plugin has gained or lost focus. |
309 void PluginFocusChanged(bool focused, int plugin_id); | 313 void PluginFocusChanged(bool focused, int plugin_id); |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 // bunch of stuff, you should probably create a helper class and put your | 1231 // bunch of stuff, you should probably create a helper class and put your |
1228 // data and methods on that to avoid bloating RenderView more. You can use | 1232 // data and methods on that to avoid bloating RenderView more. You can use |
1229 // the Observer interface to filter IPC messages and receive frame change | 1233 // the Observer interface to filter IPC messages and receive frame change |
1230 // notifications. | 1234 // notifications. |
1231 // --------------------------------------------------------------------------- | 1235 // --------------------------------------------------------------------------- |
1232 | 1236 |
1233 DISALLOW_COPY_AND_ASSIGN(RenderView); | 1237 DISALLOW_COPY_AND_ASSIGN(RenderView); |
1234 }; | 1238 }; |
1235 | 1239 |
1236 #endif // CONTENT_RENDERER_RENDER_VIEW_H_ | 1240 #endif // CONTENT_RENDERER_RENDER_VIEW_H_ |
OLD | NEW |