OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FRAME_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
6 #define CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ | 6 #define CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
| 11 #include <memory> |
11 #include <string> | 12 #include <string> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
15 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
16 #include "base/id_map.h" | 17 #include "base/id_map.h" |
17 #include "base/macros.h" | 18 #include "base/macros.h" |
18 #include "base/memory/linked_ptr.h" | 19 #include "base/memory/linked_ptr.h" |
19 #include "base/memory/scoped_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/process/process_handle.h" | 22 #include "base/process/process_handle.h" |
23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
24 #include "content/common/accessibility_mode_enums.h" | 24 #include "content/common/accessibility_mode_enums.h" |
25 #include "content/common/frame_message_enums.h" | 25 #include "content/common/frame_message_enums.h" |
26 #include "content/common/mojo/service_registry_impl.h" | 26 #include "content/common/mojo/service_registry_impl.h" |
27 #include "content/public/common/console_message_level.h" | 27 #include "content/public/common/console_message_level.h" |
28 #include "content/public/common/javascript_message_type.h" | 28 #include "content/public/common/javascript_message_type.h" |
29 #include "content/public/common/referrer.h" | 29 #include "content/public/common/referrer.h" |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 blink::WebElement GetFocusedElement() const override; | 380 blink::WebElement GetFocusedElement() const override; |
381 WebPreferences& GetWebkitPreferences() override; | 381 WebPreferences& GetWebkitPreferences() override; |
382 int ShowContextMenu(ContextMenuClient* client, | 382 int ShowContextMenu(ContextMenuClient* client, |
383 const ContextMenuParams& params) override; | 383 const ContextMenuParams& params) override; |
384 void CancelContextMenu(int request_id) override; | 384 void CancelContextMenu(int request_id) override; |
385 blink::WebNode GetContextMenuNode() const override; | 385 blink::WebNode GetContextMenuNode() const override; |
386 blink::WebPlugin* CreatePlugin( | 386 blink::WebPlugin* CreatePlugin( |
387 blink::WebFrame* frame, | 387 blink::WebFrame* frame, |
388 const WebPluginInfo& info, | 388 const WebPluginInfo& info, |
389 const blink::WebPluginParams& params, | 389 const blink::WebPluginParams& params, |
390 scoped_ptr<PluginInstanceThrottler> throttler) override; | 390 std::unique_ptr<PluginInstanceThrottler> throttler) override; |
391 void LoadURLExternally(const blink::WebURLRequest& request, | 391 void LoadURLExternally(const blink::WebURLRequest& request, |
392 blink::WebNavigationPolicy policy) override; | 392 blink::WebNavigationPolicy policy) override; |
393 void ExecuteJavaScript(const base::string16& javascript) override; | 393 void ExecuteJavaScript(const base::string16& javascript) override; |
394 bool IsMainFrame() override; | 394 bool IsMainFrame() override; |
395 bool IsHidden() override; | 395 bool IsHidden() override; |
396 ServiceRegistry* GetServiceRegistry() override; | 396 ServiceRegistry* GetServiceRegistry() override; |
397 #if defined(ENABLE_PLUGINS) | 397 #if defined(ENABLE_PLUGINS) |
398 void RegisterPeripheralPlugin( | 398 void RegisterPeripheralPlugin( |
399 const url::Origin& content_origin, | 399 const url::Origin& content_origin, |
400 const base::Closure& unthrottle_callback) override; | 400 const base::Closure& unthrottle_callback) override; |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 // Binds this render frame's service registry. | 635 // Binds this render frame's service registry. |
636 void BindServiceRegistry( | 636 void BindServiceRegistry( |
637 mojo::shell::mojom::InterfaceProviderRequest services, | 637 mojo::shell::mojom::InterfaceProviderRequest services, |
638 mojo::shell::mojom::InterfaceProviderPtr exposed_services); | 638 mojo::shell::mojom::InterfaceProviderPtr exposed_services); |
639 | 639 |
640 ManifestManager* manifest_manager(); | 640 ManifestManager* manifest_manager(); |
641 | 641 |
642 // TODO(creis): Remove when the only caller, the HistoryController, is no | 642 // TODO(creis): Remove when the only caller, the HistoryController, is no |
643 // more. | 643 // more. |
644 void SetPendingNavigationParams( | 644 void SetPendingNavigationParams( |
645 scoped_ptr<NavigationParams> navigation_params); | 645 std::unique_ptr<NavigationParams> navigation_params); |
646 | 646 |
647 media::MediaPermission* GetMediaPermission(); | 647 media::MediaPermission* GetMediaPermission(); |
648 | 648 |
649 // Sends the current frame's navigation state to the browser. | 649 // Sends the current frame's navigation state to the browser. |
650 void SendUpdateState(); | 650 void SendUpdateState(); |
651 | 651 |
652 // Creates a MojoBindingsController if Mojo bindings have been enabled for | 652 // Creates a MojoBindingsController if Mojo bindings have been enabled for |
653 // this frame. For WebUI, this allows the page to communicate with the browser | 653 // this frame. For WebUI, this allows the page to communicate with the browser |
654 // process; for layout tests, this allows the test to mock out services at | 654 // process; for layout tests, this allows the test to mock out services at |
655 // the Mojo IPC layer. | 655 // the Mojo IPC layer. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 bool is_history_navigation_in_new_child); | 823 bool is_history_navigation_in_new_child); |
824 | 824 |
825 // Performs a navigation in the frame. This provides a unified function for | 825 // Performs a navigation in the frame. This provides a unified function for |
826 // the current code path and the browser-side navigation path (in | 826 // the current code path and the browser-side navigation path (in |
827 // development). Currently used by OnNavigate, with all *NavigationParams | 827 // development). Currently used by OnNavigate, with all *NavigationParams |
828 // provided by the browser. |stream_params| should be null. | 828 // provided by the browser. |stream_params| should be null. |
829 // PlzNavigate: used by OnCommitNavigation, with |common_params| and | 829 // PlzNavigate: used by OnCommitNavigation, with |common_params| and |
830 // |request_params| received by the browser. |stream_params| should be non | 830 // |request_params| received by the browser. |stream_params| should be non |
831 // null and created from the information provided by the browser. | 831 // null and created from the information provided by the browser. |
832 // |start_params| is not used. | 832 // |start_params| is not used. |
833 void NavigateInternal(const CommonNavigationParams& common_params, | 833 void NavigateInternal( |
834 const StartNavigationParams& start_params, | 834 const CommonNavigationParams& common_params, |
835 const RequestNavigationParams& request_params, | 835 const StartNavigationParams& start_params, |
836 scoped_ptr<StreamOverrideParameters> stream_params); | 836 const RequestNavigationParams& request_params, |
| 837 std::unique_ptr<StreamOverrideParameters> stream_params); |
837 | 838 |
838 // Update current main frame's encoding and send it to browser window. | 839 // Update current main frame's encoding and send it to browser window. |
839 // Since we want to let users see the right encoding info from menu | 840 // Since we want to let users see the right encoding info from menu |
840 // before finishing loading, we call the UpdateEncoding in | 841 // before finishing loading, we call the UpdateEncoding in |
841 // a) function:DidCommitLoadForFrame. When this function is called, | 842 // a) function:DidCommitLoadForFrame. When this function is called, |
842 // that means we have got first data. In here we try to get encoding | 843 // that means we have got first data. In here we try to get encoding |
843 // of page if it has been specified in http header. | 844 // of page if it has been specified in http header. |
844 // b) function:DidReceiveTitle. When this function is called, | 845 // b) function:DidReceiveTitle. When this function is called, |
845 // that means we have got specified title. Because in most of webpages, | 846 // that means we have got specified title. Because in most of webpages, |
846 // title tags will follow meta tags. In here we try to get encoding of | 847 // title tags will follow meta tags. In here we try to get encoding of |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 // possible to create a MediaStreamClient (e.g., WebRTC is disabled), then | 881 // possible to create a MediaStreamClient (e.g., WebRTC is disabled), then |
881 // |web_user_media_client_| will remain NULL. | 882 // |web_user_media_client_| will remain NULL. |
882 void InitializeUserMediaClient(); | 883 void InitializeUserMediaClient(); |
883 | 884 |
884 blink::WebMediaPlayer* CreateWebMediaPlayerForMediaStream( | 885 blink::WebMediaPlayer* CreateWebMediaPlayerForMediaStream( |
885 blink::WebMediaPlayerClient* client, | 886 blink::WebMediaPlayerClient* client, |
886 const blink::WebString& sink_id, | 887 const blink::WebString& sink_id, |
887 const blink::WebSecurityOrigin& security_origin); | 888 const blink::WebSecurityOrigin& security_origin); |
888 | 889 |
889 // Creates a factory object used for creating audio and video renderers. | 890 // Creates a factory object used for creating audio and video renderers. |
890 scoped_ptr<MediaStreamRendererFactory> CreateRendererFactory(); | 891 std::unique_ptr<MediaStreamRendererFactory> CreateRendererFactory(); |
891 | 892 |
892 // Does preparation for the navigation to |url|. | 893 // Does preparation for the navigation to |url|. |
893 void PrepareRenderViewForNavigation( | 894 void PrepareRenderViewForNavigation( |
894 const GURL& url, | 895 const GURL& url, |
895 const RequestNavigationParams& request_params); | 896 const RequestNavigationParams& request_params); |
896 | 897 |
897 // PlzNavigate | 898 // PlzNavigate |
898 // Sends a FrameHostMsg_BeginNavigation to the browser based on the contents | 899 // Sends a FrameHostMsg_BeginNavigation to the browser based on the contents |
899 // of the WebURLRequest. | 900 // of the WebURLRequest. |
900 // |should_replace_current_entry| indicates that the current history entry | 901 // |should_replace_current_entry| indicates that the current history entry |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 int proxy_routing_id_; | 1036 int proxy_routing_id_; |
1036 | 1037 |
1037 // Non-null when the RenderFrame is a local root for compositing, input, | 1038 // Non-null when the RenderFrame is a local root for compositing, input, |
1038 // layout, etc. A local frame is also a local root iff it does not have a | 1039 // layout, etc. A local frame is also a local root iff it does not have a |
1039 // parent that is a local frame. | 1040 // parent that is a local frame. |
1040 scoped_refptr<RenderWidget> render_widget_; | 1041 scoped_refptr<RenderWidget> render_widget_; |
1041 | 1042 |
1042 // Temporarily holds state pertaining to a navigation that has been initiated | 1043 // Temporarily holds state pertaining to a navigation that has been initiated |
1043 // until the NavigationState corresponding to the new navigation is created in | 1044 // until the NavigationState corresponding to the new navigation is created in |
1044 // didCreateDataSource(). | 1045 // didCreateDataSource(). |
1045 scoped_ptr<NavigationParams> pending_navigation_params_; | 1046 std::unique_ptr<NavigationParams> pending_navigation_params_; |
1046 | 1047 |
1047 // Stores the current history item for this frame, so that updates to it can | 1048 // Stores the current history item for this frame, so that updates to it can |
1048 // be reported to the browser process via SendUpdateState. | 1049 // be reported to the browser process via SendUpdateState. |
1049 blink::WebHistoryItem current_history_item_; | 1050 blink::WebHistoryItem current_history_item_; |
1050 | 1051 |
1051 #if defined(ENABLE_PLUGINS) | 1052 #if defined(ENABLE_PLUGINS) |
1052 // Current text input composition text. Empty if no composition is in | 1053 // Current text input composition text. Empty if no composition is in |
1053 // progress. | 1054 // progress. |
1054 base::string16 pepper_composition_text_; | 1055 base::string16 pepper_composition_text_; |
1055 | 1056 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 // along with the RenderFrame automatically. This is why we just store weak | 1101 // along with the RenderFrame automatically. This is why we just store weak |
1101 // references. | 1102 // references. |
1102 | 1103 |
1103 // Dispatches permission requests for Web Notifications. | 1104 // Dispatches permission requests for Web Notifications. |
1104 NotificationPermissionDispatcher* notification_permission_dispatcher_; | 1105 NotificationPermissionDispatcher* notification_permission_dispatcher_; |
1105 | 1106 |
1106 // Destroyed via the RenderFrameObserver::OnDestruct() mechanism. | 1107 // Destroyed via the RenderFrameObserver::OnDestruct() mechanism. |
1107 UserMediaClientImpl* web_user_media_client_; | 1108 UserMediaClientImpl* web_user_media_client_; |
1108 | 1109 |
1109 // EncryptedMediaClient attached to this frame; lazily initialized. | 1110 // EncryptedMediaClient attached to this frame; lazily initialized. |
1110 scoped_ptr<media::WebEncryptedMediaClientImpl> web_encrypted_media_client_; | 1111 std::unique_ptr<media::WebEncryptedMediaClientImpl> |
| 1112 web_encrypted_media_client_; |
1111 | 1113 |
1112 // The media permission dispatcher attached to this frame. | 1114 // The media permission dispatcher attached to this frame. |
1113 scoped_ptr<MediaPermissionDispatcher> media_permission_dispatcher_; | 1115 std::unique_ptr<MediaPermissionDispatcher> media_permission_dispatcher_; |
1114 | 1116 |
1115 #if defined(ENABLE_MOJO_MEDIA) | 1117 #if defined(ENABLE_MOJO_MEDIA) |
1116 // The media interface provider attached to this frame, lazily initialized. | 1118 // The media interface provider attached to this frame, lazily initialized. |
1117 scoped_ptr<MediaInterfaceProvider> media_interface_provider_; | 1119 std::unique_ptr<MediaInterfaceProvider> media_interface_provider_; |
1118 #endif | 1120 #endif |
1119 | 1121 |
1120 // MidiClient attached to this frame; lazily initialized. | 1122 // MidiClient attached to this frame; lazily initialized. |
1121 MidiDispatcher* midi_dispatcher_; | 1123 MidiDispatcher* midi_dispatcher_; |
1122 | 1124 |
1123 #if defined(OS_ANDROID) | 1125 #if defined(OS_ANDROID) |
1124 // Manages all media players and sessions in this render frame for | 1126 // Manages all media players and sessions in this render frame for |
1125 // communicating with the real media player and sessions in the | 1127 // communicating with the real media player and sessions in the |
1126 // browser process. It's okay to use raw pointers since they're both | 1128 // browser process. It's okay to use raw pointers since they're both |
1127 // RenderFrameObservers. | 1129 // RenderFrameObservers. |
1128 RendererMediaPlayerManager* media_player_manager_; | 1130 RendererMediaPlayerManager* media_player_manager_; |
1129 RendererMediaSessionManager* media_session_manager_; | 1131 RendererMediaSessionManager* media_session_manager_; |
1130 #endif | 1132 #endif |
1131 | 1133 |
1132 media::SurfaceManager* media_surface_manager_; | 1134 media::SurfaceManager* media_surface_manager_; |
1133 | 1135 |
1134 #if defined(ENABLE_BROWSER_CDMS) | 1136 #if defined(ENABLE_BROWSER_CDMS) |
1135 // Manage all CDMs in this render frame for communicating with the real CDM in | 1137 // Manage all CDMs in this render frame for communicating with the real CDM in |
1136 // the browser process. It's okay to use a raw pointer since it's a | 1138 // the browser process. It's okay to use a raw pointer since it's a |
1137 // RenderFrameObserver. | 1139 // RenderFrameObserver. |
1138 RendererCdmManager* cdm_manager_; | 1140 RendererCdmManager* cdm_manager_; |
1139 #endif | 1141 #endif |
1140 | 1142 |
1141 // The CDM and decoder factory attached to this frame, lazily initialized. | 1143 // The CDM and decoder factory attached to this frame, lazily initialized. |
1142 scoped_ptr<media::CdmFactory> cdm_factory_; | 1144 std::unique_ptr<media::CdmFactory> cdm_factory_; |
1143 scoped_ptr<media::DecoderFactory> decoder_factory_; | 1145 std::unique_ptr<media::DecoderFactory> decoder_factory_; |
1144 | 1146 |
1145 // Media resource cache, lazily initialized. | 1147 // Media resource cache, lazily initialized. |
1146 linked_ptr<media::UrlIndex> url_index_; | 1148 linked_ptr<media::UrlIndex> url_index_; |
1147 | 1149 |
1148 #if defined(VIDEO_HOLE) | 1150 #if defined(VIDEO_HOLE) |
1149 // Whether or not this RenderFrameImpl contains a media player. Used to | 1151 // Whether or not this RenderFrameImpl contains a media player. Used to |
1150 // register as an observer for video-hole-specific events. | 1152 // register as an observer for video-hole-specific events. |
1151 bool contains_media_player_; | 1153 bool contains_media_player_; |
1152 #endif | 1154 #endif |
1153 | 1155 |
(...skipping 27 matching lines...) Expand all Loading... |
1181 // process. | 1183 // process. |
1182 ManifestManager* manifest_manager_; | 1184 ManifestManager* manifest_manager_; |
1183 | 1185 |
1184 // The current accessibility mode. | 1186 // The current accessibility mode. |
1185 AccessibilityMode accessibility_mode_; | 1187 AccessibilityMode accessibility_mode_; |
1186 | 1188 |
1187 // Only valid if |accessibility_mode_| is anything other than | 1189 // Only valid if |accessibility_mode_| is anything other than |
1188 // AccessibilityModeOff. | 1190 // AccessibilityModeOff. |
1189 RendererAccessibility* renderer_accessibility_; | 1191 RendererAccessibility* renderer_accessibility_; |
1190 | 1192 |
1191 scoped_ptr<PermissionDispatcher> permission_client_; | 1193 std::unique_ptr<PermissionDispatcher> permission_client_; |
1192 | 1194 |
1193 scoped_ptr<blink::WebAppBannerClient> app_banner_client_; | 1195 std::unique_ptr<blink::WebAppBannerClient> app_banner_client_; |
1194 | 1196 |
1195 scoped_ptr<blink::WebBluetooth> bluetooth_; | 1197 std::unique_ptr<blink::WebBluetooth> bluetooth_; |
1196 | 1198 |
1197 scoped_ptr<blink::WebUSBClient> usb_client_; | 1199 std::unique_ptr<blink::WebUSBClient> usb_client_; |
1198 | 1200 |
1199 // Manages play, pause notifications for WebMediaPlayer implementations; its | 1201 // Manages play, pause notifications for WebMediaPlayer implementations; its |
1200 // lifetime is tied to the RenderFrame via the RenderFrameObserver interface. | 1202 // lifetime is tied to the RenderFrame via the RenderFrameObserver interface. |
1201 media::RendererWebMediaPlayerDelegate* media_player_delegate_; | 1203 media::RendererWebMediaPlayerDelegate* media_player_delegate_; |
1202 | 1204 |
1203 // Whether or not this RenderFrame is using Lo-Fi mode. | 1205 // Whether or not this RenderFrame is using Lo-Fi mode. |
1204 bool is_using_lofi_; | 1206 bool is_using_lofi_; |
1205 | 1207 |
1206 // Whether or not this RenderFrame is currently pasting. | 1208 // Whether or not this RenderFrame is currently pasting. |
1207 bool is_pasting_; | 1209 bool is_pasting_; |
1208 | 1210 |
1209 // Whether we must stop creating nested message loops for modal dialogs. This | 1211 // Whether we must stop creating nested message loops for modal dialogs. This |
1210 // is necessary because modal dialogs have a ScopedPageLoadDeferrer on the | 1212 // is necessary because modal dialogs have a ScopedPageLoadDeferrer on the |
1211 // stack that interferes with swapping out. | 1213 // stack that interferes with swapping out. |
1212 bool suppress_further_dialogs_; | 1214 bool suppress_further_dialogs_; |
1213 | 1215 |
1214 #if defined(ENABLE_WEBVR) | 1216 #if defined(ENABLE_WEBVR) |
1215 // The VR dispatcher attached to the frame, lazily initialized. | 1217 // The VR dispatcher attached to the frame, lazily initialized. |
1216 scoped_ptr<VRDispatcher> vr_dispatcher_; | 1218 std::unique_ptr<VRDispatcher> vr_dispatcher_; |
1217 #endif | 1219 #endif |
1218 | 1220 |
1219 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 1221 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
1220 // The external popup for the currently showing select popup. | 1222 // The external popup for the currently showing select popup. |
1221 scoped_ptr<ExternalPopupMenu> external_popup_menu_; | 1223 std::unique_ptr<ExternalPopupMenu> external_popup_menu_; |
1222 #endif | 1224 #endif |
1223 | 1225 |
1224 FrameBlameContext* blame_context_; // Not owned. | 1226 FrameBlameContext* blame_context_; // Not owned. |
1225 | 1227 |
1226 base::WeakPtrFactory<RenderFrameImpl> weak_factory_; | 1228 base::WeakPtrFactory<RenderFrameImpl> weak_factory_; |
1227 | 1229 |
1228 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); | 1230 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); |
1229 }; | 1231 }; |
1230 | 1232 |
1231 } // namespace content | 1233 } // namespace content |
1232 | 1234 |
1233 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ | 1235 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
OLD | NEW |