OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <functional> | 10 #include <functional> |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 int32_t route_id, | 505 int32_t route_id, |
506 int32_t main_frame_route_id, | 506 int32_t main_frame_route_id, |
507 int32_t main_frame_widget_route_id, | 507 int32_t main_frame_widget_route_id, |
508 const ViewHostMsg_CreateWindow_Params& params, | 508 const ViewHostMsg_CreateWindow_Params& params, |
509 SessionStorageNamespace* session_storage_namespace) override; | 509 SessionStorageNamespace* session_storage_namespace) override; |
510 void CreateNewWidget(int32_t render_process_id, | 510 void CreateNewWidget(int32_t render_process_id, |
511 int32_t route_id, | 511 int32_t route_id, |
512 blink::WebPopupType popup_type) override; | 512 blink::WebPopupType popup_type) override; |
513 void CreateNewFullscreenWidget(int32_t render_process_id, | 513 void CreateNewFullscreenWidget(int32_t render_process_id, |
514 int32_t route_id) override; | 514 int32_t route_id) override; |
515 void ShowCreatedWindow(int route_id, | 515 void ShowCreatedWindow(int process_id, |
| 516 int route_id, |
516 WindowOpenDisposition disposition, | 517 WindowOpenDisposition disposition, |
517 const gfx::Rect& initial_rect, | 518 const gfx::Rect& initial_rect, |
518 bool user_gesture) override; | 519 bool user_gesture) override; |
519 void ShowCreatedWidget(int route_id, const gfx::Rect& initial_rect) override; | 520 void ShowCreatedWidget(int process_id, |
520 void ShowCreatedFullscreenWidget(int route_id) override; | 521 int route_id, |
| 522 const gfx::Rect& initial_rect) override; |
| 523 void ShowCreatedFullscreenWidget(int process_id, int route_id) override; |
521 void RequestMediaAccessPermission( | 524 void RequestMediaAccessPermission( |
522 const MediaStreamRequest& request, | 525 const MediaStreamRequest& request, |
523 const MediaResponseCallback& callback) override; | 526 const MediaResponseCallback& callback) override; |
524 bool CheckMediaAccessPermission(const GURL& security_origin, | 527 bool CheckMediaAccessPermission(const GURL& security_origin, |
525 MediaStreamType type) override; | 528 MediaStreamType type) override; |
526 SessionStorageNamespace* GetSessionStorageNamespace( | 529 SessionStorageNamespace* GetSessionStorageNamespace( |
527 SiteInstance* instance) override; | 530 SiteInstance* instance) override; |
528 SessionStorageNamespaceMap GetSessionStorageNamespaceMap() override; | 531 SessionStorageNamespaceMap GetSessionStorageNamespaceMap() override; |
529 FrameTree* GetFrameTree() override; | 532 FrameTree* GetFrameTree() override; |
530 void SetIsVirtualKeyboardRequested(bool requested) override; | 533 void SetIsVirtualKeyboardRequested(bool requested) override; |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, | 775 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
773 LoadResourceFromMemoryCacheWithBadSecurityInfo); | 776 LoadResourceFromMemoryCacheWithBadSecurityInfo); |
774 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, | 777 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
775 LoadResourceFromMemoryCacheWithEmptySecurityInfo); | 778 LoadResourceFromMemoryCacheWithEmptySecurityInfo); |
776 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, | 779 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
777 ResetJavaScriptDialogOnUserNavigate); | 780 ResetJavaScriptDialogOnUserNavigate); |
778 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); | 781 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); |
779 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); | 782 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); |
780 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, PageDoesBackAndReload); | 783 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, PageDoesBackAndReload); |
781 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrossSiteIframe); | 784 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrossSiteIframe); |
| 785 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, |
| 786 TwoSubframesCreatePopupsSimultaneously); |
| 787 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, |
| 788 TwoSubframesCreatePopupMenuWidgetsSimultaneously); |
782 FRIEND_TEST_ALL_PREFIXES(SitePerProcessAccessibilityBrowserTest, | 789 FRIEND_TEST_ALL_PREFIXES(SitePerProcessAccessibilityBrowserTest, |
783 CrossSiteIframeAccessibility); | 790 CrossSiteIframeAccessibility); |
784 FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, | 791 FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, |
785 JavaScriptDialogsInMainAndSubframes); | 792 JavaScriptDialogsInMainAndSubframes); |
786 | 793 |
787 // So |find_request_manager_| can be accessed for testing. | 794 // So |find_request_manager_| can be accessed for testing. |
788 friend class FindRequestManagerTest; | 795 friend class FindRequestManagerTest; |
789 | 796 |
790 // So InterstitialPageImpl can access SetIsLoading. | 797 // So InterstitialPageImpl can access SetIsLoading. |
791 friend class InterstitialPageImpl; | 798 friend class InterstitialPageImpl; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 bool UpdateTitleForEntry(NavigationEntryImpl* entry, | 997 bool UpdateTitleForEntry(NavigationEntryImpl* entry, |
991 const base::string16& title); | 998 const base::string16& title); |
992 | 999 |
993 // Helper for CreateNewWidget/CreateNewFullscreenWidget. | 1000 // Helper for CreateNewWidget/CreateNewFullscreenWidget. |
994 void CreateNewWidget(int32_t render_process_id, | 1001 void CreateNewWidget(int32_t render_process_id, |
995 int32_t route_id, | 1002 int32_t route_id, |
996 bool is_fullscreen, | 1003 bool is_fullscreen, |
997 blink::WebPopupType popup_type); | 1004 blink::WebPopupType popup_type); |
998 | 1005 |
999 // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget. | 1006 // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget. |
1000 void ShowCreatedWidget(int route_id, | 1007 void ShowCreatedWidget(int process_id, |
| 1008 int route_id, |
1001 bool is_fullscreen, | 1009 bool is_fullscreen, |
1002 const gfx::Rect& initial_rect); | 1010 const gfx::Rect& initial_rect); |
1003 | 1011 |
1004 // Finds the new RenderWidgetHost and returns it. Note that this can only be | 1012 // Finds the new RenderWidgetHost and returns it. Note that this can only be |
1005 // called once as this call also removes it from the internal map. | 1013 // called once as this call also removes it from the internal map. |
1006 RenderWidgetHostView* GetCreatedWidget(int route_id); | 1014 RenderWidgetHostView* GetCreatedWidget(int process_id, int route_id); |
1007 | 1015 |
1008 // Finds the new WebContentsImpl by route_id, initializes it for | 1016 // Finds the new WebContentsImpl by route_id, initializes it for |
1009 // renderer-initiated creation, and returns it. Note that this can only be | 1017 // renderer-initiated creation, and returns it. Note that this can only be |
1010 // called once as this call also removes it from the internal map. | 1018 // called once as this call also removes it from the internal map. |
1011 WebContentsImpl* GetCreatedWindow(int route_id); | 1019 WebContentsImpl* GetCreatedWindow(int process_id, int route_id); |
1012 | 1020 |
1013 // Sends a Page message IPC. | 1021 // Sends a Page message IPC. |
1014 void SendPageMessage(IPC::Message* msg); | 1022 void SendPageMessage(IPC::Message* msg); |
1015 | 1023 |
1016 // Tracking loading progress ------------------------------------------------- | 1024 // Tracking loading progress ------------------------------------------------- |
1017 | 1025 |
1018 // Resets the tracking state of the current load progress. | 1026 // Resets the tracking state of the current load progress. |
1019 void ResetLoadProgressState(); | 1027 void ResetLoadProgressState(); |
1020 | 1028 |
1021 // Notifies the delegate that the load progress was updated. | 1029 // Notifies the delegate that the load progress was updated. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 | 1092 |
1085 // The corresponding view. | 1093 // The corresponding view. |
1086 std::unique_ptr<WebContentsView> view_; | 1094 std::unique_ptr<WebContentsView> view_; |
1087 | 1095 |
1088 // The view of the RVHD. Usually this is our WebContentsView implementation, | 1096 // The view of the RVHD. Usually this is our WebContentsView implementation, |
1089 // but if an embedder uses a different WebContentsView, they'll need to | 1097 // but if an embedder uses a different WebContentsView, they'll need to |
1090 // provide this. | 1098 // provide this. |
1091 RenderViewHostDelegateView* render_view_host_delegate_view_; | 1099 RenderViewHostDelegateView* render_view_host_delegate_view_; |
1092 | 1100 |
1093 // Tracks created WebContentsImpl objects that have not been shown yet. They | 1101 // Tracks created WebContentsImpl objects that have not been shown yet. They |
1094 // are identified by the route ID passed to CreateNewWindow. | 1102 // are identified by the process ID and routing ID passed to CreateNewWindow. |
1095 typedef std::map<int, WebContentsImpl*> PendingContents; | 1103 typedef std::pair<int, int> ProcessRoutingIdPair; |
1096 PendingContents pending_contents_; | 1104 std::map<ProcessRoutingIdPair, WebContentsImpl*> pending_contents_; |
1097 | 1105 |
1098 // These maps hold on to the widgets that we created on behalf of the renderer | 1106 // This map holds widgets that were created on behalf of the renderer but |
1099 // that haven't shown yet. | 1107 // haven't been shown yet. |
1100 typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews; | 1108 std::map<ProcessRoutingIdPair, RenderWidgetHostView*> pending_widget_views_; |
1101 PendingWidgetViews pending_widget_views_; | |
1102 | 1109 |
1103 typedef std::map<WebContentsImpl*, DestructionObserver*> DestructionObservers; | 1110 typedef std::map<WebContentsImpl*, DestructionObserver*> DestructionObservers; |
1104 DestructionObservers destruction_observers_; | 1111 DestructionObservers destruction_observers_; |
1105 | 1112 |
1106 // A list of observers notified when page state changes. Weak references. | 1113 // A list of observers notified when page state changes. Weak references. |
1107 // This MUST be listed above frame_tree_ since at destruction time the | 1114 // This MUST be listed above frame_tree_ since at destruction time the |
1108 // latter might cause RenderViewHost's destructor to call us and we might use | 1115 // latter might cause RenderViewHost's destructor to call us and we might use |
1109 // the observer list then. | 1116 // the observer list then. |
1110 base::ObserverList<WebContentsObserver> observers_; | 1117 base::ObserverList<WebContentsObserver> observers_; |
1111 | 1118 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1394 // Adds/removes a callback called on creation of each new WebContents. | 1401 // Adds/removes a callback called on creation of each new WebContents. |
1395 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); | 1402 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); |
1396 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); | 1403 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); |
1397 | 1404 |
1398 DISALLOW_COPY_AND_ASSIGN(FriendZone); | 1405 DISALLOW_COPY_AND_ASSIGN(FriendZone); |
1399 }; | 1406 }; |
1400 | 1407 |
1401 } // namespace content | 1408 } // namespace content |
1402 | 1409 |
1403 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1410 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
OLD | NEW |