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 <deque> | 11 #include <deque> |
12 #include <map> | 12 #include <map> |
13 #include <memory> | 13 #include <memory> |
14 #include <set> | 14 #include <set> |
15 #include <string> | 15 #include <string> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
| 18 #include "base/callback.h" |
18 #include "base/files/file_path.h" | 19 #include "base/files/file_path.h" |
19 #include "base/gtest_prod_util.h" | 20 #include "base/gtest_prod_util.h" |
20 #include "base/id_map.h" | 21 #include "base/id_map.h" |
21 #include "base/macros.h" | 22 #include "base/macros.h" |
22 #include "base/memory/linked_ptr.h" | 23 #include "base/memory/linked_ptr.h" |
23 #include "base/memory/ref_counted.h" | 24 #include "base/memory/ref_counted.h" |
24 #include "base/memory/weak_ptr.h" | 25 #include "base/memory/weak_ptr.h" |
25 #include "base/observer_list.h" | 26 #include "base/observer_list.h" |
| 27 #include "base/optional.h" |
26 #include "base/process/process_handle.h" | 28 #include "base/process/process_handle.h" |
27 #include "base/single_thread_task_runner.h" | 29 #include "base/single_thread_task_runner.h" |
| 30 #include "base/unguessable_token.h" |
28 #include "build/build_config.h" | 31 #include "build/build_config.h" |
29 #include "content/common/accessibility_mode.h" | 32 #include "content/common/accessibility_mode.h" |
30 #include "content/common/associated_interface_registry_impl.h" | 33 #include "content/common/associated_interface_registry_impl.h" |
31 #include "content/common/download/mhtml_save_status.h" | 34 #include "content/common/download/mhtml_save_status.h" |
32 #include "content/common/features.h" | 35 #include "content/common/features.h" |
33 #include "content/common/frame.mojom.h" | 36 #include "content/common/frame.mojom.h" |
34 #include "content/common/frame_message_enums.h" | 37 #include "content/common/frame_message_enums.h" |
35 #include "content/common/host_zoom.mojom.h" | 38 #include "content/common/host_zoom.mojom.h" |
36 #include "content/common/renderer.mojom.h" | 39 #include "content/common/renderer.mojom.h" |
37 #include "content/public/common/console_message_level.h" | 40 #include "content/public/common/console_message_level.h" |
38 #include "content/public/common/javascript_dialog_type.h" | 41 #include "content/public/common/javascript_dialog_type.h" |
39 #include "content/public/common/previews_state.h" | 42 #include "content/public/common/previews_state.h" |
40 #include "content/public/common/referrer.h" | 43 #include "content/public/common/referrer.h" |
41 #include "content/public/common/request_context_type.h" | 44 #include "content/public/common/request_context_type.h" |
42 #include "content/public/common/stop_find_action.h" | 45 #include "content/public/common/stop_find_action.h" |
43 #include "content/public/renderer/render_frame.h" | 46 #include "content/public/renderer/render_frame.h" |
44 #include "content/renderer/frame_blame_context.h" | 47 #include "content/renderer/frame_blame_context.h" |
45 #include "content/renderer/mojo/blink_interface_provider_impl.h" | 48 #include "content/renderer/mojo/blink_interface_provider_impl.h" |
46 #include "content/renderer/renderer_webcookiejar_impl.h" | 49 #include "content/renderer/renderer_webcookiejar_impl.h" |
47 #include "content/renderer/unique_name_helper.h" | 50 #include "content/renderer/unique_name_helper.h" |
48 #include "ipc/ipc_message.h" | 51 #include "ipc/ipc_message.h" |
49 #include "ipc/ipc_platform_file.h" | 52 #include "ipc/ipc_platform_file.h" |
| 53 #if defined(OS_ANDROID) |
| 54 #include "media/base/android/android_overlay.h" |
| 55 #endif |
50 #include "media/blink/webmediaplayer_delegate.h" | 56 #include "media/blink/webmediaplayer_delegate.h" |
51 #include "media/blink/webmediaplayer_params.h" | 57 #include "media/blink/webmediaplayer_params.h" |
52 #include "media/mojo/interfaces/remoting.mojom.h" | 58 #include "media/mojo/interfaces/remoting.mojom.h" |
53 #include "mojo/public/cpp/bindings/associated_binding.h" | 59 #include "mojo/public/cpp/bindings/associated_binding.h" |
54 #include "mojo/public/cpp/bindings/binding.h" | 60 #include "mojo/public/cpp/bindings/binding.h" |
55 #include "ppapi/features/features.h" | 61 #include "ppapi/features/features.h" |
56 #include "services/service_manager/public/cpp/service_info.h" | 62 #include "services/service_manager/public/cpp/service_info.h" |
57 #include "services/service_manager/public/interfaces/connector.mojom.h" | 63 #include "services/service_manager/public/interfaces/connector.mojom.h" |
58 #include "services/service_manager/public/interfaces/interface_provider.mojom.h" | 64 #include "services/service_manager/public/interfaces/interface_provider.mojom.h" |
59 #include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h" | 65 #include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h" |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 friend class RenderFrameObserver; | 763 friend class RenderFrameObserver; |
758 friend class RenderAccessibilityImplTest; | 764 friend class RenderAccessibilityImplTest; |
759 friend class TestRenderFrame; | 765 friend class TestRenderFrame; |
760 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem); | 766 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem); |
761 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange); | 767 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange); |
762 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase); | 768 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase); |
763 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate); | 769 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate); |
764 FRIEND_TEST_ALL_PREFIXES(RenderAccessibilityImplTest, | 770 FRIEND_TEST_ALL_PREFIXES(RenderAccessibilityImplTest, |
765 AccessibilityMessagesQueueWhileSwappedOut); | 771 AccessibilityMessagesQueueWhileSwappedOut); |
766 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest, ZoomLimit); | 772 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest, ZoomLimit); |
| 773 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest, |
| 774 TestOverlayRoutingTokenSendsLater); |
| 775 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest, |
| 776 TestOverlayRoutingTokenSendsNow); |
767 | 777 |
768 // A wrapper class used as the callback for JavaScript executed | 778 // A wrapper class used as the callback for JavaScript executed |
769 // in an isolated world. | 779 // in an isolated world. |
770 class JavaScriptIsolatedWorldRequest | 780 class JavaScriptIsolatedWorldRequest |
771 : public blink::WebScriptExecutionCallback { | 781 : public blink::WebScriptExecutionCallback { |
772 public: | 782 public: |
773 JavaScriptIsolatedWorldRequest( | 783 JavaScriptIsolatedWorldRequest( |
774 int id, | 784 int id, |
775 bool notify_result, | 785 bool notify_result, |
776 int routing_id, | 786 int routing_id, |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 void OnSuppressFurtherDialogs(); | 927 void OnSuppressFurtherDialogs(); |
918 void OnFileChooserResponse( | 928 void OnFileChooserResponse( |
919 const std::vector<content::FileChooserFileInfo>& files); | 929 const std::vector<content::FileChooserFileInfo>& files); |
920 void OnClearFocusedElement(); | 930 void OnClearFocusedElement(); |
921 void OnBlinkFeatureUsageReport(const std::set<int>& features); | 931 void OnBlinkFeatureUsageReport(const std::set<int>& features); |
922 void OnMixedContentFound(const FrameMsg_MixedContentFound_Params& params); | 932 void OnMixedContentFound(const FrameMsg_MixedContentFound_Params& params); |
923 #if defined(OS_ANDROID) | 933 #if defined(OS_ANDROID) |
924 void OnActivateNearestFindResult(int request_id, float x, float y); | 934 void OnActivateNearestFindResult(int request_id, float x, float y); |
925 void OnGetNearestFindResult(int request_id, float x, float y); | 935 void OnGetNearestFindResult(int request_id, float x, float y); |
926 void OnFindMatchRects(int current_version); | 936 void OnFindMatchRects(int current_version); |
| 937 void OnSetOverlayRoutingToken(uint64_t high, uint64_t low); |
927 #endif | 938 #endif |
928 | 939 |
929 #if BUILDFLAG(USE_EXTERNAL_POPUP_MENU) | 940 #if BUILDFLAG(USE_EXTERNAL_POPUP_MENU) |
930 #if defined(OS_MACOSX) | 941 #if defined(OS_MACOSX) |
931 void OnSelectPopupMenuItem(int selected_index); | 942 void OnSelectPopupMenuItem(int selected_index); |
932 #else | 943 #else |
933 void OnSelectPopupMenuItems(bool canceled, | 944 void OnSelectPopupMenuItems(bool canceled, |
934 const std::vector<int>& selected_indices); | 945 const std::vector<int>& selected_indices); |
935 #endif | 946 #endif |
936 #endif | 947 #endif |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 // Sends a reply to the current find operation handling if it was a | 1123 // Sends a reply to the current find operation handling if it was a |
1113 // synchronous find request. | 1124 // synchronous find request. |
1114 void SendFindReply(int request_id, | 1125 void SendFindReply(int request_id, |
1115 int match_count, | 1126 int match_count, |
1116 int ordinal, | 1127 int ordinal, |
1117 const blink::WebRect& selection_rect, | 1128 const blink::WebRect& selection_rect, |
1118 bool final_status_update); | 1129 bool final_status_update); |
1119 | 1130 |
1120 void InitializeBlameContext(RenderFrameImpl* parent_frame); | 1131 void InitializeBlameContext(RenderFrameImpl* parent_frame); |
1121 | 1132 |
| 1133 #if defined(OS_ANDROID) |
| 1134 // Send |callback| our AndroidOverlay routing token when it arrives. We may |
| 1135 // call |callback| before returning. |
| 1136 void GetOverlayRoutingToken(const media::RoutingTokenCallback& callback); |
| 1137 |
| 1138 // Ask the host to send our AndroidOverlay routing token to us. |
| 1139 void RequestOverlayRoutingTokenFromHost(); |
| 1140 #endif |
| 1141 |
1122 // Stores the WebLocalFrame we are associated with. This is null from the | 1142 // Stores the WebLocalFrame we are associated with. This is null from the |
1123 // constructor until BindToWebFrame is called, and it is null after | 1143 // constructor until BindToWebFrame is called, and it is null after |
1124 // frameDetached is called until destruction (which is asynchronous in the | 1144 // frameDetached is called until destruction (which is asynchronous in the |
1125 // case of the main frame, but not subframes). | 1145 // case of the main frame, but not subframes). |
1126 blink::WebLocalFrame* frame_; | 1146 blink::WebLocalFrame* frame_; |
1127 | 1147 |
1128 // Boolean value indicating whether this RenderFrameImpl object is for the | 1148 // Boolean value indicating whether this RenderFrameImpl object is for the |
1129 // main frame or not. It remains accurate during destruction, even when | 1149 // main frame or not. It remains accurate during destruction, even when |
1130 // |frame_| has been invalidated. | 1150 // |frame_| has been invalidated. |
1131 bool is_main_frame_; | 1151 bool is_main_frame_; |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1415 blink::WebSourceLocation source_location; | 1435 blink::WebSourceLocation source_location; |
1416 | 1436 |
1417 PendingNavigationInfo(const NavigationPolicyInfo& info); | 1437 PendingNavigationInfo(const NavigationPolicyInfo& info); |
1418 }; | 1438 }; |
1419 | 1439 |
1420 // PlzNavigate: Contains information about a pending navigation to be sent to | 1440 // PlzNavigate: Contains information about a pending navigation to be sent to |
1421 // the browser. This state is allocated in decidePolicyForNavigation() and | 1441 // the browser. This state is allocated in decidePolicyForNavigation() and |
1422 // is used and released in didStartProvisionalLoad(). | 1442 // is used and released in didStartProvisionalLoad(). |
1423 std::unique_ptr<PendingNavigationInfo> pending_navigation_info_; | 1443 std::unique_ptr<PendingNavigationInfo> pending_navigation_info_; |
1424 | 1444 |
| 1445 #if defined(OS_ANDROID) |
| 1446 // AndroidOverlay routing token from the browser, if we have one yet. |
| 1447 base::Optional<base::UnguessableToken> overlay_routing_token_; |
| 1448 |
| 1449 // Callbacks that we should call when we get a routing token. |
| 1450 std::vector<media::RoutingTokenCallback> pending_routing_token_callbacks_; |
| 1451 #endif |
| 1452 |
1425 base::WeakPtrFactory<RenderFrameImpl> weak_factory_; | 1453 base::WeakPtrFactory<RenderFrameImpl> weak_factory_; |
1426 | 1454 |
1427 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); | 1455 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); |
1428 }; | 1456 }; |
1429 | 1457 |
1430 } // namespace content | 1458 } // namespace content |
1431 | 1459 |
1432 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ | 1460 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
OLD | NEW |