| 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 <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.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/macros.h" | 19 #include "base/macros.h" |
| 20 #include "base/memory/linked_ptr.h" | 20 #include "base/memory/linked_ptr.h" |
| 21 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
| 22 #include "base/memory/weak_ptr.h" | 22 #include "base/memory/weak_ptr.h" |
| 23 #include "base/observer_list.h" | 23 #include "base/observer_list.h" |
| 24 #include "base/process/process_handle.h" | 24 #include "base/process/process_handle.h" |
| 25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 26 #include "content/common/accessibility_mode_enums.h" | 26 #include "content/common/accessibility_mode_enums.h" |
| 27 #include "content/common/associated_interface_registry_impl.h" | 27 #include "content/common/associated_interface_registry_impl.h" |
| 28 #include "content/common/frame.mojom.h" | 28 #include "content/common/frame.mojom.h" |
| 29 #include "content/common/frame_message_enums.h" | 29 #include "content/common/frame_message_enums.h" |
| 30 #include "content/common/host_zoom.mojom.h" |
| 30 #include "content/common/renderer.mojom.h" | 31 #include "content/common/renderer.mojom.h" |
| 31 #include "content/public/common/console_message_level.h" | 32 #include "content/public/common/console_message_level.h" |
| 32 #include "content/public/common/javascript_message_type.h" | 33 #include "content/public/common/javascript_message_type.h" |
| 33 #include "content/public/common/referrer.h" | 34 #include "content/public/common/referrer.h" |
| 34 #include "content/public/common/stop_find_action.h" | 35 #include "content/public/common/stop_find_action.h" |
| 35 #include "content/public/renderer/render_frame.h" | 36 #include "content/public/renderer/render_frame.h" |
| 36 #include "content/renderer/frame_blame_context.h" | 37 #include "content/renderer/frame_blame_context.h" |
| 37 #include "content/renderer/mojo/blink_interface_provider_impl.h" | 38 #include "content/renderer/mojo/blink_interface_provider_impl.h" |
| 38 #include "content/renderer/renderer_webcookiejar_impl.h" | 39 #include "content/renderer/renderer_webcookiejar_impl.h" |
| 39 #include "ipc/ipc_message.h" | 40 #include "ipc/ipc_message.h" |
| 40 #include "ipc/ipc_platform_file.h" | 41 #include "ipc/ipc_platform_file.h" |
| 41 #include "media/blink/webmediaplayer_delegate.h" | 42 #include "media/blink/webmediaplayer_delegate.h" |
| 42 #include "media/blink/webmediaplayer_params.h" | 43 #include "media/blink/webmediaplayer_params.h" |
| 43 #include "media/mojo/interfaces/remoting.mojom.h" | 44 #include "media/mojo/interfaces/remoting.mojom.h" |
| 45 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 44 #include "mojo/public/cpp/bindings/binding.h" | 46 #include "mojo/public/cpp/bindings/binding.h" |
| 45 #include "services/service_manager/public/interfaces/connector.mojom.h" | 47 #include "services/service_manager/public/interfaces/connector.mojom.h" |
| 46 #include "services/service_manager/public/interfaces/interface_provider.mojom.h" | 48 #include "services/service_manager/public/interfaces/interface_provider.mojom.h" |
| 47 #include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h" | 49 #include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h" |
| 48 #include "third_party/WebKit/public/platform/WebFocusType.h" | 50 #include "third_party/WebKit/public/platform/WebFocusType.h" |
| 49 #include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h" | 51 #include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h" |
| 50 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 52 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
| 51 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" | 53 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" |
| 52 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerClie
nt.h" | 54 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerClie
nt.h" |
| 53 #include "third_party/WebKit/public/web/WebAXObject.h" | 55 #include "third_party/WebKit/public/web/WebAXObject.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 struct StartNavigationParams; | 169 struct StartNavigationParams; |
| 168 struct StreamOverrideParameters; | 170 struct StreamOverrideParameters; |
| 169 | 171 |
| 170 namespace { | 172 namespace { |
| 171 class CreateFrameWidgetParams; | 173 class CreateFrameWidgetParams; |
| 172 } | 174 } |
| 173 | 175 |
| 174 class CONTENT_EXPORT RenderFrameImpl | 176 class CONTENT_EXPORT RenderFrameImpl |
| 175 : public RenderFrame, | 177 : public RenderFrame, |
| 176 NON_EXPORTED_BASE(mojom::Frame), | 178 NON_EXPORTED_BASE(mojom::Frame), |
| 179 NON_EXPORTED_BASE(mojom::HostZoom), |
| 177 NON_EXPORTED_BASE(public blink::WebFrameClient), | 180 NON_EXPORTED_BASE(public blink::WebFrameClient), |
| 178 NON_EXPORTED_BASE(public blink::WebFrameSerializerClient) { | 181 NON_EXPORTED_BASE(public blink::WebFrameSerializerClient) { |
| 179 public: | 182 public: |
| 180 // Creates a new RenderFrame as the main frame of |render_view|. | 183 // Creates a new RenderFrame as the main frame of |render_view|. |
| 181 static RenderFrameImpl* CreateMainFrame( | 184 static RenderFrameImpl* CreateMainFrame( |
| 182 RenderViewImpl* render_view, | 185 RenderViewImpl* render_view, |
| 183 int32_t routing_id, | 186 int32_t routing_id, |
| 184 int32_t widget_routing_id, | 187 int32_t widget_routing_id, |
| 185 bool hidden, | 188 bool hidden, |
| 186 const ScreenInfo& screen_info, | 189 const ScreenInfo& screen_info, |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 void AddMessageToConsole(ConsoleMessageLevel level, | 449 void AddMessageToConsole(ConsoleMessageLevel level, |
| 447 const std::string& message) override; | 450 const std::string& message) override; |
| 448 bool IsUsingLoFi() const override; | 451 bool IsUsingLoFi() const override; |
| 449 bool IsPasting() const override; | 452 bool IsPasting() const override; |
| 450 blink::WebPageVisibilityState GetVisibilityState() const override; | 453 blink::WebPageVisibilityState GetVisibilityState() const override; |
| 451 | 454 |
| 452 // mojom::Frame implementation: | 455 // mojom::Frame implementation: |
| 453 void GetInterfaceProvider( | 456 void GetInterfaceProvider( |
| 454 service_manager::mojom::InterfaceProviderRequest request) override; | 457 service_manager::mojom::InterfaceProviderRequest request) override; |
| 455 | 458 |
| 459 // mojom::HostZoom implementation: |
| 460 void SetHostZoomLevel(const GURL& url, double zoom_level) override; |
| 461 |
| 456 // blink::WebFrameClient implementation: | 462 // blink::WebFrameClient implementation: |
| 457 blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame, | 463 blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame, |
| 458 const blink::WebPluginParams& params) override; | 464 const blink::WebPluginParams& params) override; |
| 459 blink::WebMediaPlayer* createMediaPlayer( | 465 blink::WebMediaPlayer* createMediaPlayer( |
| 460 const blink::WebMediaPlayerSource& source, | 466 const blink::WebMediaPlayerSource& source, |
| 461 blink::WebMediaPlayerClient* client, | 467 blink::WebMediaPlayerClient* client, |
| 462 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, | 468 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, |
| 463 blink::WebContentDecryptionModule* initial_cdm, | 469 blink::WebContentDecryptionModule* initial_cdm, |
| 464 const blink::WebString& sink_id) override; | 470 const blink::WebString& sink_id) override; |
| 465 blink::WebApplicationCacheHost* createApplicationCacheHost( | 471 blink::WebApplicationCacheHost* createApplicationCacheHost( |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 friend class RenderFrameImplTest; | 716 friend class RenderFrameImplTest; |
| 711 friend class RenderFrameObserver; | 717 friend class RenderFrameObserver; |
| 712 friend class RenderAccessibilityImplTest; | 718 friend class RenderAccessibilityImplTest; |
| 713 friend class TestRenderFrame; | 719 friend class TestRenderFrame; |
| 714 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem); | 720 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem); |
| 715 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange); | 721 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange); |
| 716 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase); | 722 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase); |
| 717 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate); | 723 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate); |
| 718 FRIEND_TEST_ALL_PREFIXES(RenderAccessibilityImplTest, | 724 FRIEND_TEST_ALL_PREFIXES(RenderAccessibilityImplTest, |
| 719 AccessibilityMessagesQueueWhileSwappedOut); | 725 AccessibilityMessagesQueueWhileSwappedOut); |
| 726 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest, ZoomLimit); |
| 720 | 727 |
| 721 // A wrapper class used as the callback for JavaScript executed | 728 // A wrapper class used as the callback for JavaScript executed |
| 722 // in an isolated world. | 729 // in an isolated world. |
| 723 class JavaScriptIsolatedWorldRequest | 730 class JavaScriptIsolatedWorldRequest |
| 724 : public blink::WebScriptExecutionCallback { | 731 : public blink::WebScriptExecutionCallback { |
| 725 public: | 732 public: |
| 726 JavaScriptIsolatedWorldRequest( | 733 JavaScriptIsolatedWorldRequest( |
| 727 int id, | 734 int id, |
| 728 bool notify_result, | 735 bool notify_result, |
| 729 int routing_id, | 736 int routing_id, |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 | 1047 |
| 1041 media::CdmFactory* GetCdmFactory(); | 1048 media::CdmFactory* GetCdmFactory(); |
| 1042 media::DecoderFactory* GetDecoderFactory(); | 1049 media::DecoderFactory* GetDecoderFactory(); |
| 1043 | 1050 |
| 1044 void RegisterMojoInterfaces(); | 1051 void RegisterMojoInterfaces(); |
| 1045 | 1052 |
| 1046 // Connect to an interface provided by the service registry. | 1053 // Connect to an interface provided by the service registry. |
| 1047 template <typename Interface> | 1054 template <typename Interface> |
| 1048 void GetInterface(mojo::InterfaceRequest<Interface> request); | 1055 void GetInterface(mojo::InterfaceRequest<Interface> request); |
| 1049 | 1056 |
| 1057 void OnHostZoomClientRequest(mojom::HostZoomAssociatedRequest request); |
| 1058 |
| 1050 // Returns the media delegate for WebMediaPlayer usage. If | 1059 // Returns the media delegate for WebMediaPlayer usage. If |
| 1051 // |media_player_delegate_| is NULL, one is created. | 1060 // |media_player_delegate_| is NULL, one is created. |
| 1052 media::RendererWebMediaPlayerDelegate* GetWebMediaPlayerDelegate(); | 1061 media::RendererWebMediaPlayerDelegate* GetWebMediaPlayerDelegate(); |
| 1053 | 1062 |
| 1054 // Called to get the WebPlugin to handle find requests in the document. | 1063 // Called to get the WebPlugin to handle find requests in the document. |
| 1055 // Returns nullptr if there is no such WebPlugin. | 1064 // Returns nullptr if there is no such WebPlugin. |
| 1056 blink::WebPlugin* GetWebPluginForFind(); | 1065 blink::WebPlugin* GetWebPluginForFind(); |
| 1057 | 1066 |
| 1058 // Sends a reply to the current find operation handling if it was a | 1067 // Sends a reply to the current find operation handling if it was a |
| 1059 // synchronous find request. | 1068 // synchronous find request. |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 // Whether or not the focus is on a PPAPI plugin | 1314 // Whether or not the focus is on a PPAPI plugin |
| 1306 PepperPluginInstanceImpl* focused_pepper_plugin_; | 1315 PepperPluginInstanceImpl* focused_pepper_plugin_; |
| 1307 | 1316 |
| 1308 // The plugin instance that received the last mouse event. It is set to NULL | 1317 // The plugin instance that received the last mouse event. It is set to NULL |
| 1309 // if the last mouse event went to elements other than Pepper plugins. | 1318 // if the last mouse event went to elements other than Pepper plugins. |
| 1310 // |pepper_last_mouse_event_target_| is not owned by this class. We depend on | 1319 // |pepper_last_mouse_event_target_| is not owned by this class. We depend on |
| 1311 // the RenderFrameImpl to NULL it out when it destructs. | 1320 // the RenderFrameImpl to NULL it out when it destructs. |
| 1312 PepperPluginInstanceImpl* pepper_last_mouse_event_target_; | 1321 PepperPluginInstanceImpl* pepper_last_mouse_event_target_; |
| 1313 #endif | 1322 #endif |
| 1314 | 1323 |
| 1324 HostZoomLevels host_zoom_levels_; |
| 1325 |
| 1315 mojo::Binding<mojom::Frame> frame_binding_; | 1326 mojo::Binding<mojom::Frame> frame_binding_; |
| 1327 mojo::AssociatedBinding<mojom::HostZoom> host_zoom_binding_; |
| 1316 mojom::FrameHostPtr frame_host_; | 1328 mojom::FrameHostPtr frame_host_; |
| 1317 | 1329 |
| 1318 // Indicates whether |didAccessInitialDocument| was called. | 1330 // Indicates whether |didAccessInitialDocument| was called. |
| 1319 bool has_accessed_initial_document_; | 1331 bool has_accessed_initial_document_; |
| 1320 | 1332 |
| 1321 AssociatedInterfaceRegistryImpl associated_interfaces_; | 1333 AssociatedInterfaceRegistryImpl associated_interfaces_; |
| 1322 std::unique_ptr<AssociatedInterfaceProviderImpl> | 1334 std::unique_ptr<AssociatedInterfaceProviderImpl> |
| 1323 remote_associated_interfaces_; | 1335 remote_associated_interfaces_; |
| 1324 | 1336 |
| 1325 // TODO(dcheng): Remove these members. | 1337 // TODO(dcheng): Remove these members. |
| 1326 bool committed_first_load_ = false; | 1338 bool committed_first_load_ = false; |
| 1327 bool name_changed_before_first_commit_ = false; | 1339 bool name_changed_before_first_commit_ = false; |
| 1328 | 1340 |
| 1329 base::WeakPtrFactory<RenderFrameImpl> weak_factory_; | 1341 base::WeakPtrFactory<RenderFrameImpl> weak_factory_; |
| 1330 | 1342 |
| 1331 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); | 1343 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); |
| 1332 }; | 1344 }; |
| 1333 | 1345 |
| 1334 } // namespace content | 1346 } // namespace content |
| 1335 | 1347 |
| 1336 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ | 1348 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
| OLD | NEW |