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

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

Issue 1371773003: mandoline: Add find in page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix spacing on the right side of the UI. 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 #include "components/web_view/web_view_impl.h" 5 #include "components/web_view/web_view_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "components/devtools_service/public/cpp/switches.h" 8 #include "components/devtools_service/public/cpp/switches.h"
9 #include "components/mus/public/cpp/scoped_view_ptr.h" 9 #include "components/mus/public/cpp/scoped_view_ptr.h"
10 #include "components/mus/public/cpp/view.h" 10 #include "components/mus/public/cpp/view.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 void WebViewImpl::LoadRequest(mojo::URLRequestPtr request) { 104 void WebViewImpl::LoadRequest(mojo::URLRequestPtr request) {
105 navigation_controller_.LoadURL(request.Pass()); 105 navigation_controller_.LoadURL(request.Pass());
106 } 106 }
107 107
108 void WebViewImpl::GetViewTreeClient( 108 void WebViewImpl::GetViewTreeClient(
109 mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client) { 109 mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client) {
110 mus::ViewTreeConnection::Create(this, view_tree_client.Pass()); 110 mus::ViewTreeConnection::Create(this, view_tree_client.Pass());
111 } 111 }
112 112
113 void WebViewImpl::Find(int32_t request_id, const mojo::String& search_text) {
114 DCHECK(frame_tree_);
115
116 // TODO(erg): This only deals with the uniframe case.
117 Frame* main_frame = frame_tree_->root();
118 main_frame->Find(request_id, search_text);
119 }
120
121 void WebViewImpl::StopFinding() {
122 DCHECK(frame_tree_);
123
124 // TODO(erg): This only deals with the uniframe case.
125 Frame* main_frame = frame_tree_->root();
126 main_frame->StopFinding();
127 }
128
113 void WebViewImpl::GoBack() { 129 void WebViewImpl::GoBack() {
114 if (!navigation_controller_.CanGoBack()) 130 if (!navigation_controller_.CanGoBack())
115 return; 131 return;
116 navigation_controller_.GoBack(); 132 navigation_controller_.GoBack();
117 } 133 }
118 134
119 void WebViewImpl::GoForward() { 135 void WebViewImpl::GoForward() {
120 if (!navigation_controller_.CanGoForward()) 136 if (!navigation_controller_.CanGoForward())
121 return; 137 return;
122 navigation_controller_.GoForward(); 138 navigation_controller_.GoForward();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 FrameConnection::CreateConnectionForCanNavigateFrame( 212 FrameConnection::CreateConnectionForCanNavigateFrame(
197 app_, target, request.Pass(), callback); 213 app_, target, request.Pass(), callback);
198 } 214 }
199 215
200 void WebViewImpl::DidStartNavigation(Frame* frame) {} 216 void WebViewImpl::DidStartNavigation(Frame* frame) {}
201 217
202 void WebViewImpl::DidCommitProvisionalLoad(Frame* frame) { 218 void WebViewImpl::DidCommitProvisionalLoad(Frame* frame) {
203 navigation_controller_.FrameDidCommitProvisionalLoad(frame); 219 navigation_controller_.FrameDidCommitProvisionalLoad(frame);
204 } 220 }
205 221
222 void WebViewImpl::ReportFindInPageMatchCount(int32_t request_id,
223 int32_t count,
224 bool final_update) {
225 client_->ReportFindInPageMatchCount(request_id, count, final_update);
226 }
227
228 void WebViewImpl::ReportFindInPageSelection(int32_t request_id,
229 int32_t active_match_ordinal) {
230 client_->ReportFindInPageSelection(request_id, active_match_ordinal);
231 }
232
206 //////////////////////////////////////////////////////////////////////////////// 233 ////////////////////////////////////////////////////////////////////////////////
207 // WebViewImpl, FrameDevToolsAgentDelegate implementation: 234 // WebViewImpl, FrameDevToolsAgentDelegate implementation:
208 235
209 void WebViewImpl::HandlePageNavigateRequest(const GURL& url) { 236 void WebViewImpl::HandlePageNavigateRequest(const GURL& url) {
210 mojo::URLRequestPtr request(mojo::URLRequest::New()); 237 mojo::URLRequestPtr request(mojo::URLRequest::New());
211 request->url = url.spec(); 238 request->url = url.spec();
212 client_->TopLevelNavigateRequest(request.Pass()); 239 client_->TopLevelNavigateRequest(request.Pass());
213 } 240 }
214 241
215 //////////////////////////////////////////////////////////////////////////////// 242 ////////////////////////////////////////////////////////////////////////////////
216 // WebViewImpl, NavigationControllerDelegate implementation: 243 // WebViewImpl, NavigationControllerDelegate implementation:
217 244
218 void WebViewImpl::OnNavigate(mojo::URLRequestPtr request) { 245 void WebViewImpl::OnNavigate(mojo::URLRequestPtr request) {
219 pending_load_.reset(new PendingWebViewLoad(this)); 246 pending_load_.reset(new PendingWebViewLoad(this));
220 pending_load_->Init(request.Pass()); 247 pending_load_->Init(request.Pass());
221 } 248 }
222 249
223 void WebViewImpl::OnDidNavigate() { 250 void WebViewImpl::OnDidNavigate() {
224 client_->BackForwardChanged(navigation_controller_.CanGoBack() 251 client_->BackForwardChanged(navigation_controller_.CanGoBack()
225 ? ButtonState::BUTTON_STATE_ENABLED 252 ? ButtonState::BUTTON_STATE_ENABLED
226 : ButtonState::BUTTON_STATE_DISABLED, 253 : ButtonState::BUTTON_STATE_DISABLED,
227 navigation_controller_.CanGoForward() 254 navigation_controller_.CanGoForward()
228 ? ButtonState::BUTTON_STATE_ENABLED 255 ? ButtonState::BUTTON_STATE_ENABLED
229 : ButtonState::BUTTON_STATE_DISABLED); 256 : ButtonState::BUTTON_STATE_DISABLED);
230 } 257 }
231 258
232 } // namespace web_view 259 } // namespace web_view
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698