diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-09 10:21:41 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-09 10:21:41 +0000 |
commit | 56cf6ee923c8a4c69c09812343e3311cf18de69d (patch) | |
tree | 6ab780f49954426288964d17969b3c4f9894046c /mojo/shell | |
parent | 67f26654df13969da4691ead936bbd963b0ae835 (diff) | |
download | chromium_src-56cf6ee923c8a4c69c09812343e3311cf18de69d.zip chromium_src-56cf6ee923c8a4c69c09812343e3311cf18de69d.tar.gz chromium_src-56cf6ee923c8a4c69c09812343e3311cf18de69d.tar.bz2 |
Wires up view manager to an actual display
Adds a SetViewContents to exercise this.
BUG=365012
TEST=none
R=ben@chromium.org
Review URL: https://codereview.chromium.org/267293004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269206 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/shell')
-rw-r--r-- | mojo/shell/context.cc | 32 | ||||
-rw-r--r-- | mojo/shell/view_manager_loader.cc | 40 | ||||
-rw-r--r-- | mojo/shell/view_manager_loader.h | 46 |
3 files changed, 87 insertions, 31 deletions
diff --git a/mojo/shell/context.cc b/mojo/shell/context.cc index f5d405f..9879a17 100644 --- a/mojo/shell/context.cc +++ b/mojo/shell/context.cc @@ -27,8 +27,7 @@ #endif // defined(OS_LINUX) #if defined(USE_AURA) -#include "mojo/services/view_manager/root_node_manager.h" -#include "mojo/services/view_manager/view_manager_connection.h" +#include "mojo/shell/view_manager_loader.h" #endif namespace mojo { @@ -52,35 +51,6 @@ class Setup { static base::LazyInstance<Setup> setup = LAZY_INSTANCE_INITIALIZER; -#if defined(USE_AURA) -class ViewManagerLoader : public ServiceLoader { - public: - ViewManagerLoader() {} - virtual ~ViewManagerLoader() {} - - private: - virtual void LoadService(ServiceManager* manager, - const GURL& url, - ScopedShellHandle shell_handle) OVERRIDE { - scoped_ptr<Application> app(new Application(shell_handle.Pass())); - app->AddServiceConnector( - new ServiceConnector<services::view_manager::ViewManagerConnection, - services::view_manager::RootNodeManager>( - &root_node_manager_)); - apps_.push_back(app.release()); - } - - virtual void OnServiceError(ServiceManager* manager, - const GURL& url) OVERRIDE { - } - - services::view_manager::RootNodeManager root_node_manager_; - ScopedVector<Application> apps_; - - DISALLOW_COPY_AND_ASSIGN(ViewManagerLoader); -}; -#endif - } // namespace class Context::NativeViewportServiceLoader : public ServiceLoader { diff --git a/mojo/shell/view_manager_loader.cc b/mojo/shell/view_manager_loader.cc new file mode 100644 index 0000000..a3d0cbd --- /dev/null +++ b/mojo/shell/view_manager_loader.cc @@ -0,0 +1,40 @@ +// 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/shell/view_manager_loader.h" + +#include "mojo/public/cpp/shell/application.h" +#include "mojo/services/view_manager/root_node_manager.h" +#include "mojo/services/view_manager/view_manager_connection.h" + +namespace mojo { +namespace shell { + +ViewManagerLoader::ViewManagerLoader() { +} + +ViewManagerLoader::~ViewManagerLoader() { +} + +void ViewManagerLoader::LoadService(ServiceManager* manager, + const GURL& url, + ScopedShellHandle shell_handle) { + scoped_ptr<Application> app(new Application(shell_handle.Pass())); + if (!root_node_manager_.get()) { + root_node_manager_.reset( + new services::view_manager::RootNodeManager(app->shell())); + } + app->AddServiceConnector( + new ServiceConnector<services::view_manager::ViewManagerConnection, + services::view_manager::RootNodeManager>( + root_node_manager_.get())); + apps_.push_back(app.release()); +} + +void ViewManagerLoader::OnServiceError(ServiceManager* manager, + const GURL& url) { +} + +} // namespace shell +} // namespace mojo diff --git a/mojo/shell/view_manager_loader.h b/mojo/shell/view_manager_loader.h new file mode 100644 index 0000000..021f2a4 --- /dev/null +++ b/mojo/shell/view_manager_loader.h @@ -0,0 +1,46 @@ +// 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_SHELL_VIEW_MANAGER_LOADER_H_ +#define MOJO_SHELL_VIEW_MANAGER_LOADER_H_ + +#include "base/memory/scoped_ptr.h" +#include "base/memory/scoped_vector.h" +#include "mojo/service_manager/service_loader.h" + +namespace mojo { +namespace services { +namespace view_manager { +class RootNodeManager; +} +} + +class Application; + +namespace shell { + +// ServiceLoader responsible for creating connections to the ViewManager. +class ViewManagerLoader : public ServiceLoader { + public: + ViewManagerLoader(); + virtual ~ViewManagerLoader(); + + private: + // ServiceLoader overrides: + virtual void LoadService(ServiceManager* manager, + const GURL& url, + ScopedShellHandle shell_handle) OVERRIDE; + virtual void OnServiceError(ServiceManager* manager, + const GURL& url) OVERRIDE; + + scoped_ptr<services::view_manager::RootNodeManager> root_node_manager_; + ScopedVector<Application> apps_; + + DISALLOW_COPY_AND_ASSIGN(ViewManagerLoader); +}; + +} // namespace shell +} // namespace mojo + +#endif // MOJO_SHELL_VIEW_MANAGER_LOADER_H_ |