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

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

Issue 1350223005: mandoline: Make sure omnibox gets updated when navigating back/forwards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tot.merge 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
« no previous file with comments | « components/web_view/web_view_impl.h ('k') | mandoline/ui/desktop_ui/browser_window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 WebViewImpl::~WebViewImpl() { 53 WebViewImpl::~WebViewImpl() {
54 if (content_) 54 if (content_)
55 content_->RemoveObserver(this); 55 content_->RemoveObserver(this);
56 if (root_) { 56 if (root_) {
57 root_->RemoveObserver(this); 57 root_->RemoveObserver(this);
58 mus::ScopedViewPtr::DeleteViewOrViewManager(root_); 58 mus::ScopedViewPtr::DeleteViewOrViewManager(root_);
59 } 59 }
60 } 60 }
61 61
62 void WebViewImpl::OnLoad() { 62 void WebViewImpl::OnLoad(const GURL& pending_url) {
63 // Frames are uniqued based on the id of the associated View. By creating a 63 // Frames are uniqued based on the id of the associated View. By creating a
64 // new View each time through we ensure the renderers get a clean id, rather 64 // new View each time through we ensure the renderers get a clean id, rather
65 // than one they may know about and try to incorrectly use. 65 // than one they may know about and try to incorrectly use.
66 if (content_) { 66 if (content_) {
67 content_->Destroy(); 67 content_->Destroy();
68 DCHECK(!content_); 68 DCHECK(!content_);
69 } 69 }
70 70
71 client_->TopLevelNavigationStarted(pending_url.spec());
72
71 content_ = root_->connection()->CreateView(); 73 content_ = root_->connection()->CreateView();
72 content_->SetBounds(*mojo::Rect::From( 74 content_->SetBounds(*mojo::Rect::From(
73 gfx::Rect(0, 0, root_->bounds().width, root_->bounds().height))); 75 gfx::Rect(0, 0, root_->bounds().width, root_->bounds().height)));
74 root_->AddChild(content_); 76 root_->AddChild(content_);
75 content_->SetVisible(true); 77 content_->SetVisible(true);
76 content_->AddObserver(this); 78 content_->AddObserver(this);
77 79
78 scoped_ptr<PendingWebViewLoad> pending_load(pending_load_.Pass()); 80 scoped_ptr<PendingWebViewLoad> pending_load(pending_load_.Pass());
79 scoped_ptr<FrameConnection> frame_connection( 81 scoped_ptr<FrameConnection> frame_connection(
80 pending_load->frame_connection()); 82 pending_load->frame_connection());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // WebViewImpl, mus::ViewTreeDelegate implementation: 126 // WebViewImpl, mus::ViewTreeDelegate implementation:
125 127
126 void WebViewImpl::OnEmbed(mus::View* root) { 128 void WebViewImpl::OnEmbed(mus::View* root) {
127 // We must have been granted embed root priviledges, otherwise we can't 129 // We must have been granted embed root priviledges, otherwise we can't
128 // Embed() in any descendants. 130 // Embed() in any descendants.
129 DCHECK(root->connection()->IsEmbedRoot()); 131 DCHECK(root->connection()->IsEmbedRoot());
130 root->AddObserver(this); 132 root->AddObserver(this);
131 root_ = root; 133 root_ = root;
132 134
133 if (pending_load_ && pending_load_->is_content_handler_id_valid()) 135 if (pending_load_ && pending_load_->is_content_handler_id_valid())
134 OnLoad(); 136 OnLoad(pending_load_->pending_url());
135 } 137 }
136 138
137 void WebViewImpl::OnConnectionLost(mus::ViewTreeConnection* connection) { 139 void WebViewImpl::OnConnectionLost(mus::ViewTreeConnection* connection) {
138 root_ = nullptr; 140 root_ = nullptr;
139 } 141 }
140 142
141 //////////////////////////////////////////////////////////////////////////////// 143 ////////////////////////////////////////////////////////////////////////////////
142 // WebViewImpl, mus::ViewObserver implementation: 144 // WebViewImpl, mus::ViewObserver implementation:
143 145
144 void WebViewImpl::OnViewBoundsChanged(mus::View* view, 146 void WebViewImpl::OnViewBoundsChanged(mus::View* view,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 180
179 void WebViewImpl::LoadingStateChanged(bool loading, double progress) { 181 void WebViewImpl::LoadingStateChanged(bool loading, double progress) {
180 client_->LoadingStateChanged(loading, progress); 182 client_->LoadingStateChanged(loading, progress);
181 } 183 }
182 184
183 void WebViewImpl::TitleChanged(const mojo::String& title) { 185 void WebViewImpl::TitleChanged(const mojo::String& title) {
184 client_->TitleChanged(title); 186 client_->TitleChanged(title);
185 } 187 }
186 188
187 void WebViewImpl::NavigateTopLevel(Frame* source, mojo::URLRequestPtr request) { 189 void WebViewImpl::NavigateTopLevel(Frame* source, mojo::URLRequestPtr request) {
188 client_->TopLevelNavigate(request.Pass()); 190 client_->TopLevelNavigateRequest(request.Pass());
189 } 191 }
190 192
191 void WebViewImpl::CanNavigateFrame(Frame* target, 193 void WebViewImpl::CanNavigateFrame(Frame* target,
192 mojo::URLRequestPtr request, 194 mojo::URLRequestPtr request,
193 const CanNavigateFrameCallback& callback) { 195 const CanNavigateFrameCallback& callback) {
194 FrameConnection::CreateConnectionForCanNavigateFrame( 196 FrameConnection::CreateConnectionForCanNavigateFrame(
195 app_, target, request.Pass(), callback); 197 app_, target, request.Pass(), callback);
196 } 198 }
197 199
198 void WebViewImpl::DidStartNavigation(Frame* frame) {} 200 void WebViewImpl::DidStartNavigation(Frame* frame) {}
199 201
200 void WebViewImpl::DidCommitProvisionalLoad(Frame* frame) { 202 void WebViewImpl::DidCommitProvisionalLoad(Frame* frame) {
201 navigation_controller_.FrameDidCommitProvisionalLoad(frame); 203 navigation_controller_.FrameDidCommitProvisionalLoad(frame);
202 } 204 }
203 205
204 //////////////////////////////////////////////////////////////////////////////// 206 ////////////////////////////////////////////////////////////////////////////////
205 // WebViewImpl, FrameDevToolsAgentDelegate implementation: 207 // WebViewImpl, FrameDevToolsAgentDelegate implementation:
206 208
207 void WebViewImpl::HandlePageNavigateRequest(const GURL& url) { 209 void WebViewImpl::HandlePageNavigateRequest(const GURL& url) {
208 mojo::URLRequestPtr request(mojo::URLRequest::New()); 210 mojo::URLRequestPtr request(mojo::URLRequest::New());
209 request->url = url.spec(); 211 request->url = url.spec();
210 client_->TopLevelNavigate(request.Pass()); 212 client_->TopLevelNavigateRequest(request.Pass());
211 } 213 }
212 214
213 //////////////////////////////////////////////////////////////////////////////// 215 ////////////////////////////////////////////////////////////////////////////////
214 // WebViewImpl, NavigationControllerDelegate implementation: 216 // WebViewImpl, NavigationControllerDelegate implementation:
215 217
216 void WebViewImpl::OnNavigate(mojo::URLRequestPtr request) { 218 void WebViewImpl::OnNavigate(mojo::URLRequestPtr request) {
217 pending_load_.reset(new PendingWebViewLoad(this)); 219 pending_load_.reset(new PendingWebViewLoad(this));
218 pending_load_->Init(request.Pass()); 220 pending_load_->Init(request.Pass());
219 } 221 }
220 222
221 void WebViewImpl::OnDidNavigate() { 223 void WebViewImpl::OnDidNavigate() {
222 client_->BackForwardChanged(navigation_controller_.CanGoBack() 224 client_->BackForwardChanged(navigation_controller_.CanGoBack()
223 ? ButtonState::BUTTON_STATE_ENABLED 225 ? ButtonState::BUTTON_STATE_ENABLED
224 : ButtonState::BUTTON_STATE_DISABLED, 226 : ButtonState::BUTTON_STATE_DISABLED,
225 navigation_controller_.CanGoForward() 227 navigation_controller_.CanGoForward()
226 ? ButtonState::BUTTON_STATE_ENABLED 228 ? ButtonState::BUTTON_STATE_ENABLED
227 : ButtonState::BUTTON_STATE_DISABLED); 229 : ButtonState::BUTTON_STATE_DISABLED);
228 } 230 }
229 231
230 } // namespace web_view 232 } // namespace web_view
OLDNEW
« no previous file with comments | « components/web_view/web_view_impl.h ('k') | mandoline/ui/desktop_ui/browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698