| 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 946b57a61b867187095cd591288cabf28acd22bd..43ee7f2a8b9c10819dcfa4a492e54eca28a6ee1c 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,28 @@
|
| 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(shell()));
|
| + 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,
|
| - uint32_t change_id) OVERRIDE {
|
| - }
|
| - virtual void OnNodeViewReplaced(uint32_t node,
|
| - uint32_t old_view_id,
|
| - uint32_t new_view_id,
|
| - uint32_t change_id) OVERRIDE {
|
| - }
|
| -
|
| private:
|
| - void OnCreatedView(bool success) {
|
| - DCHECK(success);
|
| - }
|
| + // SampleApp creates a ViewManager and a trivial node hierarchy.
|
| + scoped_ptr<services::view_manager::ViewManager> view_manager_;
|
| + scoped_ptr<services::view_manager::ViewTreeNode> node_1_;
|
| + scoped_ptr<services::view_manager::ViewTreeNode> node_11_;
|
|
|
| - RemotePtr<services::view_manager::ViewManager> view_manager_;
|
| + DISALLOW_COPY_AND_ASSIGN(SampleApp);
|
| };
|
|
|
| } // namespace examples
|
| @@ -70,8 +56,7 @@ class SampleApp : public Application,
|
|
|
| extern "C" SAMPLE_APP_EXPORT MojoResult CDECL MojoMain(
|
| MojoHandle shell_handle) {
|
| - mojo::Environment env;
|
| - mojo::RunLoop loop;
|
| + base::MessageLoop loop;
|
|
|
| mojo::examples::SampleApp app(shell_handle);
|
| loop.Run();
|
|
|