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

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

Issue 1414663002: Mandoline webview: View => Window (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More renaming 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') | no next file » | 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 <queue> 7 #include <queue>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 WebViewImpl::~WebViewImpl() { 57 WebViewImpl::~WebViewImpl() {
58 if (content_) 58 if (content_)
59 content_->RemoveObserver(this); 59 content_->RemoveObserver(this);
60 if (root_) { 60 if (root_) {
61 root_->RemoveObserver(this); 61 root_->RemoveObserver(this);
62 mus::ScopedWindowPtr::DeleteWindowOrWindowManager(root_); 62 mus::ScopedWindowPtr::DeleteWindowOrWindowManager(root_);
63 } 63 }
64 } 64 }
65 65
66 void WebViewImpl::OnLoad(const GURL& pending_url) { 66 void WebViewImpl::OnLoad(const GURL& pending_url) {
67 // Frames are uniqued based on the id of the associated View. By creating a 67 // Frames are uniqued based on the id of the associated Window. By creating a
68 // new View each time through we ensure the renderers get a clean id, rather 68 // new Window each time through we ensure the renderers get a clean id, rather
69 // than one they may know about and try to incorrectly use. 69 // than one they may know about and try to incorrectly use.
70 if (content_) { 70 if (content_) {
71 content_->Destroy(); 71 content_->Destroy();
72 DCHECK(!content_); 72 DCHECK(!content_);
73 } 73 }
74 74
75 client_->TopLevelNavigationStarted(pending_url.spec()); 75 client_->TopLevelNavigationStarted(pending_url.spec());
76 76
77 content_ = root_->connection()->NewWindow(); 77 content_ = root_->connection()->NewWindow();
78 content_->SetBounds(*mojo::Rect::From( 78 content_->SetBounds(*mojo::Rect::From(
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 if (pending_load_ && pending_load_->is_content_handler_id_valid()) 158 if (pending_load_ && pending_load_->is_content_handler_id_valid())
159 OnLoad(pending_load_->pending_url()); 159 OnLoad(pending_load_->pending_url());
160 } 160 }
161 161
162 void WebViewImpl::OnConnectionLost(mus::WindowTreeConnection* connection) { 162 void WebViewImpl::OnConnectionLost(mus::WindowTreeConnection* connection) {
163 root_ = nullptr; 163 root_ = nullptr;
164 } 164 }
165 165
166 //////////////////////////////////////////////////////////////////////////////// 166 ////////////////////////////////////////////////////////////////////////////////
167 // WebViewImpl, mus::ViewObserver implementation: 167 // WebViewImpl, mus::WindowObserver implementation:
168 168
169 void WebViewImpl::OnWindowBoundsChanged(mus::Window* view, 169 void WebViewImpl::OnWindowBoundsChanged(mus::Window* window,
170 const mojo::Rect& old_bounds, 170 const mojo::Rect& old_bounds,
171 const mojo::Rect& new_bounds) { 171 const mojo::Rect& new_bounds) {
172 if (view != content_) { 172 if (window != content_) {
173 mojo::Rect rect; 173 mojo::Rect rect;
174 rect.width = new_bounds.width; 174 rect.width = new_bounds.width;
175 rect.height = new_bounds.height; 175 rect.height = new_bounds.height;
176 if (content_) 176 if (content_)
177 content_->SetBounds(rect); 177 content_->SetBounds(rect);
178 } 178 }
179 } 179 }
180 180
181 void WebViewImpl::OnWindowDestroyed(mus::Window* view) { 181 void WebViewImpl::OnWindowDestroyed(mus::Window* window) {
182 // |FrameTree| cannot outlive the content view. 182 // |FrameTree| cannot outlive the content window.
183 if (view == content_) { 183 if (window == content_) {
184 frame_tree_.reset(); 184 frame_tree_.reset();
185 content_ = nullptr; 185 content_ = nullptr;
186 } 186 }
187 } 187 }
188 188
189 //////////////////////////////////////////////////////////////////////////////// 189 ////////////////////////////////////////////////////////////////////////////////
190 // WebViewImpl, FrameTreeDelegate implementation: 190 // WebViewImpl, FrameTreeDelegate implementation:
191 191
192 scoped_ptr<FrameUserData> WebViewImpl::CreateUserDataForNewFrame( 192 scoped_ptr<FrameUserData> WebViewImpl::CreateUserDataForNewFrame(
193 mojom::FrameClientPtr frame_client) { 193 mojom::FrameClientPtr frame_client) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 std::vector<Frame*> all_frames; 285 std::vector<Frame*> all_frames;
286 PreOrderDepthFirstTraverseTree(frame_tree_->root(), &all_frames); 286 PreOrderDepthFirstTraverseTree(frame_tree_->root(), &all_frames);
287 return all_frames; 287 return all_frames;
288 } 288 }
289 289
290 mojom::WebViewClient* WebViewImpl::GetWebViewClient() { 290 mojom::WebViewClient* WebViewImpl::GetWebViewClient() {
291 return client_.get(); 291 return client_.get();
292 } 292 }
293 293
294 } // namespace web_view 294 } // namespace web_view
OLDNEW
« no previous file with comments | « components/web_view/web_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698