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

Side by Side Diff: mojo/examples/wm_flow/wm/wm.cc

Issue 460863002: Rename Node to View in the View Manager mojom & client lib. Service TBD. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « mojo/examples/wm_flow/embedded/embedded.cc ('k') | mojo/mojo_services.gypi » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/public/cpp/application/application_delegate.h" 5 #include "mojo/public/cpp/application/application_delegate.h"
6 #include "mojo/public/cpp/application/service_provider_impl.h" 6 #include "mojo/public/cpp/application/service_provider_impl.h"
7 #include "mojo/services/public/cpp/view_manager/view_manager.h" 7 #include "mojo/services/public/cpp/view_manager/view_manager.h"
8 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" 8 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
9 #include "mojo/services/public/cpp/view_manager/window_manager_delegate.h" 9 #include "mojo/services/public/cpp/view_manager/window_manager_delegate.h"
10 #include "mojo/services/window_manager/window_manager_app.h" 10 #include "mojo/services/window_manager/window_manager_app.h"
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 virtual bool ConfigureIncomingConnection( 31 virtual bool ConfigureIncomingConnection(
32 mojo::ApplicationConnection* connection) MOJO_OVERRIDE { 32 mojo::ApplicationConnection* connection) MOJO_OVERRIDE {
33 window_manager_app_->ConfigureIncomingConnection(connection); 33 window_manager_app_->ConfigureIncomingConnection(connection);
34 return true; 34 return true;
35 } 35 }
36 36
37 // Overridden from mojo::ViewManagerDelegate: 37 // Overridden from mojo::ViewManagerDelegate:
38 virtual void OnEmbed( 38 virtual void OnEmbed(
39 mojo::ViewManager* view_manager, 39 mojo::ViewManager* view_manager,
40 mojo::Node* root, 40 mojo::View* root,
41 mojo::ServiceProviderImpl* exported_services, 41 mojo::ServiceProviderImpl* exported_services,
42 scoped_ptr<mojo::ServiceProvider> remote_service_provider) MOJO_OVERRIDE { 42 scoped_ptr<mojo::ServiceProvider> remote_service_provider) MOJO_OVERRIDE {
43 view_manager_ = view_manager; 43 view_manager_ = view_manager;
44 root_ = root; 44 root_ = root;
45 view_manager_->SetWindowManagerDelegate(this); 45 view_manager_->SetWindowManagerDelegate(this);
46 46
47 window_container_ = mojo::Node::Create(view_manager_); 47 window_container_ = mojo::View::Create(view_manager_);
48 window_container_->SetBounds(root_->bounds()); 48 window_container_->SetBounds(root_->bounds());
49 root_->AddChild(window_container_); 49 root_->AddChild(window_container_);
50 50
51 } 51 }
52 virtual void OnViewManagerDisconnected( 52 virtual void OnViewManagerDisconnected(
53 mojo::ViewManager* view_manager) MOJO_OVERRIDE { 53 mojo::ViewManager* view_manager) MOJO_OVERRIDE {
54 view_manager_ = NULL; 54 view_manager_ = NULL;
55 root_ = NULL; 55 root_ = NULL;
56 } 56 }
57 57
58 // Overridden from mojo::WindowManagerDelegate: 58 // Overridden from mojo::WindowManagerDelegate:
59 virtual void Embed( 59 virtual void Embed(
60 const mojo::String& url, 60 const mojo::String& url,
61 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) 61 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider)
62 MOJO_OVERRIDE { 62 MOJO_OVERRIDE {
63 mojo::Node* embed_node = 63 mojo::View* embed_view = mojo::View::Create(view_manager_);
64 mojo::Node::Create(view_manager_); 64 embed_view->SetBounds(gfx::Rect(next_window_origin_, gfx::Size(400, 400)));
65 embed_node->SetBounds(gfx::Rect(next_window_origin_, gfx::Size(400, 400))); 65 window_container_->AddChild(embed_view);
66 window_container_->AddChild(embed_node);
67 66
68 // TODO(beng): We're dropping the |service_provider| passed from the client 67 // TODO(beng): We're dropping the |service_provider| passed from the client
69 // on the floor here and passing our own. Seems like we should 68 // on the floor here and passing our own. Seems like we should
70 // be sending both. I'm not yet sure how this sould work for 69 // be sending both. I'm not yet sure how this sould work for
71 // N levels of proxying. 70 // N levels of proxying.
72 embed_node->Embed(url, scoped_ptr<mojo::ServiceProviderImpl>( 71 embed_view->Embed(url, scoped_ptr<mojo::ServiceProviderImpl>(
73 new mojo::ServiceProviderImpl).Pass()); 72 new mojo::ServiceProviderImpl).Pass());
74 next_window_origin_.Offset(50, 50); 73 next_window_origin_.Offset(50, 50);
75 } 74 }
76 virtual void DispatchEvent(mojo::Node* target, 75 virtual void DispatchEvent(mojo::View* target,
77 mojo::EventPtr event) MOJO_OVERRIDE { 76 mojo::EventPtr event) MOJO_OVERRIDE {
78 view_manager_->DispatchEvent(target, event.Pass()); 77 view_manager_->DispatchEvent(target, event.Pass());
79 } 78 }
80 79
81 scoped_ptr<mojo::WindowManagerApp> window_manager_app_; 80 scoped_ptr<mojo::WindowManagerApp> window_manager_app_;
82 81
83 mojo::ViewManager* view_manager_; 82 mojo::ViewManager* view_manager_;
84 mojo::Node* root_; 83 mojo::View* root_;
85 mojo::Node* window_container_; 84 mojo::View* window_container_;
86 85
87 gfx::Point next_window_origin_; 86 gfx::Point next_window_origin_;
88 87
89 DISALLOW_COPY_AND_ASSIGN(SimpleWM); 88 DISALLOW_COPY_AND_ASSIGN(SimpleWM);
90 }; 89 };
91 90
92 } // namespace examples 91 } // namespace examples
93 92
94 namespace mojo { 93 namespace mojo {
95 94
96 // static 95 // static
97 ApplicationDelegate* ApplicationDelegate::Create() { 96 ApplicationDelegate* ApplicationDelegate::Create() {
98 return new examples::SimpleWM; 97 return new examples::SimpleWM;
99 } 98 }
100 99
101 } // namespace 100 } // namespace
OLDNEW
« no previous file with comments | « mojo/examples/wm_flow/embedded/embedded.cc ('k') | mojo/mojo_services.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698