Chromium Code Reviews| Index: mojo/examples/sample_view_manager_app/sample_view_manager_app.cc |
| diff --git a/mojo/examples/sample_view_manager_app/sample_view_manager_app.cc b/mojo/examples/sample_view_manager_app/sample_view_manager_app.cc |
| index 38682a6ed28fe3f78e9f77d8ab4b8e12ba505a12..c8c60de9e3c3f6c1e427ee5f2fbccd1a8e3f3b2a 100644 |
| --- a/mojo/examples/sample_view_manager_app/sample_view_manager_app.cc |
| +++ b/mojo/examples/sample_view_manager_app/sample_view_manager_app.cc |
| @@ -2,16 +2,17 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include "base/at_exit.h" |
| #include "base/bind.h" |
| -#include "mojo/public/cpp/bindings/allocation_scope.h" |
| -#include "mojo/public/cpp/bindings/remote_ptr.h" |
| +#include "base/command_line.h" |
| +#include "base/message_loop/message_loop.h" |
| #include "mojo/public/cpp/environment/environment.h" |
| #include "mojo/public/cpp/shell/application.h" |
| #include "mojo/public/cpp/system/core.h" |
| #include "mojo/public/cpp/system/macros.h" |
| #include "mojo/public/cpp/utility/run_loop.h" |
| -#include "mojo/public/interfaces/shell/shell.mojom.h" |
| -#include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
| +#include "mojo/services/public/cpp/view_manager/view_manager.h" |
| +#include "mojo/services/public/cpp/view_manager/view_tree_node.h" |
| #if defined(WIN32) |
| #if !defined(CDECL) |
| @@ -26,43 +27,27 @@ |
| namespace mojo { |
| namespace examples { |
| -class SampleApp : public Application, |
| - public services::view_manager::ViewManagerClient { |
| +class SampleApp : public Application { |
| public: |
| - explicit SampleApp(MojoHandle shell_handle) : Application(shell_handle) { |
| - InterfacePipe<services::view_manager::ViewManager, AnyInterface> |
| - view_manager_pipe; |
| - AllocationScope scope; |
| - shell()->Connect("mojo:mojo_view_manager", |
| - view_manager_pipe.handle_to_peer.Pass()); |
| - view_manager_.reset(view_manager_pipe.handle_to_self.Pass(), this); |
| - view_manager_->CreateNode(1, base::Bind(&SampleApp::OnCreatedView, |
| - base::Unretained(this))); |
| + explicit SampleApp(MojoHandle shell_handle) |
| + : Application(shell_handle) { |
| + view_manager_.reset(new services::view_manager::ViewManager(this)); |
| + node_1_.reset( |
| + new services::view_manager::ViewTreeNode(view_manager_.get())); |
| + node_11_.reset( |
| + new services::view_manager::ViewTreeNode(view_manager_.get())); |
| + node_1_->AddChild(node_11_.get()); |
| } |
| virtual ~SampleApp() { |
| } |
| - // ViewManagerClient:: |
| - virtual void OnConnectionEstablished(uint16_t connection_id) OVERRIDE { |
| - } |
| - virtual void OnNodeHierarchyChanged(uint32_t node, |
| - uint32_t new_parent, |
| - uint32_t old_parent, |
| - int32_t change_id) OVERRIDE { |
| - } |
| - virtual void OnNodeViewReplaced(uint32_t node, |
| - uint32_t old_view_id, |
| - uint32_t new_view_id, |
| - int32_t change_id) OVERRIDE { |
| - } |
| - |
| private: |
| - void OnCreatedView(bool success) { |
| - DCHECK(success); |
| - } |
| + scoped_ptr<services::view_manager::ViewManager> view_manager_; |
| + scoped_ptr<services::view_manager::ViewTreeNode> node_1_; |
|
sky
2014/04/28 23:04:19
Add descriptions for these.
|
| + scoped_ptr<services::view_manager::ViewTreeNode> node_11_; |
| - RemotePtr<services::view_manager::ViewManager> view_manager_; |
| + DISALLOW_COPY_AND_ASSIGN(SampleApp); |
| }; |
| } // namespace examples |
| @@ -70,8 +55,8 @@ class SampleApp : public Application, |
| extern "C" SAMPLE_APP_EXPORT MojoResult CDECL MojoMain( |
| MojoHandle shell_handle) { |
| - mojo::Environment env; |
| - mojo::RunLoop loop; |
| +// mojo::RunLoop loop; |
|
sky
2014/04/28 23:04:19
?
|
| + base::MessageLoop loop; |
| mojo::examples::SampleApp app(shell_handle); |
| loop.Run(); |