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

Side by Side Diff: mojo/examples/aura_demo/aura_demo.cc

Issue 418983002: Nukes view_manager namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: resolve merge Created 6 years, 5 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/aura/window_tree_host_mojo.cc ('k') | mojo/examples/aura_demo/view_manager_init.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stdio.h> 5 #include <stdio.h>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "mojo/aura/context_factory_mojo.h" 9 #include "mojo/aura/context_factory_mojo.h"
10 #include "mojo/aura/screen_mojo.h" 10 #include "mojo/aura/screen_mojo.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 private: 101 private:
102 aura::Window* window_; 102 aura::Window* window_;
103 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; 103 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_;
104 104
105 DISALLOW_COPY_AND_ASSIGN(DemoWindowTreeClient); 105 DISALLOW_COPY_AND_ASSIGN(DemoWindowTreeClient);
106 }; 106 };
107 107
108 class AuraDemo : public ApplicationDelegate, 108 class AuraDemo : public ApplicationDelegate,
109 public WindowTreeHostMojoDelegate, 109 public WindowTreeHostMojoDelegate,
110 public view_manager::ViewManagerDelegate { 110 public ViewManagerDelegate {
111 public: 111 public:
112 AuraDemo() 112 AuraDemo()
113 : window1_(NULL), 113 : window1_(NULL),
114 window2_(NULL), 114 window2_(NULL),
115 window21_(NULL), 115 window21_(NULL),
116 view_(NULL), 116 view_(NULL),
117 view_manager_client_factory_(this) {} 117 view_manager_client_factory_(this) {}
118 virtual ~AuraDemo() {} 118 virtual ~AuraDemo() {}
119 119
120 private: 120 private:
121 // Overridden from view_manager::ViewManagerDelegate: 121 // Overridden from ViewManagerDelegate:
122 virtual void OnRootAdded(view_manager::ViewManager* view_manager, 122 virtual void OnRootAdded(ViewManager* view_manager, Node* root) OVERRIDE {
123 view_manager::Node* root) OVERRIDE {
124 // TODO(beng): this function could be called multiple times! 123 // TODO(beng): this function could be called multiple times!
125 view_ = view_manager::View::Create(view_manager); 124 view_ = View::Create(view_manager);
126 root->SetActiveView(view_); 125 root->SetActiveView(view_);
127 126
128 window_tree_host_.reset(new WindowTreeHostMojo(root, this)); 127 window_tree_host_.reset(new WindowTreeHostMojo(root, this));
129 window_tree_host_->InitHost(); 128 window_tree_host_->InitHost();
130 129
131 window_tree_client_.reset( 130 window_tree_client_.reset(
132 new DemoWindowTreeClient(window_tree_host_->window())); 131 new DemoWindowTreeClient(window_tree_host_->window()));
133 132
134 delegate1_.reset(new DemoWindowDelegate(SK_ColorBLUE)); 133 delegate1_.reset(new DemoWindowDelegate(SK_ColorBLUE));
135 window1_ = new aura::Window(delegate1_.get()); 134 window1_ = new aura::Window(delegate1_.get());
(...skipping 12 matching lines...) Expand all
148 delegate21_.reset(new DemoWindowDelegate(SK_ColorGREEN)); 147 delegate21_.reset(new DemoWindowDelegate(SK_ColorGREEN));
149 window21_ = new aura::Window(delegate21_.get()); 148 window21_ = new aura::Window(delegate21_.get());
150 window21_->Init(aura::WINDOW_LAYER_TEXTURED); 149 window21_->Init(aura::WINDOW_LAYER_TEXTURED);
151 window21_->SetBounds(gfx::Rect(10, 10, 50, 50)); 150 window21_->SetBounds(gfx::Rect(10, 10, 50, 50));
152 window21_->Show(); 151 window21_->Show();
153 window2_->AddChild(window21_); 152 window2_->AddChild(window21_);
154 153
155 window_tree_host_->Show(); 154 window_tree_host_->Show();
156 } 155 }
157 virtual void OnViewManagerDisconnected( 156 virtual void OnViewManagerDisconnected(
158 view_manager::ViewManager* view_manager) OVERRIDE { 157 ViewManager* view_manager) OVERRIDE {
159 base::MessageLoop::current()->Quit(); 158 base::MessageLoop::current()->Quit();
160 } 159 }
161 160
162 // WindowTreeHostMojoDelegate: 161 // WindowTreeHostMojoDelegate:
163 virtual void CompositorContentsChanged(const SkBitmap& bitmap) OVERRIDE { 162 virtual void CompositorContentsChanged(const SkBitmap& bitmap) OVERRIDE {
164 view_->SetContents(bitmap); 163 view_->SetContents(bitmap);
165 } 164 }
166 165
167 virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE { 166 virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE {
168 aura::Env::CreateInstance(true); 167 aura::Env::CreateInstance(true);
(...skipping 16 matching lines...) Expand all
185 scoped_ptr<ScreenMojo> screen_; 184 scoped_ptr<ScreenMojo> screen_;
186 185
187 scoped_ptr<DemoWindowDelegate> delegate1_; 186 scoped_ptr<DemoWindowDelegate> delegate1_;
188 scoped_ptr<DemoWindowDelegate> delegate2_; 187 scoped_ptr<DemoWindowDelegate> delegate2_;
189 scoped_ptr<DemoWindowDelegate> delegate21_; 188 scoped_ptr<DemoWindowDelegate> delegate21_;
190 189
191 aura::Window* window1_; 190 aura::Window* window1_;
192 aura::Window* window2_; 191 aura::Window* window2_;
193 aura::Window* window21_; 192 aura::Window* window21_;
194 193
195 view_manager::View* view_; 194 View* view_;
196 195
197 view_manager::ViewManagerClientFactory view_manager_client_factory_; 196 ViewManagerClientFactory view_manager_client_factory_;
198 197
199 scoped_ptr<aura::WindowTreeHost> window_tree_host_; 198 scoped_ptr<aura::WindowTreeHost> window_tree_host_;
200 199
201 DISALLOW_COPY_AND_ASSIGN(AuraDemo); 200 DISALLOW_COPY_AND_ASSIGN(AuraDemo);
202 }; 201 };
203 202
204 } // namespace examples 203 } // namespace examples
205 204
206 // static 205 // static
207 ApplicationDelegate* ApplicationDelegate::Create() { 206 ApplicationDelegate* ApplicationDelegate::Create() {
208 return new examples::AuraDemo(); 207 return new examples::AuraDemo();
209 } 208 }
210 209
211 } // namespace mojo 210 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/aura/window_tree_host_mojo.cc ('k') | mojo/examples/aura_demo/view_manager_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698