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

Side by Side Diff: components/web_view/web_view_impl.h

Issue 1371773003: mandoline: Add find in page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Further patch cleanup; use a WeakPtrFactory in FindController. Created 5 years, 2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 COMPONENTS_WEB_VIEW_WEB_VIEW_IMPL_H_ 5 #ifndef COMPONENTS_WEB_VIEW_WEB_VIEW_IMPL_H_
6 #define COMPONENTS_WEB_VIEW_WEB_VIEW_IMPL_H_ 6 #define COMPONENTS_WEB_VIEW_WEB_VIEW_IMPL_H_
7 7
8 #include <deque>
8 #include <string> 9 #include <string>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "components/mus/public/cpp/view_observer.h" 13 #include "components/mus/public/cpp/view_observer.h"
13 #include "components/mus/public/cpp/view_tree_delegate.h" 14 #include "components/mus/public/cpp/view_tree_delegate.h"
15 #include "components/web_view/find_controller.h"
16 #include "components/web_view/find_controller_delegate.h"
14 #include "components/web_view/frame_devtools_agent_delegate.h" 17 #include "components/web_view/frame_devtools_agent_delegate.h"
15 #include "components/web_view/frame_tree_delegate.h" 18 #include "components/web_view/frame_tree_delegate.h"
16 #include "components/web_view/navigation_controller.h" 19 #include "components/web_view/navigation_controller.h"
17 #include "components/web_view/navigation_controller_delegate.h" 20 #include "components/web_view/navigation_controller_delegate.h"
18 #include "components/web_view/public/interfaces/web_view.mojom.h" 21 #include "components/web_view/public/interfaces/web_view.mojom.h"
19 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" 22 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
20 23
21 namespace mojo { 24 namespace mojo {
22 class ApplicationImpl; 25 class ApplicationImpl;
23 } 26 }
24 27
25 namespace web_view { 28 namespace web_view {
26 29
27 class Frame; 30 class Frame;
28 class FrameDevToolsAgent; 31 class FrameDevToolsAgent;
29 class FrameTree; 32 class FrameTree;
30 class PendingWebViewLoad; 33 class PendingWebViewLoad;
31 class URLRequestCloneable; 34 class URLRequestCloneable;
32 35
33 namespace mojom { 36 namespace mojom {
34 class HTMLMessageEvent; 37 class HTMLMessageEvent;
35 } 38 }
36 39
37 class WebViewImpl : public mojom::WebView, 40 class WebViewImpl : public mojom::WebView,
38 public mus::ViewTreeDelegate, 41 public mus::ViewTreeDelegate,
39 public mus::ViewObserver, 42 public mus::ViewObserver,
40 public FrameTreeDelegate, 43 public FrameTreeDelegate,
41 public FrameDevToolsAgentDelegate, 44 public FrameDevToolsAgentDelegate,
42 public NavigationControllerDelegate { 45 public NavigationControllerDelegate,
46 public FindControllerDelegate {
43 public: 47 public:
44 WebViewImpl(mojo::ApplicationImpl* app, 48 WebViewImpl(mojo::ApplicationImpl* app,
45 mojom::WebViewClientPtr client, 49 mojom::WebViewClientPtr client,
46 mojo::InterfaceRequest<WebView> request); 50 mojo::InterfaceRequest<WebView> request);
47 ~WebViewImpl() override; 51 ~WebViewImpl() override;
48 52
49 private: 53 private:
50 friend class PendingWebViewLoad; 54 friend class PendingWebViewLoad;
51 55
52 // See description above |pending_load_| for details. 56 // See description above |pending_load_| for details.
53 void OnLoad(const GURL& pending_url); 57 void OnLoad(const GURL& pending_url);
54 58
55 // Overridden from WebView: 59 // Overridden from WebView:
56 void LoadRequest(mojo::URLRequestPtr request) override; 60 void LoadRequest(mojo::URLRequestPtr request) override;
57 void GetViewTreeClient( 61 void GetViewTreeClient(
58 mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client) 62 mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client)
59 override; 63 override;
64 void Find(int32_t request_id, const mojo::String& search_text) override;
65 void StopFinding() override;
60 void GoBack() override; 66 void GoBack() override;
61 void GoForward() override; 67 void GoForward() override;
62 68
63 // Overridden from mus::ViewTreeDelegate: 69 // Overridden from mus::ViewTreeDelegate:
64 void OnEmbed(mus::View* root) override; 70 void OnEmbed(mus::View* root) override;
65 void OnConnectionLost(mus::ViewTreeConnection* connection) override; 71 void OnConnectionLost(mus::ViewTreeConnection* connection) override;
66 72
67 // Overridden from mus::ViewObserver: 73 // Overridden from mus::ViewObserver:
68 void OnViewBoundsChanged(mus::View* view, 74 void OnViewBoundsChanged(mus::View* view,
69 const mojo::Rect& old_bounds, 75 const mojo::Rect& old_bounds,
70 const mojo::Rect& new_bounds) override; 76 const mojo::Rect& new_bounds) override;
71 void OnViewDestroyed(mus::View* view) override; 77 void OnViewDestroyed(mus::View* view) override;
72 78
73 // Overridden from FrameTreeDelegate: 79 // Overridden from FrameTreeDelegate:
74 scoped_ptr<FrameUserData> CreateUserDataForNewFrame( 80 scoped_ptr<FrameUserData> CreateUserDataForNewFrame(
75 mojom::FrameClientPtr frame_client) override; 81 mojom::FrameClientPtr frame_client) override;
76 bool CanPostMessageEventToFrame(const Frame* source, 82 bool CanPostMessageEventToFrame(const Frame* source,
77 const Frame* target, 83 const Frame* target,
78 mojom::HTMLMessageEvent* event) override; 84 mojom::HTMLMessageEvent* event) override;
79 void LoadingStateChanged(bool loading, double progress) override; 85 void LoadingStateChanged(bool loading, double progress) override;
80 void TitleChanged(const mojo::String& title) override; 86 void TitleChanged(const mojo::String& title) override;
81 void NavigateTopLevel(Frame* source, mojo::URLRequestPtr request) override; 87 void NavigateTopLevel(Frame* source, mojo::URLRequestPtr request) override;
82 void CanNavigateFrame(Frame* target, 88 void CanNavigateFrame(Frame* target,
83 mojo::URLRequestPtr request, 89 mojo::URLRequestPtr request,
84 const CanNavigateFrameCallback& callback) override; 90 const CanNavigateFrameCallback& callback) override;
85 void DidStartNavigation(Frame* frame) override; 91 void DidStartNavigation(Frame* frame) override;
86 void DidCommitProvisionalLoad(Frame* frame) override; 92 void DidCommitProvisionalLoad(Frame* frame) override;
93 void DidDestroyFrame(Frame* frame) override;
94 void OnReportFindInFrameMatchCount(int32_t request_id,
95 Frame* frame,
96 int32_t count,
97 bool final_update) override;
98 void OnReportFindInPageSelection(int32_t request_id,
99 Frame* frame,
100 int32_t active_match_ordinal) override;
87 101
88 // Overridden from FrameDevToolsAgent::Delegate: 102 // Overridden from FrameDevToolsAgent::Delegate:
89 void HandlePageNavigateRequest(const GURL& url) override; 103 void HandlePageNavigateRequest(const GURL& url) override;
90 104
91 // Overridden from NavigationControllerDelegate: 105 // Overridden from NavigationControllerDelegate:
92 void OnNavigate(mojo::URLRequestPtr request) override; 106 void OnNavigate(mojo::URLRequestPtr request) override;
93 void OnDidNavigate() override; 107 void OnDidNavigate() override;
94 108
109 // Overridden from FindControllerDelegate:
110 std::deque<Frame*> GetAllFrames() override;
111 mojom::WebViewClient* GetWebViewClient() override;
112
95 mojo::ApplicationImpl* app_; 113 mojo::ApplicationImpl* app_;
96 mojom::WebViewClientPtr client_; 114 mojom::WebViewClientPtr client_;
97 mojo::StrongBinding<WebView> binding_; 115 mojo::StrongBinding<WebView> binding_;
98 mus::View* root_; 116 mus::View* root_;
99 mus::View* content_; 117 mus::View* content_;
100 scoped_ptr<FrameTree> frame_tree_; 118 scoped_ptr<FrameTree> frame_tree_;
101 119
102 // When LoadRequest() is called a PendingWebViewLoad is created to wait for 120 // When LoadRequest() is called a PendingWebViewLoad is created to wait for
103 // state needed to process the request. When the state is obtained OnLoad() 121 // state needed to process the request. When the state is obtained OnLoad()
104 // is invoked. 122 // is invoked.
105 scoped_ptr<PendingWebViewLoad> pending_load_; 123 scoped_ptr<PendingWebViewLoad> pending_load_;
106 124
107 scoped_ptr<FrameDevToolsAgent> devtools_agent_; 125 scoped_ptr<FrameDevToolsAgent> devtools_agent_;
108 126
109 NavigationController navigation_controller_; 127 NavigationController navigation_controller_;
110 128
129 FindController find_controller_;
130
111 DISALLOW_COPY_AND_ASSIGN(WebViewImpl); 131 DISALLOW_COPY_AND_ASSIGN(WebViewImpl);
112 }; 132 };
113 133
114 } // namespace web_view 134 } // namespace web_view
115 135
116 #endif // COMPONENTS_WEB_VIEW_WEB_VIEW_IMPL_H_ 136 #endif // COMPONENTS_WEB_VIEW_WEB_VIEW_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698