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

Unified Diff: mojo/examples/sample_view_manager_app/sample_view_manager_app.cc

Issue 258623005: First step at synchronizing client model changes with service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mojo/mojo_examples.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | mojo/mojo_examples.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698