Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: content/browser/web_contents/web_contents_impl.h

Issue 1851793002: Implement a shell of FindRequestManager, and hook it up to WebContentsImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased and small fix. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 void ExitFullscreen(bool will_cause_resize) override; 379 void ExitFullscreen(bool will_cause_resize) override;
379 void ResumeLoadingCreatedWebContents() override; 380 void ResumeLoadingCreatedWebContents() override;
380 void OnMediaSessionStateChanged(); 381 void OnMediaSessionStateChanged();
381 void ResumeMediaSession() override; 382 void ResumeMediaSession() override;
382 void SuspendMediaSession() override; 383 void SuspendMediaSession() override;
383 void StopMediaSession() override; 384 void StopMediaSession() override;
384 385
385 #if defined(OS_ANDROID) 386 #if defined(OS_ANDROID)
386 base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() override; 387 base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() override;
387 virtual WebContentsAndroid* GetWebContentsAndroid(); 388 virtual WebContentsAndroid* GetWebContentsAndroid();
389 void ActivateNearestFindResult(float x, float y) override;
390 void RequestFindMatchRects(int current_version) override;
388 #elif defined(OS_MACOSX) 391 #elif defined(OS_MACOSX)
389 void SetAllowOtherViews(bool allow) override; 392 void SetAllowOtherViews(bool allow) override;
390 bool GetAllowOtherViews() override; 393 bool GetAllowOtherViews() override;
391 #endif 394 #endif
392 395
393 // Implementation of PageNavigator. 396 // Implementation of PageNavigator.
394 WebContents* OpenURL(const OpenURLParams& params) override; 397 WebContents* OpenURL(const OpenURLParams& params) override;
395 398
396 // Implementation of IPC::Sender. 399 // Implementation of IPC::Sender.
397 bool Send(IPC::Message* message) override; 400 bool Send(IPC::Message* message) override;
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 void MediaStartedPlaying(const WebContentsObserver::MediaPlayerId& id); 725 void MediaStartedPlaying(const WebContentsObserver::MediaPlayerId& id);
723 void MediaStoppedPlaying(const WebContentsObserver::MediaPlayerId& id); 726 void MediaStoppedPlaying(const WebContentsObserver::MediaPlayerId& id);
724 727
725 MediaWebContentsObserver* media_web_contents_observer() { 728 MediaWebContentsObserver* media_web_contents_observer() {
726 return media_web_contents_observer_.get(); 729 return media_web_contents_observer_.get();
727 } 730 }
728 731
729 // Update the web contents visibility. 732 // Update the web contents visibility.
730 void UpdateWebContentsVisibility(bool visible); 733 void UpdateWebContentsVisibility(bool visible);
731 734
732 private: 735 // Called by FindRequestManager when find replies come in from a renderer
736 // process.
737 void NotifyFindReply(int request_id,
738 int number_of_matches,
739 const gfx::Rect& selection_rect,
740 int active_match_ordinal,
741 bool final_update);
742
743 #if defined(OS_ANDROID)
744 // Called by FindRequestManager when all of the find match rects are in.
745 void NotifyFindMatchRectsReply(int version,
746 const std::vector<gfx::RectF>& rects,
747 const gfx::RectF& active_rect);
748 #endif
749
750 private:
733 friend class WebContentsObserver; 751 friend class WebContentsObserver;
734 friend class WebContents; // To implement factory methods. 752 friend class WebContents; // To implement factory methods.
735 753
736 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials); 754 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials);
737 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle); 755 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle);
738 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending); 756 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending);
739 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, 757 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
740 CrossSiteCantPreemptAfterUnload); 758 CrossSiteCantPreemptAfterUnload);
741 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents); 759 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents);
742 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape); 760 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 800
783 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents, 801 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents,
784 RenderFrameHostImpl* outer_contents_frame); 802 RenderFrameHostImpl* outer_contents_frame);
785 803
786 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } 804 WebContentsImpl* outer_web_contents() { return outer_web_contents_; }
787 int outer_contents_frame_tree_node_id() { 805 int outer_contents_frame_tree_node_id() {
788 return outer_contents_frame_tree_node_id_; 806 return outer_contents_frame_tree_node_id_;
789 } 807 }
790 808
791 private: 809 private:
792 // The outer Webontents. 810 // The outer WebContents.
793 WebContentsImpl* outer_web_contents_; 811 WebContentsImpl* outer_web_contents_;
794 // The ID of the FrameTreeNode in outer WebContents that is hosting us. 812 // The ID of the FrameTreeNode in outer WebContents that is hosting us.
795 int outer_contents_frame_tree_node_id_; 813 int outer_contents_frame_tree_node_id_;
796 // List of inner WebContents that we host. 814 // List of inner WebContents that we host.
797 ChildrenSet inner_web_contents_tree_nodes_; 815 ChildrenSet inner_web_contents_tree_nodes_;
798 }; 816 };
799 817
800 // See WebContents::Create for a description of these parameters. 818 // See WebContents::Create for a description of these parameters.
801 WebContentsImpl(BrowserContext* browser_context); 819 WebContentsImpl(BrowserContext* browser_context);
802 820
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 bool user_gesture); 898 bool user_gesture);
881 void OnFindReply(int request_id, 899 void OnFindReply(int request_id,
882 int number_of_matches, 900 int number_of_matches,
883 const gfx::Rect& selection_rect, 901 const gfx::Rect& selection_rect,
884 int active_match_ordinal, 902 int active_match_ordinal,
885 bool final_update); 903 bool final_update);
886 #if defined(OS_ANDROID) 904 #if defined(OS_ANDROID)
887 void OnFindMatchRectsReply(int version, 905 void OnFindMatchRectsReply(int version,
888 const std::vector<gfx::RectF>& rects, 906 const std::vector<gfx::RectF>& rects,
889 const gfx::RectF& active_rect); 907 const gfx::RectF& active_rect);
890 908 void OnGetNearestFindResultReply(int request_id, float distance);
891 void OnOpenDateTimeDialog( 909 void OnOpenDateTimeDialog(
892 const ViewHostMsg_DateTimeDialogValue_Params& value); 910 const ViewHostMsg_DateTimeDialogValue_Params& value);
893 #endif 911 #endif
894 void OnDomOperationResponse(const std::string& json_string); 912 void OnDomOperationResponse(const std::string& json_string);
895 void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy); 913 void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy);
896 void OnOpenColorChooser(int color_chooser_id, 914 void OnOpenColorChooser(int color_chooser_id,
897 SkColor color, 915 SkColor color,
898 const std::vector<ColorSuggestion>& suggestions); 916 const std::vector<ColorSuggestion>& suggestions);
899 void OnEndColorChooser(int color_chooser_id); 917 void OnEndColorChooser(int color_chooser_id);
900 void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color); 918 void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 1052
1035 // Internal helper to create WebUI objects associated with |this|. |url| is 1053 // Internal helper to create WebUI objects associated with |this|. |url| is
1036 // used to determine which WebUI should be created (if any). |frame_name| 1054 // used to determine which WebUI should be created (if any). |frame_name|
1037 // corresponds to the name of a frame that the WebUI should be created for (or 1055 // corresponds to the name of a frame that the WebUI should be created for (or
1038 // the main frame if empty). 1056 // the main frame if empty).
1039 WebUI* CreateWebUI(const GURL& url, const std::string& frame_name); 1057 WebUI* CreateWebUI(const GURL& url, const std::string& frame_name);
1040 1058
1041 void SetJavaScriptDialogManagerForTesting( 1059 void SetJavaScriptDialogManagerForTesting(
1042 JavaScriptDialogManager* dialog_manager); 1060 JavaScriptDialogManager* dialog_manager);
1043 1061
1062 // Returns the FindRequestManager, or creates one if it doesn't already exist.
1063 FindRequestManager* GetOrCreateFindRequestManager();
1064
1044 // Data for core operation --------------------------------------------------- 1065 // Data for core operation ---------------------------------------------------
1045 1066
1046 // Delegate for notifying our owner about stuff. Not owned by us. 1067 // Delegate for notifying our owner about stuff. Not owned by us.
1047 WebContentsDelegate* delegate_; 1068 WebContentsDelegate* delegate_;
1048 1069
1049 // Handles the back/forward list and loading. 1070 // Handles the back/forward list and loading.
1050 NavigationControllerImpl controller_; 1071 NavigationControllerImpl controller_;
1051 1072
1052 // The corresponding view. 1073 // The corresponding view.
1053 std::unique_ptr<WebContentsView> view_; 1074 std::unique_ptr<WebContentsView> view_;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 // Manages the frame tree of the page and process swaps in each node. 1106 // Manages the frame tree of the page and process swaps in each node.
1086 FrameTree frame_tree_; 1107 FrameTree frame_tree_;
1087 1108
1088 // If this WebContents is part of a "tree of WebContents", then this contains 1109 // If this WebContents is part of a "tree of WebContents", then this contains
1089 // information about the structure. 1110 // information about the structure.
1090 std::unique_ptr<WebContentsTreeNode> node_; 1111 std::unique_ptr<WebContentsTreeNode> node_;
1091 1112
1092 // SavePackage, lazily created. 1113 // SavePackage, lazily created.
1093 scoped_refptr<SavePackage> save_package_; 1114 scoped_refptr<SavePackage> save_package_;
1094 1115
1116 // Manages/coordinates find-in-page requests. Created lazily.
1117 scoped_ptr<FindRequestManager> find_request_manager_;
1118
1095 // Data for loading state ---------------------------------------------------- 1119 // Data for loading state ----------------------------------------------------
1096 1120
1097 // Indicates whether the current load is to a different document. Only valid 1121 // Indicates whether the current load is to a different document. Only valid
1098 // if is_loading_ is true. 1122 // if is_loading_ is true.
1099 bool is_load_to_different_document_; 1123 bool is_load_to_different_document_;
1100 1124
1101 // Indicates if the tab is considered crashed. 1125 // Indicates if the tab is considered crashed.
1102 base::TerminationStatus crashed_status_; 1126 base::TerminationStatus crashed_status_;
1103 int crashed_error_code_; 1127 int crashed_error_code_;
1104 1128
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 // Adds/removes a callback called on creation of each new WebContents. 1385 // Adds/removes a callback called on creation of each new WebContents.
1362 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); 1386 static void AddCreatedCallbackForTesting(const CreatedCallback& callback);
1363 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); 1387 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback);
1364 1388
1365 DISALLOW_COPY_AND_ASSIGN(FriendZone); 1389 DISALLOW_COPY_AND_ASSIGN(FriendZone);
1366 }; 1390 };
1367 1391
1368 } // namespace content 1392 } // namespace content
1369 1393
1370 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 1394 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698