summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvadimsh@chromium.org <vadimsh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-22 18:50:59 +0000
committervadimsh@chromium.org <vadimsh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-22 18:50:59 +0000
commit66b31f81a284cf3f2936585d43e8d3bcb9ac6119 (patch)
treee777a9c548ea9103af71461c222addf8fa357a17
parent90efc3e940aa41ccb7af3c7f6d128282999f7e3f (diff)
downloadchromium_src-66b31f81a284cf3f2936585d43e8d3bcb9ac6119.zip
chromium_src-66b31f81a284cf3f2936585d43e8d3bcb9ac6119.tar.gz
chromium_src-66b31f81a284cf3f2936585d43e8d3bcb9ac6119.tar.bz2
Revert of Start of server side of viewmanager (https://codereview.chromium.org/245663002/)
Reason for revert: Win x64 Builder (dbg) failed to link mojo_sample_view_manager_app.dll. See http://build.chromium.org/p/chromium.win/builders/Win%20x64%20Builder%20%28dbg%29/builds/7556. Original issue's description: > Start of server side of viewmanager > > I'll figure out tests then notifications next. > > BUG=365012 > TEST=none > R=ben@chromium.org > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=265180 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=265300 TBR=ben@chromium.org,sky@chromium.org NOTREECHECKS=true NOTRY=true BUG=365012 Review URL: https://codereview.chromium.org/247913002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265312 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--mojo/examples/sample_view_manager_app/sample_view_manager_app.cc69
-rw-r--r--mojo/examples/view_manager/DEPS (renamed from mojo/services/view_manager/DEPS)2
-rw-r--r--mojo/examples/view_manager/view_manager.cc150
-rw-r--r--mojo/examples/view_manager/view_manager.mojom26
-rw-r--r--mojo/mojo.gyp1
-rw-r--r--mojo/mojo_examples.gypi44
-rw-r--r--mojo/mojo_services.gypi56
-rw-r--r--mojo/services/public/interfaces/view_manager/view_manager.mojom37
-rw-r--r--mojo/services/view_manager/root_view_manager.cc64
-rw-r--r--mojo/services/view_manager/root_view_manager.h65
-rw-r--r--mojo/services/view_manager/view.cc41
-rw-r--r--mojo/services/view_manager/view.h38
-rw-r--r--mojo/services/view_manager/view_manager.cc32
-rw-r--r--mojo/services/view_manager/view_manager_connection.cc85
-rw-r--r--mojo/services/view_manager/view_manager_connection.h68
15 files changed, 209 insertions, 569 deletions
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
deleted file mode 100644
index 116a68e..0000000
--- a/mojo/examples/sample_view_manager_app/sample_view_manager_app.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/bind.h"
-#include "mojo/public/cpp/bindings/allocation_scope.h"
-#include "mojo/public/cpp/bindings/remote_ptr.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"
-
-#if defined(WIN32)
-#if !defined(CDECL)
-#define CDECL __cdecl
-#endif
-#define SAMPLE_APP_EXPORT __declspec(dllexport)
-#else
-#define CDECL
-#define SAMPLE_APP_EXPORT __attribute__((visibility("default")))
-#endif
-
-namespace mojo {
-namespace examples {
-
-class SampleApp : public Application,
- public services::view_manager::ViewManagerClient {
- 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_->CreateView(1, base::Bind(&SampleApp::OnCreatedView,
- base::Unretained(this)));
- }
-
- virtual ~SampleApp() {
- }
-
- // ViewManagerClient::
- virtual void OnConnectionEstablished(int32_t manager_id) OVERRIDE {
- }
-
- private:
- void OnCreatedView(bool success) {
- DCHECK(success);
- }
-
- RemotePtr<services::view_manager::ViewManager> view_manager_;
-};
-
-} // namespace examples
-} // namespace mojo
-
-extern "C" SAMPLE_APP_EXPORT MojoResult CDECL MojoMain(
- MojoHandle shell_handle) {
- mojo::Environment env;
- mojo::RunLoop loop;
-
- mojo::examples::SampleApp app(shell_handle);
- loop.Run();
- return MOJO_RESULT_OK;
-}
diff --git a/mojo/services/view_manager/DEPS b/mojo/examples/view_manager/DEPS
index 05af088..8cb61f5 100644
--- a/mojo/services/view_manager/DEPS
+++ b/mojo/examples/view_manager/DEPS
@@ -1,6 +1,4 @@
include_rules = [
- "+mojo/services",
- "+ui/aura",
"+ui/events",
"+ui/gfx",
]
diff --git a/mojo/examples/view_manager/view_manager.cc b/mojo/examples/view_manager/view_manager.cc
new file mode 100644
index 0000000..02c01c9
--- /dev/null
+++ b/mojo/examples/view_manager/view_manager.cc
@@ -0,0 +1,150 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stdio.h>
+
+#include "base/logging.h"
+#include "base/macros.h"
+#include "base/memory/scoped_vector.h"
+#include "base/message_loop/message_loop.h"
+#include "mojo/examples/launcher/launcher.mojom.h"
+#include "mojo/examples/view_manager/view_manager.mojom.h"
+#include "mojo/public/cpp/bindings/allocation_scope.h"
+#include "mojo/public/cpp/bindings/remote_ptr.h"
+#include "mojo/public/cpp/shell/application.h"
+#include "mojo/public/cpp/system/core.h"
+#include "mojo/public/interfaces/shell/shell.mojom.h"
+#include "mojo/services/native_viewport/geometry_conversions.h"
+#include "mojo/services/native_viewport/native_viewport.mojom.h"
+#include "ui/events/event_constants.h"
+#include "ui/events/keycodes/keyboard_codes.h"
+#include "ui/gfx/rect.h"
+
+#if defined(WIN32)
+#if !defined(CDECL)
+#define CDECL __cdecl)
+#endif
+#define VIEW_MANAGER_EXPORT __declspec(dllexport)
+#else
+#define CDECL
+#define VIEW_MANAGER_EXPORT __attribute__((visibility("default")))
+#endif
+
+namespace mojo {
+namespace examples {
+
+class ViewImpl : public View {
+ public:
+ explicit ViewImpl(ScopedViewClientHandle handle)
+ : id_(-1),
+ client_(handle.Pass(), this) {}
+ virtual ~ViewImpl() {}
+
+ private:
+ // Overridden from View:
+ virtual void SetId(int view_id) OVERRIDE {
+ id_ = view_id;
+ }
+ virtual void GetId(const mojo::Callback<void(int32_t)>& callback) OVERRIDE {
+ callback.Run(id_);
+ }
+
+ int id_;
+ RemotePtr<ViewClient> client_;
+
+ DISALLOW_COPY_AND_ASSIGN(ViewImpl);
+};
+
+class ViewManagerImpl : public ServiceConnection<ViewManager, ViewManagerImpl>,
+ public NativeViewportClient,
+ public LauncherClient {
+ public:
+ explicit ViewManagerImpl() {
+ InitNativeViewport();
+ }
+
+ private:
+ // Overridden from ViewManager:
+ virtual void CreateView(const Callback<void(ScopedViewHandle)>& callback)
+ OVERRIDE {
+ InterfacePipe<View> pipe;
+ views_.push_back(new ViewImpl(pipe.handle_to_peer.Pass()));
+ callback.Run(pipe.handle_to_self.Pass());
+ }
+
+ // Overridden from NativeViewportClient:
+ virtual void OnCreated() OVERRIDE {
+ }
+ virtual void OnDestroyed() OVERRIDE {
+ base::MessageLoop::current()->Quit();
+ }
+ virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE {
+ // TODO(beng):
+ }
+ virtual void OnEvent(const Event& event,
+ const mojo::Callback<void()>& callback) OVERRIDE {
+ if (event.action() == ui::ET_KEY_RELEASED) {
+ if (event.key_data().key_code() == ui::VKEY_L &&
+ (event.flags() & ui::EF_CONTROL_DOWN)) {
+ InitLauncher();
+ launcher_->Show();
+ }
+ }
+ callback.Run();
+ }
+
+ // Overridden from LauncherClient:
+ virtual void OnURLEntered(const mojo::String& url) OVERRIDE {
+ std::string url_spec = url.To<std::string>();
+ printf("Received URL from launcher app: %s\n", url_spec.c_str());
+ launcher_->Hide();
+ }
+
+ void InitNativeViewport() {
+ InterfacePipe<NativeViewport, AnyInterface> pipe;
+
+ AllocationScope scope;
+ shell()->Connect("mojo:mojo_native_viewport_service",
+ pipe.handle_to_peer.Pass());
+
+ native_viewport_.reset(pipe.handle_to_self.Pass(), this);
+ native_viewport_->Create(gfx::Rect(50, 50, 800, 600));
+ native_viewport_->Show();
+ }
+
+ void InitLauncher() {
+ if (!launcher_.is_null())
+ return;
+
+ InterfacePipe<Launcher, AnyInterface> pipe;
+
+ AllocationScope scope;
+ shell()->Connect("mojo:mojo_launcher", pipe.handle_to_peer.Pass());
+
+ launcher_.reset(pipe.handle_to_self.Pass(), this);
+ }
+
+ void DidCreateContext() {
+ }
+
+ ScopedVector<ViewImpl> views_;
+ RemotePtr<NativeViewport> native_viewport_;
+ RemotePtr<Launcher> launcher_;
+
+ DISALLOW_COPY_AND_ASSIGN(ViewManagerImpl);
+};
+
+} // namespace examples
+} // namespace mojo
+
+extern "C" VIEW_MANAGER_EXPORT MojoResult CDECL MojoMain(
+ MojoHandle shell_handle) {
+ base::MessageLoop loop;
+ mojo::Application app(shell_handle);
+ app.AddServiceConnector(
+ new mojo::ServiceConnector<mojo::examples::ViewManagerImpl>);
+ loop.Run();
+
+ return MOJO_RESULT_OK;
+}
diff --git a/mojo/examples/view_manager/view_manager.mojom b/mojo/examples/view_manager/view_manager.mojom
new file mode 100644
index 0000000..56beea4
--- /dev/null
+++ b/mojo/examples/view_manager/view_manager.mojom
@@ -0,0 +1,26 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+module mojo {
+
+[Peer=ViewClient]
+interface View {
+ SetId(int32 id);
+ GetId() => (int32 id);
+};
+
+[Peer=View]
+interface ViewClient {
+};
+
+[Peer=ViewManagerClient]
+interface ViewManager {
+ CreateView() => (View view);
+};
+
+[Peer=ViewManager]
+interface ViewManagerClient {
+};
+
+}
diff --git a/mojo/mojo.gyp b/mojo/mojo.gyp
index 198927f..af6e853 100644
--- a/mojo/mojo.gyp
+++ b/mojo/mojo.gyp
@@ -59,7 +59,6 @@
'dependencies': [
'mojo_aura_demo',
'mojo_launcher',
- 'mojo_sample_view_manager_app',
'mojo_view_manager',
],
}],
diff --git a/mojo/mojo_examples.gypi b/mojo/mojo_examples.gypi
index fbfc96e..1aa4438 100644
--- a/mojo/mojo_examples.gypi
+++ b/mojo/mojo_examples.gypi
@@ -276,25 +276,47 @@
'includes': [ 'build/package_app.gypi' ],
},
{
- 'target_name': 'mojo_sample_view_manager_app',
+ 'target_name': 'mojo_view_manager_bindings',
+ 'type': 'static_library',
+ 'sources': [
+ 'examples/view_manager/view_manager.mojom',
+ ],
+ 'variables': {
+ 'mojom_base_output_dir': 'mojo',
+ },
+ 'includes': [ 'public/tools/bindings/mojom_bindings_generator.gypi' ],
+ 'export_dependent_settings': [
+ 'mojo_bindings',
+ ],
+ 'dependencies': [
+ 'mojo_bindings',
+ ],
+ },
+ {
+ 'target_name': 'mojo_view_manager',
'type': 'shared_library',
'dependencies': [
- # TODO(darin): we should not be linking against these libraries!
- '../ui/gfx/gfx.gyp:gfx',
+ '../base/base.gyp:base',
'../ui/gfx/gfx.gyp:gfx_geometry',
- '../ui/gl/gl.gyp:gl',
- 'mojo_bindings',
- 'mojo_environment_standalone',
- 'mojo_gles2',
- 'mojo_view_manager_bindings',
+ 'mojo_common_lib',
+ 'mojo_environment_chromium',
+ 'mojo_launcher_bindings',
+ 'mojo_native_viewport_bindings',
'mojo_shell_client',
- 'mojo_system',
- 'mojo_utility',
+ 'mojo_system_impl',
+ 'mojo_view_manager_bindings',
],
'sources': [
- 'examples/sample_view_manager_app/sample_view_manager_app.cc',
+ 'examples/view_manager/view_manager.cc',
],
},
+ {
+ 'target_name': 'package_mojo_view_manager',
+ 'variables': {
+ 'app_name': 'mojo_view_manager',
+ },
+ 'includes': [ 'build/package_app.gypi' ],
+ },
],
}],
],
diff --git a/mojo/mojo_services.gypi b/mojo/mojo_services.gypi
index 0c1009e..0742655 100644
--- a/mojo/mojo_services.gypi
+++ b/mojo/mojo_services.gypi
@@ -140,60 +140,4 @@
],
},
],
- 'conditions': [
- ['use_aura==1', {
- 'targets': [
- {
- 'target_name': 'mojo_view_manager_bindings',
- 'type': 'static_library',
- 'sources': [
- 'services/public/interfaces/view_manager/view_manager.mojom',
- ],
- 'variables': {
- 'mojom_base_output_dir': 'mojo',
- },
- 'includes': [ 'public/tools/bindings/mojom_bindings_generator.gypi' ],
- 'export_dependent_settings': [
- 'mojo_bindings',
- ],
- 'dependencies': [
- 'mojo_bindings',
- ],
- },
- {
- 'target_name': 'mojo_view_manager',
- 'type': 'shared_library',
- 'dependencies': [
- '../base/base.gyp:base',
- '../skia/skia.gyp:skia',
- '../ui/aura/aura.gyp:aura',
- '../ui/gfx/gfx.gyp:gfx_geometry',
- 'mojo_common_lib',
- 'mojo_environment_chromium',
- 'mojo_launcher_bindings',
- 'mojo_native_viewport_bindings',
- 'mojo_shell_client',
- 'mojo_system_impl',
- 'mojo_view_manager_bindings',
- ],
- 'sources': [
- 'services/view_manager/root_view_manager.cc',
- 'services/view_manager/root_view_manager.h',
- 'services/view_manager/view.cc',
- 'services/view_manager/view.h',
- 'services/view_manager/view_manager_connection.cc',
- 'services/view_manager/view_manager_connection.h',
- 'services/view_manager/view_manager.cc',
- ],
- },
- {
- 'target_name': 'package_mojo_view_manager',
- 'variables': {
- 'app_name': 'mojo_view_manager',
- },
- 'includes': [ 'build/package_app.gypi' ],
- },
- ],
- }],
- ],
}
diff --git a/mojo/services/public/interfaces/view_manager/view_manager.mojom b/mojo/services/public/interfaces/view_manager/view_manager.mojom
deleted file mode 100644
index 45a7e69..0000000
--- a/mojo/services/public/interfaces/view_manager/view_manager.mojom
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-module mojo.services.view_manager {
-
-// Each View is identified by the following pair. The |manager_id| is assigned
-// by the server and uniquely identifies the ViewManager. A value of 0 can be
-// used to indicate 'this' manager. The |view_id| is assigned by the client.
-// Non-negative values may be used. Server uses negative to identify special
-// values. For example, -1 is the root.
-struct ViewId {
- int32 manager_id;
- int32 view_id;
-};
-
-[Peer=ViewManagerClient]
-interface ViewManager {
- // Creates a new view with the specified id. It is up to the client to ensure
- // the id is unique to the connection (the id need not be globally unique).
- CreateView(int32 view_id) => (bool success);
-
- // Reparents a view.
- AddView(ViewId parent, ViewId child) => (bool success);
-
- // Removes a view from its current parent.
- RemoveFromParent(ViewId view) => (bool success);
-};
-
-[Peer=ViewManager]
-interface ViewManagerClient {
- // Invoked once the connection has been established. |manager_id| is the id
- // used to uniquely identify the ViewManager.
- OnConnectionEstablished(int32 manager_id);
-};
-
-}
diff --git a/mojo/services/view_manager/root_view_manager.cc b/mojo/services/view_manager/root_view_manager.cc
deleted file mode 100644
index d791cb3..0000000
--- a/mojo/services/view_manager/root_view_manager.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "mojo/services/view_manager/root_view_manager.h"
-
-#include "base/logging.h"
-#include "mojo/services/view_manager/view_manager_connection.h"
-
-namespace mojo {
-namespace services {
-namespace view_manager {
-namespace {
-
-// Identifies the root of the view hierarchy.
-const int32_t kRootId = -1;
-
-} // namespace
-
-RootViewManager::RootViewManager()
- : next_connection_id_(1),
- root_(kRootId) {
-}
-
-RootViewManager::~RootViewManager() {
-}
-
-int32_t RootViewManager::GetAndAdvanceNextConnectionId() {
- return next_connection_id_++;
-}
-
-void RootViewManager::AddConnection(ViewManagerConnection* connection) {
- DCHECK_EQ(0u, connection_map_.count(connection->id()));
- connection_map_[connection->id()] = connection;
-}
-
-void RootViewManager::RemoveConnection(ViewManagerConnection* connection) {
- connection_map_.erase(connection->id());
-}
-
-View* RootViewManager::GetView(int32_t manager_id, int32_t view_id) {
- if (view_id == kRootId)
- return &root_;
- ConnectionMap::iterator i = connection_map_.find(manager_id);
- return i == connection_map_.end() ? NULL : i->second->GetView(view_id);
-}
-
-void RootViewManager::OnCreated() {
-}
-
-void RootViewManager::OnDestroyed() {
-}
-
-void RootViewManager::OnBoundsChanged(const Rect& bounds) {
-}
-
-void RootViewManager::OnEvent(const Event& event,
- const mojo::Callback<void()>& callback) {
- callback.Run();
-}
-
-} // namespace view_manager
-} // namespace services
-} // namespace mojo
diff --git a/mojo/services/view_manager/root_view_manager.h b/mojo/services/view_manager/root_view_manager.h
deleted file mode 100644
index 65376ce..0000000
--- a/mojo/services/view_manager/root_view_manager.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MOJO_SERVICES_VIEW_MANAGER_ROOT_VIEW_MANAGER_H_
-#define MOJO_SERVICES_VIEW_MANAGER_ROOT_VIEW_MANAGER_H_
-
-#include <map>
-
-#include "base/basictypes.h"
-#include "mojo/services/native_viewport/native_viewport.mojom.h"
-#include "mojo/services/view_manager/view.h"
-
-namespace mojo {
-namespace services {
-namespace view_manager {
-
-class View;
-class ViewId;
-class ViewManagerConnection;
-
-// RootViewManager is responsible for managing the set of ViewManagerConnections
-// as well as providing the root of the View hierarchy.
-class RootViewManager : public NativeViewportClient {
- public:
- RootViewManager();
- virtual ~RootViewManager();
-
- // Returns the id for the next view manager.
- int32_t GetAndAdvanceNextConnectionId();
-
- void AddConnection(ViewManagerConnection* connection);
- void RemoveConnection(ViewManagerConnection* connection);
-
- // Returns the View identified by the specified pair, or NULL if there isn't
- // one.
- View* GetView(int32_t manager_id, int32_t view_id);
-
- private:
- typedef std::map<int32_t, ViewManagerConnection*> ConnectionMap;
-
- // Overridden from NativeViewportClient:
- virtual void OnCreated() OVERRIDE;
- virtual void OnDestroyed() OVERRIDE;
- virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE;
- virtual void OnEvent(const Event& event,
- const mojo::Callback<void()>& callback) OVERRIDE;
-
- // ID to use for next ViewManagerConnection.
- int32_t next_connection_id_;
-
- // Set of ViewManagerConnections.
- ConnectionMap connection_map_;
-
- // Root of Views that are displayed.
- View root_;
-
- DISALLOW_COPY_AND_ASSIGN(RootViewManager);
-};
-
-} // namespace view_manager
-} // namespace services
-} // namespace mojo
-
-#endif // MOJO_SERVICES_VIEW_MANAGER_ROOT_VIEW_MANAGER_H_
diff --git a/mojo/services/view_manager/view.cc b/mojo/services/view_manager/view.cc
deleted file mode 100644
index 6215854..0000000
--- a/mojo/services/view_manager/view.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "mojo/services/view_manager/view.h"
-
-#include "ui/aura/window_property.h"
-
-DECLARE_WINDOW_PROPERTY_TYPE(mojo::services::view_manager::View*);
-
-namespace mojo {
-namespace services {
-namespace view_manager {
-
-DEFINE_WINDOW_PROPERTY_KEY(View*, kViewKey, NULL);
-
-// TODO(sky): figure out window delegate.
-View::View(int32_t id) : id_(id), window_(NULL) {
- window_.set_owned_by_parent(false);
-}
-
-View::~View() {
-}
-
-View* View::GetParent() {
- if (!window_.parent())
- return NULL;
- return window_.parent()->GetProperty(kViewKey);
-}
-
-void View::Add(View* child) {
- window_.AddChild(&child->window_);
-}
-
-void View::Remove(View* child) {
- window_.RemoveChild(&child->window_);
-}
-
-} // namespace view_manager
-} // namespace services
-} // namespace mojo
diff --git a/mojo/services/view_manager/view.h b/mojo/services/view_manager/view.h
deleted file mode 100644
index 1815f7f..0000000
--- a/mojo/services/view_manager/view.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MOJO_SERVICES_VIEW_MANAGER_VIEW_H_
-#define MOJO_SERVICES_VIEW_MANAGER_VIEW_H_
-
-#include "base/logging.h"
-#include "ui/aura/window.h"
-
-namespace mojo {
-namespace services {
-namespace view_manager {
-
-class View {
- public:
- View(int32_t view_id);
- ~View();
-
- int32 id() const { return id_; }
-
- void Add(View* child);
- void Remove(View* child);
-
- View* GetParent();
-
- private:
- const int32_t id_;
- aura::Window window_;
-
- DISALLOW_COPY_AND_ASSIGN(View);
-};
-
-} // namespace view_manager
-} // namespace services
-} // namespace mojo
-
-#endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_H_
diff --git a/mojo/services/view_manager/view_manager.cc b/mojo/services/view_manager/view_manager.cc
deleted file mode 100644
index 5c026b9..0000000
--- a/mojo/services/view_manager/view_manager.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/message_loop/message_loop.h"
-#include "mojo/public/cpp/shell/application.h"
-#include "mojo/services/view_manager/root_view_manager.h"
-#include "mojo/services/view_manager/view_manager_connection.h"
-
-#if defined(WIN32)
-#if !defined(CDECL)
-#define CDECL __cdecl)
-#endif
-#define VIEW_MANAGER_EXPORT __declspec(dllexport)
-#else
-#define CDECL
-#define VIEW_MANAGER_EXPORT __attribute__((visibility("default")))
-#endif
-
-extern "C" VIEW_MANAGER_EXPORT MojoResult CDECL MojoMain(
- MojoHandle shell_handle) {
- base::MessageLoop loop;
- mojo::Application app(shell_handle);
- mojo::services::view_manager::RootViewManager root_view_manager;
- app.AddServiceConnector(new mojo::ServiceConnector
- <mojo::services::view_manager::ViewManagerConnection,
- mojo::services::view_manager::RootViewManager>(
- &root_view_manager));
- loop.Run();
-
- return MOJO_RESULT_OK;
-}
diff --git a/mojo/services/view_manager/view_manager_connection.cc b/mojo/services/view_manager/view_manager_connection.cc
deleted file mode 100644
index 5b85d98..0000000
--- a/mojo/services/view_manager/view_manager_connection.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "mojo/services/view_manager/view_manager_connection.h"
-
-#include "base/stl_util.h"
-#include "mojo/services/view_manager/root_view_manager.h"
-#include "mojo/services/view_manager/view.h"
-
-namespace mojo {
-namespace services {
-namespace view_manager {
-
-ViewManagerConnection::ViewManagerConnection() : id_(0) {
-}
-
-ViewManagerConnection::~ViewManagerConnection() {
- STLDeleteContainerPairSecondPointers(view_map_.begin(), view_map_.end());
- context()->RemoveConnection(this);
-}
-
-void ViewManagerConnection::Initialize(
- ServiceConnector<ViewManagerConnection, RootViewManager>* service_factory,
- ScopedMessagePipeHandle client_handle) {
- DCHECK_EQ(0, id_); // Should only get Initialize() once.
- ServiceConnection<ViewManager, ViewManagerConnection, RootViewManager>::
- Initialize(service_factory, client_handle.Pass());
- context()->AddConnection(this);
- id_ = context()->GetAndAdvanceNextConnectionId();
- client()->OnConnectionEstablished(id_);
-}
-
-View* ViewManagerConnection::GetView(int32_t id) {
- ViewMap::iterator i = view_map_.find(id);
- return i == view_map_.end() ? NULL : i->second;
-}
-
-View* ViewManagerConnection::GetViewById(const ViewId& view_id) {
- const int32_t manager_id =
- view_id.manager_id() == 0 ? id_ : view_id.manager_id();
- return context()->GetView(manager_id, view_id.view_id());
-}
-
-void ViewManagerConnection::CreateView(
- int32_t view_id,
- const mojo::Callback<void(bool)>& callback) {
- // Negative values are reserved.
- if (view_map_.find(view_id) != view_map_.end() || view_id < 0) {
- callback.Run(false);
- return;
- }
- view_map_[view_id] = new View(view_id);
- callback.Run(true);
-}
-
-void ViewManagerConnection::AddView(
- const ViewId& parent_id,
- const ViewId& child_id,
- const mojo::Callback<void(bool)>& callback) {
- View* parent_view = GetViewById(parent_id);
- View* child_view = GetViewById(child_id);
- bool success = false;
- if (parent_view && child_view && parent_view != child_view) {
- parent_view->Add(child_view);
- success = true;
- }
- callback.Run(success);
-}
-
-void ViewManagerConnection::RemoveFromParent(
- const ViewId& view_id,
- const mojo::Callback<void(bool)>& callback) {
- View* view = GetViewById(view_id);
- bool success = false;
- if (view && view->GetParent()) {
- view->GetParent()->Add(view);
- success = true;
- }
- callback.Run(success);
-}
-
-} // namespace view_manager
-} // namespace services
-} // namespace mojo
diff --git a/mojo/services/view_manager/view_manager_connection.h b/mojo/services/view_manager/view_manager_connection.h
deleted file mode 100644
index 2b0d4c1..0000000
--- a/mojo/services/view_manager/view_manager_connection.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_
-#define MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_
-
-#include <set>
-
-#include "base/basictypes.h"
-#include "mojo/public/cpp/shell/service.h"
-#include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h"
-
-namespace mojo {
-namespace services {
-namespace view_manager {
-
-class RootViewManager;
-class View;
-
-// Manages a connection from the client.
-class ViewManagerConnection : public ServiceConnection<ViewManager,
- ViewManagerConnection,
- RootViewManager> {
- public:
- ViewManagerConnection();
- virtual ~ViewManagerConnection();
-
- int32_t id() const { return id_; }
-
- // Invoked from Service when connection is established.
- void Initialize(
- ServiceConnector<ViewManagerConnection, RootViewManager>* service_factory,
- ScopedMessagePipeHandle client_handle);
-
- // Returns the View by id.
- View* GetView(int32_t id);
-
- private:
- typedef std::map<int32_t, View*> ViewMap;
-
- // Returns the View by ViewId.
- View* GetViewById(const ViewId& view_id);
-
- // Overridden from ViewManager:
- virtual void CreateView(int32_t view_id,
- const mojo::Callback<void(bool)>& callback) OVERRIDE;
- virtual void AddView(const ViewId& parent_id,
- const ViewId& child_id,
- const mojo::Callback<void(bool)>& callback) OVERRIDE;
- virtual void RemoveFromParent(
- const ViewId& view_id,
- const mojo::Callback<void(bool)>& callback) OVERRIDE;
-
- // Id of this connection as assigned by RootViewManager. Assigned in
- // Initialize().
- int32_t id_;
-
- ViewMap view_map_;
-
- DISALLOW_COPY_AND_ASSIGN(ViewManagerConnection);
-};
-
-} // namespace view_manager
-} // namespace services
-} // namespace mojo
-
-#endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_