| 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 <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/id_map.h" | 16 #include "base/id_map.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/linked_ptr.h" | 18 #include "base/memory/linked_ptr.h" |
| 19 #include "base/memory/scoped_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/common/navigation_params.h" |
| 27 #include "content/public/common/console_message_level.h" | 28 #include "content/public/common/console_message_level.h" |
| 28 #include "content/public/common/javascript_message_type.h" | 29 #include "content/public/common/javascript_message_type.h" |
| 29 #include "content/public/common/referrer.h" | 30 #include "content/public/common/referrer.h" |
| 31 #include "content/public/common/resource_response.h" |
| 30 #include "content/public/common/stop_find_action.h" | 32 #include "content/public/common/stop_find_action.h" |
| 31 #include "content/public/renderer/render_frame.h" | 33 #include "content/public/renderer/render_frame.h" |
| 32 #include "content/renderer/render_frame_proxy.h" | 34 #include "content/renderer/render_frame_proxy.h" |
| 33 #include "content/renderer/renderer_webcookiejar_impl.h" | 35 #include "content/renderer/renderer_webcookiejar_impl.h" |
| 34 #include "ipc/ipc_message.h" | 36 #include "ipc/ipc_message.h" |
| 35 #include "ipc/ipc_platform_file.h" | 37 #include "ipc/ipc_platform_file.h" |
| 36 #include "media/blink/webmediaplayer_delegate.h" | 38 #include "media/blink/webmediaplayer_delegate.h" |
| 37 #include "media/blink/webmediaplayer_params.h" | 39 #include "media/blink/webmediaplayer_params.h" |
| 38 #include "mojo/shell/public/interfaces/connector.mojom.h" | 40 #include "mojo/shell/public/interfaces/connector.mojom.h" |
| 39 #include "mojo/shell/public/interfaces/interface_provider.mojom.h" | 41 #include "mojo/shell/public/interfaces/interface_provider.mojom.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 class RendererMediaSessionManager; | 139 class RendererMediaSessionManager; |
| 138 class RendererPpapiHost; | 140 class RendererPpapiHost; |
| 139 class RendererSurfaceViewManager; | 141 class RendererSurfaceViewManager; |
| 140 class RenderFrameObserver; | 142 class RenderFrameObserver; |
| 141 class RenderViewImpl; | 143 class RenderViewImpl; |
| 142 class RenderWidget; | 144 class RenderWidget; |
| 143 class RenderWidgetFullscreenPepper; | 145 class RenderWidgetFullscreenPepper; |
| 144 class ScreenOrientationDispatcher; | 146 class ScreenOrientationDispatcher; |
| 145 class UserMediaClientImpl; | 147 class UserMediaClientImpl; |
| 146 class WakeLockDispatcher; | 148 class WakeLockDispatcher; |
| 147 struct CommonNavigationParams; | |
| 148 struct CustomContextMenuContext; | 149 struct CustomContextMenuContext; |
| 149 struct FrameReplicationState; | 150 struct FrameReplicationState; |
| 150 struct NavigationParams; | 151 struct NavigationParams; |
| 151 struct RequestNavigationParams; | |
| 152 struct ResourceResponseHead; | |
| 153 struct StartNavigationParams; | 152 struct StartNavigationParams; |
| 154 struct StreamOverrideParameters; | 153 struct StreamOverrideParameters; |
| 155 class VRDispatcher; | 154 class VRDispatcher; |
| 155 class RenderThreadImpl; |
| 156 | 156 |
| 157 class CONTENT_EXPORT RenderFrameImpl | 157 class CONTENT_EXPORT RenderFrameImpl |
| 158 : public RenderFrame, | 158 : public RenderFrame, |
| 159 NON_EXPORTED_BASE(public blink::WebFrameClient), | 159 NON_EXPORTED_BASE(public blink::WebFrameClient), |
| 160 NON_EXPORTED_BASE(public blink::WebFrameSerializerClient) { | 160 NON_EXPORTED_BASE(public blink::WebFrameSerializerClient) { |
| 161 public: | 161 public: |
| 162 // Creates a new RenderFrame as the main frame of |render_view|. | 162 // Creates a new RenderFrame as the main frame of |render_view|. |
| 163 static RenderFrameImpl* CreateMainFrame( | 163 static RenderFrameImpl* CreateMainFrame( |
| 164 RenderViewImpl* render_view, | 164 RenderViewImpl* render_view, |
| 165 int32_t routing_id, | 165 int32_t routing_id, |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 | 644 |
| 645 // Sends the current frame's navigation state to the browser. | 645 // Sends the current frame's navigation state to the browser. |
| 646 void SendUpdateState(); | 646 void SendUpdateState(); |
| 647 | 647 |
| 648 // Creates a MojoBindingsController if Mojo bindings have been enabled for | 648 // Creates a MojoBindingsController if Mojo bindings have been enabled for |
| 649 // this frame. For WebUI, this allows the page to communicate with the browser | 649 // this frame. For WebUI, this allows the page to communicate with the browser |
| 650 // process; for layout tests, this allows the test to mock out services at | 650 // process; for layout tests, this allows the test to mock out services at |
| 651 // the Mojo IPC layer. | 651 // the Mojo IPC layer. |
| 652 void MaybeEnableMojoBindings(); | 652 void MaybeEnableMojoBindings(); |
| 653 | 653 |
| 654 void ReceiveNavigationDataPipeConsumerHandle( |
| 655 mojo::ScopedDataPipeConsumerHandle data_consumer_handle, |
| 656 int browser_request_id, |
| 657 int32_t handle_commit_id); |
| 658 |
| 654 protected: | 659 protected: |
| 655 explicit RenderFrameImpl(const CreateParams& params); | 660 explicit RenderFrameImpl(const CreateParams& params); |
| 656 | 661 |
| 657 private: | 662 private: |
| 658 friend class RenderFrameImplTest; | 663 friend class RenderFrameImplTest; |
| 659 friend class RenderFrameObserver; | 664 friend class RenderFrameObserver; |
| 660 friend class RendererAccessibilityTest; | 665 friend class RendererAccessibilityTest; |
| 661 friend class TestRenderFrame; | 666 friend class TestRenderFrame; |
| 662 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem); | 667 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem); |
| 663 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange); | 668 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 void OnSetFrameOwnerProperties( | 780 void OnSetFrameOwnerProperties( |
| 776 const blink::WebFrameOwnerProperties& frame_owner_properties); | 781 const blink::WebFrameOwnerProperties& frame_owner_properties); |
| 777 void OnAdvanceFocus(blink::WebFocusType type, int32_t source_routing_id); | 782 void OnAdvanceFocus(blink::WebFocusType type, int32_t source_routing_id); |
| 778 void OnSetFocusedFrame(); | 783 void OnSetFocusedFrame(); |
| 779 void OnTextTrackSettingsChanged( | 784 void OnTextTrackSettingsChanged( |
| 780 const FrameMsg_TextTrackSettings_Params& params); | 785 const FrameMsg_TextTrackSettings_Params& params); |
| 781 void OnPostMessageEvent(const FrameMsg_PostMessage_Params& params); | 786 void OnPostMessageEvent(const FrameMsg_PostMessage_Params& params); |
| 782 void OnCommitNavigation(const ResourceResponseHead& response, | 787 void OnCommitNavigation(const ResourceResponseHead& response, |
| 783 const GURL& stream_url, | 788 const GURL& stream_url, |
| 784 const CommonNavigationParams& common_params, | 789 const CommonNavigationParams& common_params, |
| 785 const RequestNavigationParams& request_params); | 790 const RequestNavigationParams& request_params, |
| 791 int32_t navigation_commit_id); |
| 786 void OnFailedNavigation(const CommonNavigationParams& common_params, | 792 void OnFailedNavigation(const CommonNavigationParams& common_params, |
| 787 const RequestNavigationParams& request_params, | 793 const RequestNavigationParams& request_params, |
| 788 bool has_stale_copy_in_cache, | 794 bool has_stale_copy_in_cache, |
| 789 int error_code); | 795 int error_code); |
| 790 void OnGetSavableResourceLinks(); | 796 void OnGetSavableResourceLinks(); |
| 791 void OnGetSerializedHtmlWithLocalLinks( | 797 void OnGetSerializedHtmlWithLocalLinks( |
| 792 const std::map<GURL, base::FilePath>& url_to_local_path, | 798 const std::map<GURL, base::FilePath>& url_to_local_path, |
| 793 const std::map<int, base::FilePath>& frame_routing_id_to_local_path); | 799 const std::map<int, base::FilePath>& frame_routing_id_to_local_path); |
| 794 void OnSerializeAsMHTML(const FrameMsg_SerializeAsMHTML_Params& params); | 800 void OnSerializeAsMHTML(const FrameMsg_SerializeAsMHTML_Params& params); |
| 795 void OnFind(int request_id, | 801 void OnFind(int request_id, |
| 796 const base::string16& search_text, | 802 const base::string16& search_text, |
| 797 const blink::WebFindOptions& options); | 803 const blink::WebFindOptions& options); |
| 798 void OnStopFinding(StopFindAction action); | 804 void OnStopFinding(StopFindAction action); |
| 799 #if defined(OS_ANDROID) | 805 #if defined(OS_ANDROID) |
| 800 void OnActivateNearestFindResult(int request_id, float x, float y); | 806 void OnActivateNearestFindResult(int request_id, float x, float y); |
| 801 void OnFindMatchRects(int current_version); | 807 void OnFindMatchRects(int current_version); |
| 802 void OnSelectPopupMenuItems(bool canceled, | 808 void OnSelectPopupMenuItems(bool canceled, |
| 803 const std::vector<int>& selected_indices); | 809 const std::vector<int>& selected_indices); |
| 804 #elif defined(OS_MACOSX) | 810 #elif defined(OS_MACOSX) |
| 805 void OnSelectPopupMenuItem(int selected_index); | 811 void OnSelectPopupMenuItem(int selected_index); |
| 806 void OnCopyToFindPboard(); | 812 void OnCopyToFindPboard(); |
| 807 #endif | 813 #endif |
| 808 | 814 |
| 815 void NavigateIfIPCSynched(bool no_sync_needed); |
| 816 |
| 809 // Requests that the browser process navigates to |url|. If | 817 // Requests that the browser process navigates to |url|. If |
| 810 // |is_history_navigation_in_new_child| is true, the browser process should | 818 // |is_history_navigation_in_new_child| is true, the browser process should |
| 811 // look for a matching FrameNavigationEntry in the last committed entry to use | 819 // look for a matching FrameNavigationEntry in the last committed entry to use |
| 812 // instead of |url|. | 820 // instead of |url|. |
| 813 void OpenURL(const GURL& url, | 821 void OpenURL(const GURL& url, |
| 814 const Referrer& referrer, | 822 const Referrer& referrer, |
| 815 blink::WebNavigationPolicy policy, | 823 blink::WebNavigationPolicy policy, |
| 816 bool should_replace_current_entry, | 824 bool should_replace_current_entry, |
| 817 bool is_history_navigation_in_new_child); | 825 bool is_history_navigation_in_new_child); |
| 818 | 826 |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 // Manages play, pause notifications for WebMediaPlayer implementations; its | 1198 // Manages play, pause notifications for WebMediaPlayer implementations; its |
| 1191 // lifetime is tied to the RenderFrame via the RenderFrameObserver interface. | 1199 // lifetime is tied to the RenderFrame via the RenderFrameObserver interface. |
| 1192 media::RendererWebMediaPlayerDelegate* media_player_delegate_; | 1200 media::RendererWebMediaPlayerDelegate* media_player_delegate_; |
| 1193 | 1201 |
| 1194 // Whether or not this RenderFrame is using Lo-Fi mode. | 1202 // Whether or not this RenderFrame is using Lo-Fi mode. |
| 1195 bool is_using_lofi_; | 1203 bool is_using_lofi_; |
| 1196 | 1204 |
| 1197 // Whether or not this RenderFrame is currently pasting. | 1205 // Whether or not this RenderFrame is currently pasting. |
| 1198 bool is_pasting_; | 1206 bool is_pasting_; |
| 1199 | 1207 |
| 1208 // TODO(carlosk): if this hack should become a thing, all of this should be |
| 1209 // moved into a struct that holds "ongoing navigation commit data". Maybe |
| 1210 // there's a way to reuse pending_navigation_params_? |
| 1211 mojo::ScopedDataPipeConsumerHandle latest_handle_; |
| 1212 int latest_browser_request_id_; |
| 1213 int32_t latest_handle_commit_id_; |
| 1214 RenderThreadImpl* handle_render_thread_; |
| 1215 int32_t latest_navigation_commit_id_; |
| 1216 RenderThreadImpl* navigation_render_thread_; |
| 1217 ResourceResponseHead navigation_response_; |
| 1218 GURL navigation_stream_url_; |
| 1219 CommonNavigationParams navigation_common_params_; |
| 1220 RequestNavigationParams navigation_request_params_; |
| 1221 |
| 1200 #if defined(ENABLE_WEBVR) | 1222 #if defined(ENABLE_WEBVR) |
| 1201 // The VR dispatcher attached to the frame, lazily initialized. | 1223 // The VR dispatcher attached to the frame, lazily initialized. |
| 1202 scoped_ptr<VRDispatcher> vr_dispatcher_; | 1224 scoped_ptr<VRDispatcher> vr_dispatcher_; |
| 1203 #endif | 1225 #endif |
| 1204 | 1226 |
| 1205 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 1227 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| 1206 // The external popup for the currently showing select popup. | 1228 // The external popup for the currently showing select popup. |
| 1207 scoped_ptr<ExternalPopupMenu> external_popup_menu_; | 1229 scoped_ptr<ExternalPopupMenu> external_popup_menu_; |
| 1208 #endif | 1230 #endif |
| 1209 | 1231 |
| 1210 base::WeakPtrFactory<RenderFrameImpl> weak_factory_; | 1232 base::WeakPtrFactory<RenderFrameImpl> weak_factory_; |
| 1211 | 1233 |
| 1212 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); | 1234 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); |
| 1213 }; | 1235 }; |
| 1214 | 1236 |
| 1215 } // namespace content | 1237 } // namespace content |
| 1216 | 1238 |
| 1217 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ | 1239 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
| OLD | NEW |