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_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ |
6 #define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ | 6 #define CONTENT_RENDERER_RENDER_VIEW_IMPL_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/content_export.h" |
27 #include "content/common/edit_command.h" | 27 #include "content/common/edit_command.h" |
28 #include "content/common/navigation_gesture.h" | 28 #include "content/common/navigation_gesture.h" |
29 #include "content/public/common/page_zoom.h" | 29 #include "content/public/common/page_zoom.h" |
| 30 #include "content/public/common/referrer.h" |
30 #include "content/public/common/renderer_preferences.h" | 31 #include "content/public/common/renderer_preferences.h" |
31 #include "content/public/common/stop_find_action.h" | 32 #include "content/public/common/stop_find_action.h" |
32 #include "content/public/renderer/render_view.h" | 33 #include "content/public/renderer/render_view.h" |
33 #include "content/renderer/pepper_plugin_delegate_impl.h" | 34 #include "content/renderer/pepper_plugin_delegate_impl.h" |
34 #include "content/renderer/render_widget.h" | 35 #include "content/renderer/render_widget.h" |
35 #include "ipc/ipc_platform_file.h" | 36 #include "ipc/ipc_platform_file.h" |
36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" | 37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" |
37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystem.h" | 38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystem.h" |
38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" | 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" |
39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIconURL.h" | 40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIconURL.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 // type. Returns false if no plugin was found. | 287 // type. Returns false if no plugin was found. |
287 // |actual_mime_type| is the actual mime type supported by the | 288 // |actual_mime_type| is the actual mime type supported by the |
288 // plugin found that match the URL given (one for each item in | 289 // plugin found that match the URL given (one for each item in |
289 // |info|). | 290 // |info|). |
290 CONTENT_EXPORT bool GetPluginInfo(const GURL& url, | 291 CONTENT_EXPORT bool GetPluginInfo(const GURL& url, |
291 const GURL& page_url, | 292 const GURL& page_url, |
292 const std::string& mime_type, | 293 const std::string& mime_type, |
293 webkit::WebPluginInfo* plugin_info, | 294 webkit::WebPluginInfo* plugin_info, |
294 std::string* actual_mime_type); | 295 std::string* actual_mime_type); |
295 | 296 |
| 297 // Helper function to check that TCP/UDP private APIs are allowed for current |
| 298 // page. This check actually allows socket usage for NativeClient code only. |
| 299 // It is better to move this check to browser process but Pepper message |
| 300 // filters in browser process have no context about page that sent |
| 301 // the request. Doing this check in render process is safe because NaCl code |
| 302 // is executed in separate NaCl process. |
| 303 bool CanUseSocketAPIs(); |
| 304 |
296 // IPC::Channel::Listener implementation ------------------------------------- | 305 // IPC::Channel::Listener implementation ------------------------------------- |
297 | 306 |
298 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 307 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
299 | 308 |
300 // WebKit::WebWidgetClient implementation ------------------------------------ | 309 // WebKit::WebWidgetClient implementation ------------------------------------ |
301 | 310 |
302 // Most methods are handled by RenderWidget. | 311 // Most methods are handled by RenderWidget. |
303 virtual void didFocus(); | 312 virtual void didFocus(); |
304 virtual void didBlur(); | 313 virtual void didBlur(); |
305 virtual void show(WebKit::WebNavigationPolicy policy); | 314 virtual void show(WebKit::WebNavigationPolicy policy); |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 // title tags will follow meta tags. In here we try to get encoding of | 716 // title tags will follow meta tags. In here we try to get encoding of |
708 // page if it has been specified in meta tag. | 717 // page if it has been specified in meta tag. |
709 // c) function:DidFinishDocumentLoadForFrame. When this function is | 718 // c) function:DidFinishDocumentLoadForFrame. When this function is |
710 // called, that means we have got whole html page. In here we should | 719 // called, that means we have got whole html page. In here we should |
711 // finally get right encoding of page. | 720 // finally get right encoding of page. |
712 void UpdateEncoding(WebKit::WebFrame* frame, | 721 void UpdateEncoding(WebKit::WebFrame* frame, |
713 const std::string& encoding_name); | 722 const std::string& encoding_name); |
714 | 723 |
715 void OpenURL(WebKit::WebFrame* frame, | 724 void OpenURL(WebKit::WebFrame* frame, |
716 const GURL& url, | 725 const GURL& url, |
717 const GURL& referrer, | 726 const content::Referrer& referrer, |
718 WebKit::WebNavigationPolicy policy); | 727 WebKit::WebNavigationPolicy policy); |
719 | 728 |
720 bool RunJavaScriptMessage(int type, | 729 bool RunJavaScriptMessage(int type, |
721 const string16& message, | 730 const string16& message, |
722 const string16& default_value, | 731 const string16& default_value, |
723 const GURL& frame_url, | 732 const GURL& frame_url, |
724 string16* result); | 733 string16* result); |
725 | 734 |
726 // Sends a message and runs a nested message loop. | 735 // Sends a message and runs a nested message loop. |
727 bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message); | 736 bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message); |
(...skipping 16 matching lines...) Expand all Loading... |
744 const IPC::ChannelHandle& handle); | 753 const IPC::ChannelHandle& handle); |
745 void OnCancelDownload(int32 download_id); | 754 void OnCancelDownload(int32 download_id); |
746 void OnClearFocusedNode(); | 755 void OnClearFocusedNode(); |
747 void OnClosePage(); | 756 void OnClosePage(); |
748 #if defined(ENABLE_FLAPPER_HACKS) | 757 #if defined(ENABLE_FLAPPER_HACKS) |
749 void OnConnectTcpACK(int request_id, | 758 void OnConnectTcpACK(int request_id, |
750 IPC::PlatformFileForTransit socket_for_transit, | 759 IPC::PlatformFileForTransit socket_for_transit, |
751 const PP_NetAddress_Private& local_addr, | 760 const PP_NetAddress_Private& local_addr, |
752 const PP_NetAddress_Private& remote_addr); | 761 const PP_NetAddress_Private& remote_addr); |
753 #endif | 762 #endif |
| 763 void OnTCPSocketConnectACK(uint32 plugin_dispatcher_id, |
| 764 uint32 socket_id, |
| 765 bool succeeded, |
| 766 const PP_NetAddress_Private& local_addr, |
| 767 const PP_NetAddress_Private& remote_addr); |
| 768 void OnTCPSocketSSLHandshakeACK(uint32 plugin_dispatcher_id, |
| 769 uint32 socket_id, |
| 770 bool succeeded); |
| 771 void OnTCPSocketReadACK(uint32 plugin_dispatcher_id, |
| 772 uint32 socket_id, |
| 773 bool succeeded, |
| 774 const std::string& data); |
| 775 void OnTCPSocketWriteACK(uint32 plugin_dispatcher_id, |
| 776 uint32 socket_id, |
| 777 bool succeeded, |
| 778 int32_t bytes_written); |
| 779 void OnUDPSocketBindACK(uint32 plugin_dispatcher_id, |
| 780 uint32 socket_id, |
| 781 bool succeeded); |
| 782 void OnUDPSocketSendToACK(uint32 plugin_dispatcher_id, |
| 783 uint32 socket_id, |
| 784 bool succeeded, |
| 785 int32_t bytes_written); |
| 786 void OnUDPSocketRecvFromACK(uint32 plugin_dispatcher_id, |
| 787 uint32 socket_id, |
| 788 bool succeeded, |
| 789 const std::string& data, |
| 790 const PP_NetAddress_Private& addr); |
| 791 |
754 void OnContextMenuClosed( | 792 void OnContextMenuClosed( |
755 const webkit_glue::CustomContextMenuContext& custom_context); | 793 const webkit_glue::CustomContextMenuContext& custom_context); |
756 void OnCopy(); | 794 void OnCopy(); |
757 void OnCopyImageAt(int x, int y); | 795 void OnCopyImageAt(int x, int y); |
758 #if defined(OS_MACOSX) | 796 #if defined(OS_MACOSX) |
759 void OnCopyToFindPboard(); | 797 void OnCopyToFindPboard(); |
760 #endif | 798 #endif |
761 void OnCut(); | 799 void OnCut(); |
762 void OnCSSInsertRequest(const string16& frame_xpath, | 800 void OnCSSInsertRequest(const string16& frame_xpath, |
763 const std::string& css); | 801 const std::string& css); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 | 1033 |
996 // Whether this RenderView was created by a frame that was suppressing its | 1034 // Whether this RenderView was created by a frame that was suppressing its |
997 // opener. If so, we may want to load pages in a separate process. See | 1035 // opener. If so, we may want to load pages in a separate process. See |
998 // decidePolicyForNavigation for details. | 1036 // decidePolicyForNavigation for details. |
999 bool opener_suppressed_; | 1037 bool opener_suppressed_; |
1000 | 1038 |
1001 // If we are handling a top-level client-side redirect, this tracks the URL | 1039 // If we are handling a top-level client-side redirect, this tracks the URL |
1002 // of the page that initiated it. Specifically, when a load is committed this | 1040 // of the page that initiated it. Specifically, when a load is committed this |
1003 // is used to determine if that load originated from a client-side redirect. | 1041 // is used to determine if that load originated from a client-side redirect. |
1004 // It is empty if there is no top-level client-side redirect. | 1042 // It is empty if there is no top-level client-side redirect. |
1005 GURL completed_client_redirect_src_; | 1043 content::Referrer completed_client_redirect_src_; |
1006 | 1044 |
1007 // Holds state pertaining to a navigation that we initiated. This is held by | 1045 // Holds state pertaining to a navigation that we initiated. This is held by |
1008 // the WebDataSource::ExtraData attribute. We use pending_navigation_state_ | 1046 // the WebDataSource::ExtraData attribute. We use pending_navigation_state_ |
1009 // as a temporary holder for the state until the WebDataSource corresponding | 1047 // as a temporary holder for the state until the WebDataSource corresponding |
1010 // to the new navigation is created. See DidCreateDataSource. | 1048 // to the new navigation is created. See DidCreateDataSource. |
1011 scoped_ptr<ViewMsg_Navigate_Params> pending_navigation_params_; | 1049 scoped_ptr<ViewMsg_Navigate_Params> pending_navigation_params_; |
1012 | 1050 |
1013 // Timer used to delay the updating of nav state (see SyncNavigationState). | 1051 // Timer used to delay the updating of nav state (see SyncNavigationState). |
1014 base::OneShotTimer<RenderViewImpl> nav_state_sync_timer_; | 1052 base::OneShotTimer<RenderViewImpl> nav_state_sync_timer_; |
1015 | 1053 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 scoped_ptr<LoadProgressTracker> load_progress_tracker_; | 1250 scoped_ptr<LoadProgressTracker> load_progress_tracker_; |
1213 | 1251 |
1214 // All the registered observers. We expect this list to be small, so vector | 1252 // All the registered observers. We expect this list to be small, so vector |
1215 // is fine. | 1253 // is fine. |
1216 ObserverList<content::RenderViewObserver> observers_; | 1254 ObserverList<content::RenderViewObserver> observers_; |
1217 | 1255 |
1218 // Used to inform didChangeSelection() when it is called in the context | 1256 // Used to inform didChangeSelection() when it is called in the context |
1219 // of handling a ViewMsg_SelectRange IPC. | 1257 // of handling a ViewMsg_SelectRange IPC. |
1220 bool handling_select_range_; | 1258 bool handling_select_range_; |
1221 | 1259 |
| 1260 // Set of origins that can use TCP/UDP private APIs from NaCl. |
| 1261 std::set<std::string> allowed_socket_origins_; |
| 1262 |
1222 // --------------------------------------------------------------------------- | 1263 // --------------------------------------------------------------------------- |
1223 // ADDING NEW DATA? Please see if it fits appropriately in one of the above | 1264 // ADDING NEW DATA? Please see if it fits appropriately in one of the above |
1224 // sections rather than throwing it randomly at the end. If you're adding a | 1265 // sections rather than throwing it randomly at the end. If you're adding a |
1225 // bunch of stuff, you should probably create a helper class and put your | 1266 // bunch of stuff, you should probably create a helper class and put your |
1226 // data and methods on that to avoid bloating RenderView more. You can | 1267 // data and methods on that to avoid bloating RenderView more. You can |
1227 // use the Observer interface to filter IPC messages and receive frame change | 1268 // use the Observer interface to filter IPC messages and receive frame change |
1228 // notifications. | 1269 // notifications. |
1229 // --------------------------------------------------------------------------- | 1270 // --------------------------------------------------------------------------- |
1230 | 1271 |
1231 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); | 1272 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); |
1232 }; | 1273 }; |
1233 | 1274 |
1234 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ | 1275 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ |
OLD | NEW |