| OLD | NEW |
| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "mojo/public/cpp/application/application.h" | 6 #include "mojo/public/cpp/application/application.h" |
| 7 #include "mojo/services/public/cpp/view_manager/view.h" | 7 #include "mojo/services/public/cpp/view_manager/view.h" |
| 8 #include "mojo/services/public/cpp/view_manager/view_manager.h" | 8 #include "mojo/services/public/cpp/view_manager/view_manager.h" |
| 9 #include "mojo/services/public/cpp/view_manager/view_tree_node.h" | 9 #include "mojo/services/public/cpp/view_manager/view_tree_node.h" |
| 10 | 10 |
| 11 namespace mojo { | 11 namespace mojo { |
| 12 namespace examples { | 12 namespace examples { |
| 13 | 13 |
| 14 class EmbeddedApp : public Application { | 14 class EmbeddedApp : public Application { |
| 15 public: | 15 public: |
| 16 EmbeddedApp() {} | 16 EmbeddedApp() {} |
| 17 virtual ~EmbeddedApp() {} | 17 virtual ~EmbeddedApp() {} |
| 18 | 18 |
| 19 private: | 19 private: |
| 20 // Overridden from Application: | 20 // Overridden from Application: |
| 21 virtual void Initialize() MOJO_OVERRIDE { | 21 virtual void Initialize() MOJO_OVERRIDE { |
| 22 view_manager_ = new view_manager::ViewManager(this); | 22 view_manager_ = view_manager::ViewManager::CreateBlocking(this); |
| 23 view_manager::View* view = view_manager::View::Create(view_manager_); | 23 view_manager::View* view = view_manager::View::Create(view_manager_); |
| 24 view_manager_->tree()->SetActiveView(view); | 24 view_manager_->tree()->SetActiveView(view); |
| 25 view->SetColor(SK_ColorYELLOW); | 25 view->SetColor(SK_ColorYELLOW); |
| 26 } | 26 } |
| 27 | 27 |
| 28 view_manager::ViewManager* view_manager_; | 28 view_manager::ViewManager* view_manager_; |
| 29 | 29 |
| 30 DISALLOW_COPY_AND_ASSIGN(EmbeddedApp); | 30 DISALLOW_COPY_AND_ASSIGN(EmbeddedApp); |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 } // namespace examples | 33 } // namespace examples |
| 34 | 34 |
| 35 // static | 35 // static |
| 36 Application* Application::Create() { | 36 Application* Application::Create() { |
| 37 return new examples::EmbeddedApp; | 37 return new examples::EmbeddedApp; |
| 38 } | 38 } |
| 39 | 39 |
| 40 } // namespace mojo | 40 } // namespace mojo |
| OLD | NEW |