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

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

Issue 1340983002: Mandoline UI Process: Update namespaces and file names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 3 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/frame.h ('k') | components/web_view/frame_apptest.cc » ('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/frame.h" 5 #include "components/web_view/frame.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "components/mus/public/cpp/view.h" 13 #include "components/mus/public/cpp/view.h"
14 #include "components/mus/public/cpp/view_property.h" 14 #include "components/mus/public/cpp/view_property.h"
15 #include "components/web_view/frame_tree.h" 15 #include "components/web_view/frame_tree.h"
16 #include "components/web_view/frame_tree_delegate.h" 16 #include "components/web_view/frame_tree_delegate.h"
17 #include "components/web_view/frame_user_data.h" 17 #include "components/web_view/frame_user_data.h"
18 #include "components/web_view/frame_utils.h" 18 #include "components/web_view/frame_utils.h"
19 #include "mojo/application/public/interfaces/shell.mojom.h" 19 #include "mojo/application/public/interfaces/shell.mojom.h"
20 20
21 using mojo::View; 21 using mus::View;
22 22
23 DECLARE_VIEW_PROPERTY_TYPE(web_view::Frame*); 23 DECLARE_VIEW_PROPERTY_TYPE(web_view::Frame*);
24 24
25 namespace web_view { 25 namespace web_view {
26 26
27 // Used to find the Frame associated with a View. 27 // Used to find the Frame associated with a View.
28 DEFINE_LOCAL_VIEW_PROPERTY_KEY(Frame*, kFrame, nullptr); 28 DEFINE_LOCAL_VIEW_PROPERTY_KEY(Frame*, kFrame, nullptr);
29 29
30 namespace { 30 namespace {
31 31
32 const uint32_t kNoParentId = 0u; 32 const uint32_t kNoParentId = 0u;
33 const mojo::ConnectionSpecificId kInvalidConnectionId = 0u; 33 const mus::ConnectionSpecificId kInvalidConnectionId = 0u;
34 34
35 FrameDataPtr FrameToFrameData(const Frame* frame) { 35 FrameDataPtr FrameToFrameData(const Frame* frame) {
36 FrameDataPtr frame_data(FrameData::New()); 36 FrameDataPtr frame_data(FrameData::New());
37 frame_data->frame_id = frame->id(); 37 frame_data->frame_id = frame->id();
38 frame_data->parent_id = frame->parent() ? frame->parent()->id() : kNoParentId; 38 frame_data->parent_id = frame->parent() ? frame->parent()->id() : kNoParentId;
39 frame_data->client_properties = 39 frame_data->client_properties =
40 mojo::Map<mojo::String, mojo::Array<uint8_t>>::From( 40 mojo::Map<mojo::String, mojo::Array<uint8_t>>::From(
41 frame->client_properties()); 41 frame->client_properties());
42 return frame_data.Pass(); 42 return frame_data.Pass();
43 } 43 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 213
214 user_data_ = user_data.Pass(); 214 user_data_ = user_data.Pass();
215 frame_tree_client_ = frame_tree_client; 215 frame_tree_client_ = frame_tree_client;
216 frame_tree_server_binding_.reset(); 216 frame_tree_server_binding_.reset();
217 app_id_ = app_id; 217 app_id_ = app_id;
218 218
219 InitClient(client_type, frame_tree_server_binding.Pass(), 219 InitClient(client_type, frame_tree_server_binding.Pass(),
220 view_tree_client.Pass()); 220 view_tree_client.Pass());
221 } 221 }
222 222
223 void Frame::OnEmbedAck(bool success, mojo::ConnectionSpecificId connection_id) { 223 void Frame::OnEmbedAck(bool success, mus::ConnectionSpecificId connection_id) {
224 if (success) 224 if (success)
225 embedded_connection_id_ = connection_id; 225 embedded_connection_id_ = connection_id;
226 } 226 }
227 227
228 void Frame::SetView(mojo::View* view) { 228 void Frame::SetView(mus::View* view) {
229 DCHECK(!view_); 229 DCHECK(!view_);
230 DCHECK_EQ(id_, view->id()); 230 DCHECK_EQ(id_, view->id());
231 view_ = view; 231 view_ = view;
232 view_->SetLocalProperty(kFrame, this); 232 view_->SetLocalProperty(kFrame, this);
233 view_->AddObserver(this); 233 view_->AddObserver(this);
234 if (pending_navigate_.get()) 234 if (pending_navigate_.get())
235 StartNavigate(pending_navigate_.Pass()); 235 StartNavigate(pending_navigate_.Pass());
236 } 236 }
237 237
238 Frame* Frame::GetAncestorWithFrameTreeClient() { 238 Frame* Frame::GetAncestorWithFrameTreeClient() {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 } 388 }
389 389
390 void Frame::OnTreeChanged(const TreeChangeParams& params) { 390 void Frame::OnTreeChanged(const TreeChangeParams& params) {
391 if (params.new_parent && this == tree_->root()) { 391 if (params.new_parent && this == tree_->root()) {
392 Frame* child_frame = FindFrame(params.target->id()); 392 Frame* child_frame = FindFrame(params.target->id());
393 if (child_frame && !child_frame->view_) 393 if (child_frame && !child_frame->view_)
394 child_frame->SetView(params.target); 394 child_frame->SetView(params.target);
395 } 395 }
396 } 396 }
397 397
398 void Frame::OnViewDestroying(mojo::View* view) { 398 void Frame::OnViewDestroying(mus::View* view) {
399 if (parent_) 399 if (parent_)
400 parent_->Remove(this); 400 parent_->Remove(this);
401 401
402 // Reset |view_ownership_| so we don't attempt to delete |view_| in the 402 // Reset |view_ownership_| so we don't attempt to delete |view_| in the
403 // destructor. 403 // destructor.
404 view_ownership_ = ViewOwnership::DOESNT_OWN_VIEW; 404 view_ownership_ = ViewOwnership::DOESNT_OWN_VIEW;
405 405
406 if (tree_->root() == this) { 406 if (tree_->root() == this) {
407 view_->RemoveObserver(this); 407 view_->RemoveObserver(this);
408 view_ = nullptr; 408 view_ = nullptr;
409 return; 409 return;
410 } 410 }
411 411
412 delete this; 412 delete this;
413 } 413 }
414 414
415 void Frame::OnViewEmbeddedAppDisconnected(mojo::View* view) { 415 void Frame::OnViewEmbeddedAppDisconnected(mus::View* view) {
416 // See FrameTreeDelegate::OnViewEmbeddedAppDisconnected() for details of when 416 // See FrameTreeDelegate::OnViewEmbeddedAppDisconnected() for details of when
417 // this happens. 417 // this happens.
418 // 418 //
419 // Currently we have no way to distinguish between the cases that lead to this 419 // Currently we have no way to distinguish between the cases that lead to this
420 // being called, so we assume we can continue on. Continuing on is important 420 // being called, so we assume we can continue on. Continuing on is important
421 // for html as it's entirely possible for a page to create a frame, navigate 421 // for html as it's entirely possible for a page to create a frame, navigate
422 // to a bogus url and expect the frame to still exist. 422 // to a bogus url and expect the frame to still exist.
423 // 423 //
424 // TODO(sky): notify the delegate on this? At a minimum the delegate cares 424 // TODO(sky): notify the delegate on this? At a minimum the delegate cares
425 // if the root is unembedded as this would correspond to a sab tab. 425 // if the root is unembedded as this would correspond to a sab tab.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 // Else case if |target_frame| == root. Treat at top level request. 515 // Else case if |target_frame| == root. Treat at top level request.
516 } 516 }
517 tree_->delegate_->NavigateTopLevel(this, request.Pass()); 517 tree_->delegate_->NavigateTopLevel(this, request.Pass());
518 } 518 }
519 519
520 void Frame::DidNavigateLocally(uint32_t frame_id, const mojo::String& url) { 520 void Frame::DidNavigateLocally(uint32_t frame_id, const mojo::String& url) {
521 NOTIMPLEMENTED(); 521 NOTIMPLEMENTED();
522 } 522 }
523 523
524 } // namespace web_view 524 } // namespace web_view
OLDNEW
« no previous file with comments | « components/web_view/frame.h ('k') | components/web_view/frame_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698