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

Side by Side Diff: mojo/shell/context.cc

Issue 267293004: Wires up view manager to an actual display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/services/view_manager/view_manager_connection.cc ('k') | mojo/shell/view_manager_loader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/shell/context.h" 5 #include "mojo/shell/context.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
11 #include "mojo/embedder/embedder.h" 11 #include "mojo/embedder/embedder.h"
12 #include "mojo/gles2/gles2_support_impl.h" 12 #include "mojo/gles2/gles2_support_impl.h"
13 #include "mojo/public/cpp/shell/application.h" 13 #include "mojo/public/cpp/shell/application.h"
14 #include "mojo/service_manager/background_service_loader.h" 14 #include "mojo/service_manager/background_service_loader.h"
15 #include "mojo/service_manager/service_loader.h" 15 #include "mojo/service_manager/service_loader.h"
16 #include "mojo/service_manager/service_manager.h" 16 #include "mojo/service_manager/service_manager.h"
17 #include "mojo/services/native_viewport/native_viewport_service.h" 17 #include "mojo/services/native_viewport/native_viewport_service.h"
18 #include "mojo/shell/dynamic_service_loader.h" 18 #include "mojo/shell/dynamic_service_loader.h"
19 #include "mojo/shell/in_process_dynamic_service_runner.h" 19 #include "mojo/shell/in_process_dynamic_service_runner.h"
20 #include "mojo/shell/network_delegate.h" 20 #include "mojo/shell/network_delegate.h"
21 #include "mojo/shell/out_of_process_dynamic_service_runner.h" 21 #include "mojo/shell/out_of_process_dynamic_service_runner.h"
22 #include "mojo/shell/switches.h" 22 #include "mojo/shell/switches.h"
23 #include "mojo/spy/spy.h" 23 #include "mojo/spy/spy.h"
24 24
25 #if defined(OS_LINUX) 25 #if defined(OS_LINUX)
26 #include "mojo/shell/dbus_service_loader_linux.h" 26 #include "mojo/shell/dbus_service_loader_linux.h"
27 #endif // defined(OS_LINUX) 27 #endif // defined(OS_LINUX)
28 28
29 #if defined(USE_AURA) 29 #if defined(USE_AURA)
30 #include "mojo/services/view_manager/root_node_manager.h" 30 #include "mojo/shell/view_manager_loader.h"
31 #include "mojo/services/view_manager/view_manager_connection.h"
32 #endif 31 #endif
33 32
34 namespace mojo { 33 namespace mojo {
35 namespace shell { 34 namespace shell {
36 namespace { 35 namespace {
37 36
38 // Used to ensure we only init once. 37 // Used to ensure we only init once.
39 class Setup { 38 class Setup {
40 public: 39 public:
41 Setup() { 40 Setup() {
42 embedder::Init(); 41 embedder::Init();
43 gles2::GLES2SupportImpl::Init(); 42 gles2::GLES2SupportImpl::Init();
44 } 43 }
45 44
46 ~Setup() { 45 ~Setup() {
47 } 46 }
48 47
49 private: 48 private:
50 DISALLOW_COPY_AND_ASSIGN(Setup); 49 DISALLOW_COPY_AND_ASSIGN(Setup);
51 }; 50 };
52 51
53 static base::LazyInstance<Setup> setup = LAZY_INSTANCE_INITIALIZER; 52 static base::LazyInstance<Setup> setup = LAZY_INSTANCE_INITIALIZER;
54 53
55 #if defined(USE_AURA)
56 class ViewManagerLoader : public ServiceLoader {
57 public:
58 ViewManagerLoader() {}
59 virtual ~ViewManagerLoader() {}
60
61 private:
62 virtual void LoadService(ServiceManager* manager,
63 const GURL& url,
64 ScopedShellHandle shell_handle) OVERRIDE {
65 scoped_ptr<Application> app(new Application(shell_handle.Pass()));
66 app->AddServiceConnector(
67 new ServiceConnector<services::view_manager::ViewManagerConnection,
68 services::view_manager::RootNodeManager>(
69 &root_node_manager_));
70 apps_.push_back(app.release());
71 }
72
73 virtual void OnServiceError(ServiceManager* manager,
74 const GURL& url) OVERRIDE {
75 }
76
77 services::view_manager::RootNodeManager root_node_manager_;
78 ScopedVector<Application> apps_;
79
80 DISALLOW_COPY_AND_ASSIGN(ViewManagerLoader);
81 };
82 #endif
83
84 } // namespace 54 } // namespace
85 55
86 class Context::NativeViewportServiceLoader : public ServiceLoader { 56 class Context::NativeViewportServiceLoader : public ServiceLoader {
87 public: 57 public:
88 explicit NativeViewportServiceLoader(Context* context) : context_(context) {} 58 explicit NativeViewportServiceLoader(Context* context) : context_(context) {}
89 virtual ~NativeViewportServiceLoader() {} 59 virtual ~NativeViewportServiceLoader() {}
90 60
91 private: 61 private:
92 virtual void LoadService(ServiceManager* manager, 62 virtual void LoadService(ServiceManager* manager,
93 const GURL& url, 63 const GURL& url,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 #if defined(USE_AURA) 128 #if defined(USE_AURA)
159 service_manager_.SetLoaderForURL( 129 service_manager_.SetLoaderForURL(
160 scoped_ptr<ServiceLoader>(), 130 scoped_ptr<ServiceLoader>(),
161 GURL("mojo:mojo_view_manager")); 131 GURL("mojo:mojo_view_manager"));
162 #endif 132 #endif
163 service_manager_.set_default_loader(scoped_ptr<ServiceLoader>()); 133 service_manager_.set_default_loader(scoped_ptr<ServiceLoader>());
164 } 134 }
165 135
166 } // namespace shell 136 } // namespace shell
167 } // namespace mojo 137 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/view_manager/view_manager_connection.cc ('k') | mojo/shell/view_manager_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698