| 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/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "mojo/public/cpp/environment/environment.h" | 9 #include "mojo/public/cpp/environment/environment.h" |
| 10 #include "mojo/public/cpp/shell/application.h" | 10 #include "mojo/public/cpp/shell/application.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 namespace mojo { | 27 namespace mojo { |
| 28 namespace examples { | 28 namespace examples { |
| 29 | 29 |
| 30 class SampleApp : public Application { | 30 class SampleApp : public Application { |
| 31 public: | 31 public: |
| 32 explicit SampleApp(MojoHandle shell_handle) | 32 explicit SampleApp(MojoHandle shell_handle) |
| 33 : Application(shell_handle) { | 33 : Application(shell_handle) { |
| 34 view_manager_.reset(new services::view_manager::ViewManager(shell())); | 34 view_manager_.reset(new services::view_manager::ViewManager(shell())); |
| 35 node_1_.reset( | 35 view_manager_->Init(); |
| 36 new services::view_manager::ViewTreeNode(view_manager_.get())); | 36 services::view_manager::ViewTreeNode* node1 = |
| 37 node_11_.reset( | 37 services::view_manager::ViewTreeNode::Create(view_manager_.get()); |
| 38 new services::view_manager::ViewTreeNode(view_manager_.get())); | 38 services::view_manager::ViewTreeNode* node11 = |
| 39 node_1_->AddChild(node_11_.get()); | 39 services::view_manager::ViewTreeNode::Create(view_manager_.get()); |
| 40 node1->AddChild(node11); |
| 40 } | 41 } |
| 41 | 42 |
| 42 virtual ~SampleApp() { | 43 virtual ~SampleApp() { |
| 43 } | 44 } |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 // SampleApp creates a ViewManager and a trivial node hierarchy. | 47 // SampleApp creates a ViewManager and a trivial node hierarchy. |
| 47 scoped_ptr<services::view_manager::ViewManager> view_manager_; | 48 scoped_ptr<services::view_manager::ViewManager> view_manager_; |
| 48 scoped_ptr<services::view_manager::ViewTreeNode> node_1_; | |
| 49 scoped_ptr<services::view_manager::ViewTreeNode> node_11_; | |
| 50 | 49 |
| 51 DISALLOW_COPY_AND_ASSIGN(SampleApp); | 50 DISALLOW_COPY_AND_ASSIGN(SampleApp); |
| 52 }; | 51 }; |
| 53 | 52 |
| 54 } // namespace examples | 53 } // namespace examples |
| 55 } // namespace mojo | 54 } // namespace mojo |
| 56 | 55 |
| 57 extern "C" SAMPLE_APP_EXPORT MojoResult CDECL MojoMain( | 56 extern "C" SAMPLE_APP_EXPORT MojoResult CDECL MojoMain( |
| 58 MojoHandle shell_handle) { | 57 MojoHandle shell_handle) { |
| 59 base::MessageLoop loop; | 58 base::MessageLoop loop; |
| 60 | 59 |
| 61 mojo::examples::SampleApp app(shell_handle); | 60 mojo::examples::SampleApp app(shell_handle); |
| 62 loop.Run(); | 61 loop.Run(); |
| 63 return MOJO_RESULT_OK; | 62 return MOJO_RESULT_OK; |
| 64 } | 63 } |
| OLD | NEW |