Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 | 168 |
| 169 void WebViewImpl::LoadingStateChanged(bool loading, double progress) { | 169 void WebViewImpl::LoadingStateChanged(bool loading, double progress) { |
| 170 client_->LoadingStateChanged(loading, progress); | 170 client_->LoadingStateChanged(loading, progress); |
| 171 } | 171 } |
| 172 | 172 |
| 173 void WebViewImpl::TitleChanged(const mojo::String& title) { | 173 void WebViewImpl::TitleChanged(const mojo::String& title) { |
| 174 client_->TitleChanged(title); | 174 client_->TitleChanged(title); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void WebViewImpl::NavigateTopLevel(Frame* source, mojo::URLRequestPtr request) { | 177 void WebViewImpl::NavigateTopLevel(Frame* source, mojo::URLRequestPtr request) { |
| 178 client_->TopLevelNavigate(request.Pass()); | 178 client_->TopLevelNavigateRequest(request.Pass()); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void WebViewImpl::CanNavigateFrame(Frame* target, | 181 void WebViewImpl::CanNavigateFrame(Frame* target, |
| 182 mojo::URLRequestPtr request, | 182 mojo::URLRequestPtr request, |
| 183 const CanNavigateFrameCallback& callback) { | 183 const CanNavigateFrameCallback& callback) { |
| 184 FrameConnection::CreateConnectionForCanNavigateFrame( | 184 FrameConnection::CreateConnectionForCanNavigateFrame( |
| 185 app_, target, request.Pass(), callback); | 185 app_, target, request.Pass(), callback); |
| 186 } | 186 } |
| 187 | 187 |
| 188 void WebViewImpl::DidStartNavigation(Frame* frame) {} | 188 void WebViewImpl::DidStartNavigation(Frame* frame) {} |
| 189 | 189 |
| 190 void WebViewImpl::DidCommitProvisionalLoad(Frame* frame) { | 190 void WebViewImpl::DidCommitProvisionalLoad(Frame* frame) { |
| 191 navigation_controller_.FrameDidCommitProvisionalLoad(frame); | 191 navigation_controller_.FrameDidCommitProvisionalLoad(frame); |
| 192 } | 192 } |
| 193 | 193 |
| 194 //////////////////////////////////////////////////////////////////////////////// | 194 //////////////////////////////////////////////////////////////////////////////// |
| 195 // WebViewImpl, FrameDevToolsAgentDelegate implementation: | 195 // WebViewImpl, FrameDevToolsAgentDelegate implementation: |
| 196 | 196 |
| 197 void WebViewImpl::HandlePageNavigateRequest(const GURL& url) { | 197 void WebViewImpl::HandlePageNavigateRequest(const GURL& url) { |
| 198 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 198 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 199 request->url = url.spec(); | 199 request->url = url.spec(); |
| 200 client_->TopLevelNavigate(request.Pass()); | 200 client_->TopLevelNavigateRequest(request.Pass()); |
| 201 } | 201 } |
| 202 | 202 |
| 203 //////////////////////////////////////////////////////////////////////////////// | 203 //////////////////////////////////////////////////////////////////////////////// |
| 204 // WebViewImpl, NavigationControllerDelegate implementation: | 204 // WebViewImpl, NavigationControllerDelegate implementation: |
| 205 | 205 |
| 206 void WebViewImpl::OnNavigate(mojo::URLRequestPtr request) { | 206 void WebViewImpl::OnNavigate(mojo::URLRequestPtr request) { |
| 207 client_->TopLevelNavigationStarted(request->url); | |
|
sky
2015/09/21 14:59:46
Are you sure you don't want to notify from OnLoad?
sadrul
2015/09/23 04:32:14
That looks like a better place. Made this change.
| |
| 207 pending_load_.reset(new PendingWebViewLoad(this)); | 208 pending_load_.reset(new PendingWebViewLoad(this)); |
| 208 pending_load_->Init(request.Pass()); | 209 pending_load_->Init(request.Pass()); |
| 209 } | 210 } |
| 210 | 211 |
| 211 void WebViewImpl::OnDidNavigate() { | 212 void WebViewImpl::OnDidNavigate() { |
| 212 client_->BackForwardChanged(navigation_controller_.CanGoBack() | 213 client_->BackForwardChanged(navigation_controller_.CanGoBack() |
| 213 ? ButtonState::BUTTON_STATE_ENABLED | 214 ? ButtonState::BUTTON_STATE_ENABLED |
| 214 : ButtonState::BUTTON_STATE_DISABLED, | 215 : ButtonState::BUTTON_STATE_DISABLED, |
| 215 navigation_controller_.CanGoForward() | 216 navigation_controller_.CanGoForward() |
| 216 ? ButtonState::BUTTON_STATE_ENABLED | 217 ? ButtonState::BUTTON_STATE_ENABLED |
| 217 : ButtonState::BUTTON_STATE_DISABLED); | 218 : ButtonState::BUTTON_STATE_DISABLED); |
| 218 } | 219 } |
| 219 | 220 |
| 220 } // namespace web_view | 221 } // namespace web_view |
| OLD | NEW |