OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 class GURL; | 41 class GURL; |
42 class RenderThread; | 42 class RenderThread; |
43 class SkBitmap; | 43 class SkBitmap; |
44 struct ThumbnailScore; | 44 struct ThumbnailScore; |
45 class WebError; | 45 class WebError; |
46 class WebFrame; | 46 class WebFrame; |
47 class WebPluginDelegate; | 47 class WebPluginDelegate; |
48 class WebPluginDelegateProxy; | 48 class WebPluginDelegateProxy; |
49 enum WebRequestCachePolicy; | 49 enum WebRequestCachePolicy; |
50 | 50 |
| 51 namespace base { |
| 52 class WaitableEvent; |
| 53 } |
| 54 |
51 namespace webkit_glue { | 55 namespace webkit_glue { |
52 struct FileUploadData; | 56 struct FileUploadData; |
53 } | 57 } |
54 | 58 |
55 // We need to prevent a page from trying to create infinite popups. It is not | 59 // We need to prevent a page from trying to create infinite popups. It is not |
56 // as simple as keeping a count of the number of immediate children | 60 // as simple as keeping a count of the number of immediate children |
57 // popups. Having an html file that window.open()s itself would create | 61 // popups. Having an html file that window.open()s itself would create |
58 // an unlimited chain of RenderViews who only have one RenderView child. | 62 // an unlimited chain of RenderViews who only have one RenderView child. |
59 // | 63 // |
60 // Therefore, each new top level RenderView creates a new counter and shares it | 64 // Therefore, each new top level RenderView creates a new counter and shares it |
(...skipping 17 matching lines...) Expand all Loading... |
78 // parent of the WebView HWND that will be created. The modal_dialog_event | 82 // parent of the WebView HWND that will be created. The modal_dialog_event |
79 // is set by the RenderView whenever a modal dialog alert is shown, so that | 83 // is set by the RenderView whenever a modal dialog alert is shown, so that |
80 // the renderer and plugin processes know to pump window messages. If this | 84 // the renderer and plugin processes know to pump window messages. If this |
81 // is a constrained popup or as a new tab, opener_id is the routing ID of the | 85 // is a constrained popup or as a new tab, opener_id is the routing ID of the |
82 // RenderView responsible for creating this RenderView (corresponding to the | 86 // RenderView responsible for creating this RenderView (corresponding to the |
83 // parent_hwnd). |counter| is either a currently initialized counter, or NULL | 87 // parent_hwnd). |counter| is either a currently initialized counter, or NULL |
84 // (in which case we treat this RenderView as a top level window). | 88 // (in which case we treat this RenderView as a top level window). |
85 static RenderView* Create( | 89 static RenderView* Create( |
86 RenderThreadBase* render_thread, | 90 RenderThreadBase* render_thread, |
87 HWND parent_hwnd, | 91 HWND parent_hwnd, |
88 HANDLE modal_dialog_event, | 92 base::WaitableEvent* modal_dialog_event, // takes ownership |
89 int32 opener_id, | 93 int32 opener_id, |
90 const WebPreferences& webkit_prefs, | 94 const WebPreferences& webkit_prefs, |
91 SharedRenderViewCounter* counter, | 95 SharedRenderViewCounter* counter, |
92 int32 routing_id); | 96 int32 routing_id); |
93 | 97 |
94 // Sets the "next page id" counter. | 98 // Sets the "next page id" counter. |
95 static void SetNextPageID(int32 next_page_id); | 99 static void SetNextPageID(int32 next_page_id); |
96 | 100 |
97 // The resource dispatcher used to fetch resources for this view. | 101 // The resource dispatcher used to fetch resources for this view. |
98 ResourceDispatcher* resource_dispatcher() { | 102 ResourceDispatcher* resource_dispatcher() { |
99 return resource_dispatcher_; | 103 return resource_dispatcher_; |
100 } | 104 } |
101 | 105 |
102 // May return NULL when the view is closing. | 106 // May return NULL when the view is closing. |
103 WebView* webview() const { | 107 WebView* webview() const { |
104 return static_cast<WebView*>(webwidget()); | 108 return static_cast<WebView*>(webwidget()); |
105 } | 109 } |
106 | 110 |
107 HWND host_window() const { | 111 HWND host_window() const { |
108 return host_window_; | 112 return host_window_; |
109 } | 113 } |
110 | 114 |
111 HANDLE modal_dialog_event() { | 115 base::WaitableEvent* modal_dialog_event() { |
112 return modal_dialog_event_.Get(); | 116 return modal_dialog_event_.get(); |
113 } | 117 } |
114 | 118 |
115 // IPC::Channel::Listener | 119 // IPC::Channel::Listener |
116 virtual void OnMessageReceived(const IPC::Message& msg); | 120 virtual void OnMessageReceived(const IPC::Message& msg); |
117 | 121 |
118 // WebViewDelegate | 122 // WebViewDelegate |
119 virtual void ShowModalHTMLDialog(const GURL& url, int width, int height, | 123 virtual void ShowModalHTMLDialog(const GURL& url, int width, int height, |
120 const std::string& json_arguments, | 124 const std::string& json_arguments, |
121 std::string* json_retval); | 125 std::string* json_retval); |
122 virtual void RunJavaScriptAlert(WebView* webview, | 126 virtual void RunJavaScriptAlert(WebView* webview, |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 private: | 325 private: |
322 FRIEND_TEST(RenderViewTest, OnLoadAlternateHTMLText); | 326 FRIEND_TEST(RenderViewTest, OnLoadAlternateHTMLText); |
323 FRIEND_TEST(RenderViewTest, OnNavStateChanged); | 327 FRIEND_TEST(RenderViewTest, OnNavStateChanged); |
324 | 328 |
325 explicit RenderView(RenderThreadBase* render_thread); | 329 explicit RenderView(RenderThreadBase* render_thread); |
326 | 330 |
327 // Initializes this view with the given parent and ID. The |routing_id| can be | 331 // Initializes this view with the given parent and ID. The |routing_id| can be |
328 // set to 'MSG_ROUTING_NONE' if the true ID is not yet known. In this case, | 332 // set to 'MSG_ROUTING_NONE' if the true ID is not yet known. In this case, |
329 // CompleteInit must be called later with the true ID. | 333 // CompleteInit must be called later with the true ID. |
330 void Init(HWND parent, | 334 void Init(HWND parent, |
331 HANDLE modal_dialog_event, | 335 base::WaitableEvent* modal_dialog_event, // takes ownership |
332 int32 opener_id, | 336 int32 opener_id, |
333 const WebPreferences& webkit_prefs, | 337 const WebPreferences& webkit_prefs, |
334 SharedRenderViewCounter* counter, | 338 SharedRenderViewCounter* counter, |
335 int32 routing_id); | 339 int32 routing_id); |
336 | 340 |
337 void UpdateURL(WebFrame* frame); | 341 void UpdateURL(WebFrame* frame); |
338 void UpdateTitle(WebFrame* frame, const std::wstring& title); | 342 void UpdateTitle(WebFrame* frame, const std::wstring& title); |
339 void UpdateSessionHistory(WebFrame* frame); | 343 void UpdateSessionHistory(WebFrame* frame); |
340 | 344 |
341 // Update current main frame's encoding and send it to browser window. | 345 // Update current main frame's encoding and send it to browser window. |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 WebPluginDelegate* first_default_plugin_; | 656 WebPluginDelegate* first_default_plugin_; |
653 | 657 |
654 // If the browser hasn't sent us an ACK for the last FindReply we sent | 658 // If the browser hasn't sent us an ACK for the last FindReply we sent |
655 // to it, then we need to queue up the message (keeping only the most | 659 // to it, then we need to queue up the message (keeping only the most |
656 // recent message if new ones come in). | 660 // recent message if new ones come in). |
657 scoped_ptr<IPC::Message> queued_find_reply_message_; | 661 scoped_ptr<IPC::Message> queued_find_reply_message_; |
658 | 662 |
659 // Handle to an event that's set when the page is showing a modal dialog (or | 663 // Handle to an event that's set when the page is showing a modal dialog (or |
660 // equivalent constrained window). The renderer and any plugin processes | 664 // equivalent constrained window). The renderer and any plugin processes |
661 // check this to know if they should pump messages/tasks then. | 665 // check this to know if they should pump messages/tasks then. |
662 ScopedHandle modal_dialog_event_; | 666 scoped_ptr<base::WaitableEvent> modal_dialog_event_; |
663 | 667 |
664 // Document width when in print CSS media type. 0 otherwise. | 668 // Document width when in print CSS media type. 0 otherwise. |
665 int printed_document_width_; | 669 int printed_document_width_; |
666 | 670 |
667 // Backup the view size before printing since it needs to be overriden. This | 671 // Backup the view size before printing since it needs to be overriden. This |
668 // value is set to restore the view size when printing is done. | 672 // value is set to restore the view size when printing is done. |
669 gfx::Size printing_view_size_; | 673 gfx::Size printing_view_size_; |
670 | 674 |
671 scoped_refptr<DebugMessageHandler> debug_message_handler_; | 675 scoped_refptr<DebugMessageHandler> debug_message_handler_; |
672 | 676 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 // Time in seconds of the delay between syncing page state such as form | 730 // Time in seconds of the delay between syncing page state such as form |
727 // elements and scroll position. This timeout allows us to avoid spamming the | 731 // elements and scroll position. This timeout allows us to avoid spamming the |
728 // browser process with every little thing that changes. This normally doesn't | 732 // browser process with every little thing that changes. This normally doesn't |
729 // change but is overridden by tests. | 733 // change but is overridden by tests. |
730 int delay_seconds_for_form_state_sync_; | 734 int delay_seconds_for_form_state_sync_; |
731 | 735 |
732 DISALLOW_COPY_AND_ASSIGN(RenderView); | 736 DISALLOW_COPY_AND_ASSIGN(RenderView); |
733 }; | 737 }; |
734 | 738 |
735 #endif // CHROME_RENDERER_RENDER_VIEW_H_ | 739 #endif // CHROME_RENDERER_RENDER_VIEW_H_ |
OLD | NEW |