| 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 void MediaStartedPlaying(const WebContentsObserver::MediaPlayerId& id); | 717 void MediaStartedPlaying(const WebContentsObserver::MediaPlayerId& id); |
| 715 void MediaStoppedPlaying(const WebContentsObserver::MediaPlayerId& id); | 718 void MediaStoppedPlaying(const WebContentsObserver::MediaPlayerId& id); |
| 716 | 719 |
| 717 MediaWebContentsObserver* media_web_contents_observer() { | 720 MediaWebContentsObserver* media_web_contents_observer() { |
| 718 return media_web_contents_observer_.get(); | 721 return media_web_contents_observer_.get(); |
| 719 } | 722 } |
| 720 | 723 |
| 721 // Update the web contents visibility. | 724 // Update the web contents visibility. |
| 722 void UpdateWebContentsVisibility(bool visible); | 725 void UpdateWebContentsVisibility(bool visible); |
| 723 | 726 |
| 724 private: | 727 // Called by FindRequestManager when find replies come in from a renderer |
| 728 // process. |
| 729 void FindReply(int request_id, |
| 730 int number_of_matches, |
| 731 const gfx::Rect& selection_rect, |
| 732 int active_match_ordinal, |
| 733 bool final_update); |
| 734 |
| 735 #if defined(OS_ANDROID) |
| 736 // Called by FindRequestManager when all of the find match rects are in. |
| 737 void FindMatchRectsReply(int version, |
| 738 const std::vector<gfx::RectF>& rects, |
| 739 const gfx::RectF& active_rect); |
| 740 #endif |
| 741 |
| 742 private: |
| 725 friend class WebContentsObserver; | 743 friend class WebContentsObserver; |
| 726 friend class WebContents; // To implement factory methods. | 744 friend class WebContents; // To implement factory methods. |
| 727 | 745 |
| 728 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials); | 746 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials); |
| 729 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle); | 747 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle); |
| 730 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending); | 748 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending); |
| 731 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, | 749 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
| 732 CrossSiteCantPreemptAfterUnload); | 750 CrossSiteCantPreemptAfterUnload); |
| 733 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents); | 751 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents); |
| 734 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape); | 752 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 | 790 |
| 773 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents, | 791 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents, |
| 774 RenderFrameHostImpl* outer_contents_frame); | 792 RenderFrameHostImpl* outer_contents_frame); |
| 775 | 793 |
| 776 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } | 794 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } |
| 777 int outer_contents_frame_tree_node_id() { | 795 int outer_contents_frame_tree_node_id() { |
| 778 return outer_contents_frame_tree_node_id_; | 796 return outer_contents_frame_tree_node_id_; |
| 779 } | 797 } |
| 780 | 798 |
| 781 private: | 799 private: |
| 782 // The outer Webontents. | 800 // The outer WebContents. |
| 783 WebContentsImpl* outer_web_contents_; | 801 WebContentsImpl* outer_web_contents_; |
| 784 // The ID of the FrameTreeNode in outer WebContents that is hosting us. | 802 // The ID of the FrameTreeNode in outer WebContents that is hosting us. |
| 785 int outer_contents_frame_tree_node_id_; | 803 int outer_contents_frame_tree_node_id_; |
| 786 // List of inner WebContents that we host. | 804 // List of inner WebContents that we host. |
| 787 ChildrenSet inner_web_contents_tree_nodes_; | 805 ChildrenSet inner_web_contents_tree_nodes_; |
| 788 }; | 806 }; |
| 789 | 807 |
| 790 // See WebContents::Create for a description of these parameters. | 808 // See WebContents::Create for a description of these parameters. |
| 791 WebContentsImpl(BrowserContext* browser_context); | 809 WebContentsImpl(BrowserContext* browser_context); |
| 792 | 810 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 bool user_gesture); | 888 bool user_gesture); |
| 871 void OnFindReply(int request_id, | 889 void OnFindReply(int request_id, |
| 872 int number_of_matches, | 890 int number_of_matches, |
| 873 const gfx::Rect& selection_rect, | 891 const gfx::Rect& selection_rect, |
| 874 int active_match_ordinal, | 892 int active_match_ordinal, |
| 875 bool final_update); | 893 bool final_update); |
| 876 #if defined(OS_ANDROID) | 894 #if defined(OS_ANDROID) |
| 877 void OnFindMatchRectsReply(int version, | 895 void OnFindMatchRectsReply(int version, |
| 878 const std::vector<gfx::RectF>& rects, | 896 const std::vector<gfx::RectF>& rects, |
| 879 const gfx::RectF& active_rect); | 897 const gfx::RectF& active_rect); |
| 880 | 898 void OnGetNearestFindResultReply(int request_id, float distance); |
| 881 void OnOpenDateTimeDialog( | 899 void OnOpenDateTimeDialog( |
| 882 const ViewHostMsg_DateTimeDialogValue_Params& value); | 900 const ViewHostMsg_DateTimeDialogValue_Params& value); |
| 883 #endif | 901 #endif |
| 884 void OnDomOperationResponse(const std::string& json_string); | 902 void OnDomOperationResponse(const std::string& json_string); |
| 885 void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy); | 903 void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy); |
| 886 void OnOpenColorChooser(int color_chooser_id, | 904 void OnOpenColorChooser(int color_chooser_id, |
| 887 SkColor color, | 905 SkColor color, |
| 888 const std::vector<ColorSuggestion>& suggestions); | 906 const std::vector<ColorSuggestion>& suggestions); |
| 889 void OnEndColorChooser(int color_chooser_id); | 907 void OnEndColorChooser(int color_chooser_id); |
| 890 void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color); | 908 void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 | 1042 |
| 1025 // Internal helper to create WebUI objects associated with |this|. |url| is | 1043 // Internal helper to create WebUI objects associated with |this|. |url| is |
| 1026 // used to determine which WebUI should be created (if any). |frame_name| | 1044 // 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 | 1045 // corresponds to the name of a frame that the WebUI should be created for (or |
| 1028 // the main frame if empty). | 1046 // the main frame if empty). |
| 1029 WebUI* CreateWebUI(const GURL& url, const std::string& frame_name); | 1047 WebUI* CreateWebUI(const GURL& url, const std::string& frame_name); |
| 1030 | 1048 |
| 1031 void SetJavaScriptDialogManagerForTesting( | 1049 void SetJavaScriptDialogManagerForTesting( |
| 1032 JavaScriptDialogManager* dialog_manager); | 1050 JavaScriptDialogManager* dialog_manager); |
| 1033 | 1051 |
| 1052 // Returns the FindRequestManager, or creates one if it doesn't already exist. |
| 1053 FindRequestManager* GetOrCreateFindRequestManager(); |
| 1054 |
| 1034 // Data for core operation --------------------------------------------------- | 1055 // Data for core operation --------------------------------------------------- |
| 1035 | 1056 |
| 1036 // Delegate for notifying our owner about stuff. Not owned by us. | 1057 // Delegate for notifying our owner about stuff. Not owned by us. |
| 1037 WebContentsDelegate* delegate_; | 1058 WebContentsDelegate* delegate_; |
| 1038 | 1059 |
| 1039 // Handles the back/forward list and loading. | 1060 // Handles the back/forward list and loading. |
| 1040 NavigationControllerImpl controller_; | 1061 NavigationControllerImpl controller_; |
| 1041 | 1062 |
| 1042 // The corresponding view. | 1063 // The corresponding view. |
| 1043 scoped_ptr<WebContentsView> view_; | 1064 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. | 1096 // Manages the frame tree of the page and process swaps in each node. |
| 1076 FrameTree frame_tree_; | 1097 FrameTree frame_tree_; |
| 1077 | 1098 |
| 1078 // If this WebContents is part of a "tree of WebContents", then this contains | 1099 // If this WebContents is part of a "tree of WebContents", then this contains |
| 1079 // information about the structure. | 1100 // information about the structure. |
| 1080 scoped_ptr<WebContentsTreeNode> node_; | 1101 scoped_ptr<WebContentsTreeNode> node_; |
| 1081 | 1102 |
| 1082 // SavePackage, lazily created. | 1103 // SavePackage, lazily created. |
| 1083 scoped_refptr<SavePackage> save_package_; | 1104 scoped_refptr<SavePackage> save_package_; |
| 1084 | 1105 |
| 1106 // Manages/coordinates find-in-page requests. Created lazily. |
| 1107 scoped_ptr<FindRequestManager> find_request_manager_; |
| 1108 |
| 1085 // Data for loading state ---------------------------------------------------- | 1109 // Data for loading state ---------------------------------------------------- |
| 1086 | 1110 |
| 1087 // Indicates whether the current load is to a different document. Only valid | 1111 // Indicates whether the current load is to a different document. Only valid |
| 1088 // if is_loading_ is true. | 1112 // if is_loading_ is true. |
| 1089 bool is_load_to_different_document_; | 1113 bool is_load_to_different_document_; |
| 1090 | 1114 |
| 1091 // Indicates if the tab is considered crashed. | 1115 // Indicates if the tab is considered crashed. |
| 1092 base::TerminationStatus crashed_status_; | 1116 base::TerminationStatus crashed_status_; |
| 1093 int crashed_error_code_; | 1117 int crashed_error_code_; |
| 1094 | 1118 |
| (...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. | 1367 // Adds/removes a callback called on creation of each new WebContents. |
| 1344 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); | 1368 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); |
| 1345 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); | 1369 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); |
| 1346 | 1370 |
| 1347 DISALLOW_COPY_AND_ASSIGN(FriendZone); | 1371 DISALLOW_COPY_AND_ASSIGN(FriendZone); |
| 1348 }; | 1372 }; |
| 1349 | 1373 |
| 1350 } // namespace content | 1374 } // namespace content |
| 1351 | 1375 |
| 1352 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1376 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| OLD | NEW |