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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 #include "ui/gfx/geometry/rect_f.h" | 49 #include "ui/gfx/geometry/rect_f.h" |
50 #include "ui/gfx/geometry/size.h" | 50 #include "ui/gfx/geometry/size.h" |
51 | 51 |
52 struct ViewHostMsg_DateTimeDialogValue_Params; | 52 struct ViewHostMsg_DateTimeDialogValue_Params; |
53 | 53 |
54 namespace content { | 54 namespace content { |
55 class BrowserPluginEmbedder; | 55 class BrowserPluginEmbedder; |
56 class BrowserPluginGuest; | 56 class BrowserPluginGuest; |
57 class DateTimeChooserAndroid; | 57 class DateTimeChooserAndroid; |
58 class DownloadItem; | 58 class DownloadItem; |
59 class FindRequestManager; | |
59 class GeolocationServiceContext; | 60 class GeolocationServiceContext; |
60 class InterstitialPageImpl; | 61 class InterstitialPageImpl; |
61 class JavaScriptDialogManager; | 62 class JavaScriptDialogManager; |
62 class LoaderIOThreadNotifier; | 63 class LoaderIOThreadNotifier; |
63 class ManifestManagerHost; | 64 class ManifestManagerHost; |
64 class MediaWebContentsObserver; | 65 class MediaWebContentsObserver; |
65 class PluginContentOriginWhitelist; | 66 class PluginContentOriginWhitelist; |
66 class PowerSaveBlocker; | 67 class PowerSaveBlocker; |
67 class RenderViewHost; | 68 class RenderViewHost; |
68 class RenderViewHostDelegateView; | 69 class RenderViewHostDelegateView; |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
377 void ExitFullscreen(bool will_cause_resize) override; | 378 void ExitFullscreen(bool will_cause_resize) override; |
378 void ResumeLoadingCreatedWebContents() override; | 379 void ResumeLoadingCreatedWebContents() override; |
379 void OnMediaSessionStateChanged(); | 380 void OnMediaSessionStateChanged(); |
380 void ResumeMediaSession() override; | 381 void ResumeMediaSession() override; |
381 void SuspendMediaSession() override; | 382 void SuspendMediaSession() override; |
382 void StopMediaSession() override; | 383 void StopMediaSession() override; |
383 | 384 |
384 #if defined(OS_ANDROID) | 385 #if defined(OS_ANDROID) |
385 base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() override; | 386 base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() override; |
386 virtual WebContentsAndroid* GetWebContentsAndroid(); | 387 virtual WebContentsAndroid* GetWebContentsAndroid(); |
388 void ActivateNearestFindResult(float x, float y) override; | |
389 void RequestFindMatchRects(int current_version) override; | |
387 #elif defined(OS_MACOSX) | 390 #elif defined(OS_MACOSX) |
388 void SetAllowOtherViews(bool allow) override; | 391 void SetAllowOtherViews(bool allow) override; |
389 bool GetAllowOtherViews() override; | 392 bool GetAllowOtherViews() override; |
390 #endif | 393 #endif |
391 | 394 |
392 // Implementation of PageNavigator. | 395 // Implementation of PageNavigator. |
393 WebContents* OpenURL(const OpenURLParams& params) override; | 396 WebContents* OpenURL(const OpenURLParams& params) override; |
394 | 397 |
395 // Implementation of IPC::Sender. | 398 // Implementation of IPC::Sender. |
396 bool Send(IPC::Message* message) override; | 399 bool Send(IPC::Message* message) override; |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
739 LoadResourceFromMemoryCacheWithEmptySecurityInfo); | 742 LoadResourceFromMemoryCacheWithEmptySecurityInfo); |
740 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, | 743 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
741 ResetJavaScriptDialogOnUserNavigate); | 744 ResetJavaScriptDialogOnUserNavigate); |
742 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); | 745 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); |
743 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); | 746 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); |
744 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, PageDoesBackAndReload); | 747 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, PageDoesBackAndReload); |
745 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrossSiteIframe); | 748 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrossSiteIframe); |
746 FRIEND_TEST_ALL_PREFIXES(SitePerProcessAccessibilityBrowserTest, | 749 FRIEND_TEST_ALL_PREFIXES(SitePerProcessAccessibilityBrowserTest, |
747 CrossSiteIframeAccessibility); | 750 CrossSiteIframeAccessibility); |
748 | 751 |
752 // So FindRequestManager can access FindReply/FindMatchRectsReply. | |
753 friend class FindRequestManager; | |
lfg
2016/04/04 18:57:32
Those functions can be public in WebContentsImpl i
| |
754 | |
749 // So InterstitialPageImpl can access SetIsLoading. | 755 // So InterstitialPageImpl can access SetIsLoading. |
750 friend class InterstitialPageImpl; | 756 friend class InterstitialPageImpl; |
751 | 757 |
752 // TODO(brettw) TestWebContents shouldn't exist! | 758 // TODO(brettw) TestWebContents shouldn't exist! |
753 friend class TestWebContents; | 759 friend class TestWebContents; |
754 | 760 |
755 class DestructionObserver; | 761 class DestructionObserver; |
756 | 762 |
757 // Represents a WebContents node in a tree of WebContents structure. | 763 // Represents a WebContents node in a tree of WebContents structure. |
758 // | 764 // |
(...skipping 13 matching lines...) Expand all Loading... | |
772 | 778 |
773 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents, | 779 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents, |
774 RenderFrameHostImpl* outer_contents_frame); | 780 RenderFrameHostImpl* outer_contents_frame); |
775 | 781 |
776 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } | 782 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } |
777 int outer_contents_frame_tree_node_id() { | 783 int outer_contents_frame_tree_node_id() { |
778 return outer_contents_frame_tree_node_id_; | 784 return outer_contents_frame_tree_node_id_; |
779 } | 785 } |
780 | 786 |
781 private: | 787 private: |
782 // The outer Webontents. | 788 // The outer WebContents. |
783 WebContentsImpl* outer_web_contents_; | 789 WebContentsImpl* outer_web_contents_; |
784 // The ID of the FrameTreeNode in outer WebContents that is hosting us. | 790 // The ID of the FrameTreeNode in outer WebContents that is hosting us. |
785 int outer_contents_frame_tree_node_id_; | 791 int outer_contents_frame_tree_node_id_; |
786 // List of inner WebContents that we host. | 792 // List of inner WebContents that we host. |
787 ChildrenSet inner_web_contents_tree_nodes_; | 793 ChildrenSet inner_web_contents_tree_nodes_; |
788 }; | 794 }; |
789 | 795 |
790 // See WebContents::Create for a description of these parameters. | 796 // See WebContents::Create for a description of these parameters. |
791 WebContentsImpl(BrowserContext* browser_context); | 797 WebContentsImpl(BrowserContext* browser_context); |
792 | 798 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
870 bool user_gesture); | 876 bool user_gesture); |
871 void OnFindReply(int request_id, | 877 void OnFindReply(int request_id, |
872 int number_of_matches, | 878 int number_of_matches, |
873 const gfx::Rect& selection_rect, | 879 const gfx::Rect& selection_rect, |
874 int active_match_ordinal, | 880 int active_match_ordinal, |
875 bool final_update); | 881 bool final_update); |
876 #if defined(OS_ANDROID) | 882 #if defined(OS_ANDROID) |
877 void OnFindMatchRectsReply(int version, | 883 void OnFindMatchRectsReply(int version, |
878 const std::vector<gfx::RectF>& rects, | 884 const std::vector<gfx::RectF>& rects, |
879 const gfx::RectF& active_rect); | 885 const gfx::RectF& active_rect); |
880 | 886 void OnGetNearestFindResultReply(int request_id, float distance); |
881 void OnOpenDateTimeDialog( | 887 void OnOpenDateTimeDialog( |
882 const ViewHostMsg_DateTimeDialogValue_Params& value); | 888 const ViewHostMsg_DateTimeDialogValue_Params& value); |
883 #endif | 889 #endif |
884 void OnDomOperationResponse(const std::string& json_string); | 890 void OnDomOperationResponse(const std::string& json_string); |
885 void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy); | 891 void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy); |
886 void OnOpenColorChooser(int color_chooser_id, | 892 void OnOpenColorChooser(int color_chooser_id, |
887 SkColor color, | 893 SkColor color, |
888 const std::vector<ColorSuggestion>& suggestions); | 894 const std::vector<ColorSuggestion>& suggestions); |
889 void OnEndColorChooser(int color_chooser_id); | 895 void OnEndColorChooser(int color_chooser_id); |
890 void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color); | 896 void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1024 | 1030 |
1025 // Internal helper to create WebUI objects associated with |this|. |url| is | 1031 // Internal helper to create WebUI objects associated with |this|. |url| is |
1026 // used to determine which WebUI should be created (if any). |frame_name| | 1032 // used to determine which WebUI should be created (if any). |frame_name| |
1027 // corresponds to the name of a frame that the WebUI should be created for (or | 1033 // corresponds to the name of a frame that the WebUI should be created for (or |
1028 // the main frame if empty). | 1034 // the main frame if empty). |
1029 WebUI* CreateWebUI(const GURL& url, const std::string& frame_name); | 1035 WebUI* CreateWebUI(const GURL& url, const std::string& frame_name); |
1030 | 1036 |
1031 void SetJavaScriptDialogManagerForTesting( | 1037 void SetJavaScriptDialogManagerForTesting( |
1032 JavaScriptDialogManager* dialog_manager); | 1038 JavaScriptDialogManager* dialog_manager); |
1033 | 1039 |
1040 // Returns the FindRequestManager, or creates one if it doesn't already exist. | |
1041 FindRequestManager* GetOrCreateFindRequestManager(); | |
1042 | |
1043 // Called by FindRequestManager when find replies come in from a renderer | |
1044 // process. | |
1045 void FindReply(int request_id, | |
1046 int number_of_matches, | |
1047 const gfx::Rect& selection_rect, | |
1048 int active_match_ordinal, | |
1049 bool final_update); | |
1050 | |
1051 #if defined(OS_ANDROID) | |
1052 // Called by FindRequestManager when all of the match rects are in. | |
1053 void FindMatchRectsReply(int version, | |
1054 const std::vector<gfx::RectF>& rects, | |
1055 const gfx::RectF& active_rect); | |
1056 #endif | |
1057 | |
1034 // Data for core operation --------------------------------------------------- | 1058 // Data for core operation --------------------------------------------------- |
1035 | 1059 |
1036 // Delegate for notifying our owner about stuff. Not owned by us. | 1060 // Delegate for notifying our owner about stuff. Not owned by us. |
1037 WebContentsDelegate* delegate_; | 1061 WebContentsDelegate* delegate_; |
1038 | 1062 |
1039 // Handles the back/forward list and loading. | 1063 // Handles the back/forward list and loading. |
1040 NavigationControllerImpl controller_; | 1064 NavigationControllerImpl controller_; |
1041 | 1065 |
1042 // The corresponding view. | 1066 // The corresponding view. |
1043 scoped_ptr<WebContentsView> view_; | 1067 scoped_ptr<WebContentsView> view_; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1075 // Manages the frame tree of the page and process swaps in each node. | 1099 // Manages the frame tree of the page and process swaps in each node. |
1076 FrameTree frame_tree_; | 1100 FrameTree frame_tree_; |
1077 | 1101 |
1078 // If this WebContents is part of a "tree of WebContents", then this contains | 1102 // If this WebContents is part of a "tree of WebContents", then this contains |
1079 // information about the structure. | 1103 // information about the structure. |
1080 scoped_ptr<WebContentsTreeNode> node_; | 1104 scoped_ptr<WebContentsTreeNode> node_; |
1081 | 1105 |
1082 // SavePackage, lazily created. | 1106 // SavePackage, lazily created. |
1083 scoped_refptr<SavePackage> save_package_; | 1107 scoped_refptr<SavePackage> save_package_; |
1084 | 1108 |
1109 // Manages/coordinates find-in-page requests. Created lazily. | |
1110 scoped_ptr<FindRequestManager> find_request_manager_; | |
1111 | |
1085 // Data for loading state ---------------------------------------------------- | 1112 // Data for loading state ---------------------------------------------------- |
1086 | 1113 |
1087 // Indicates whether the current load is to a different document. Only valid | 1114 // Indicates whether the current load is to a different document. Only valid |
1088 // if is_loading_ is true. | 1115 // if is_loading_ is true. |
1089 bool is_load_to_different_document_; | 1116 bool is_load_to_different_document_; |
1090 | 1117 |
1091 // Indicates if the tab is considered crashed. | 1118 // Indicates if the tab is considered crashed. |
1092 base::TerminationStatus crashed_status_; | 1119 base::TerminationStatus crashed_status_; |
1093 int crashed_error_code_; | 1120 int crashed_error_code_; |
1094 | 1121 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1343 // Adds/removes a callback called on creation of each new WebContents. | 1370 // Adds/removes a callback called on creation of each new WebContents. |
1344 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); | 1371 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); |
1345 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); | 1372 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); |
1346 | 1373 |
1347 DISALLOW_COPY_AND_ASSIGN(FriendZone); | 1374 DISALLOW_COPY_AND_ASSIGN(FriendZone); |
1348 }; | 1375 }; |
1349 | 1376 |
1350 } // namespace content | 1377 } // namespace content |
1351 | 1378 |
1352 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1379 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
OLD | NEW |