| OLD | NEW |
| 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" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 #if defined(USE_AURA) | 55 #if defined(USE_AURA) |
| 56 class ViewManagerLoader : public ServiceLoader { | 56 class ViewManagerLoader : public ServiceLoader { |
| 57 public: | 57 public: |
| 58 ViewManagerLoader() {} | 58 ViewManagerLoader() {} |
| 59 virtual ~ViewManagerLoader() {} | 59 virtual ~ViewManagerLoader() {} |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 virtual void LoadService(ServiceManager* manager, | 62 virtual void LoadService(ServiceManager* manager, |
| 63 const GURL& url, | 63 const GURL& url, |
| 64 ScopedShellHandle shell_handle) OVERRIDE { | 64 ScopedMessagePipeHandle shell_handle) OVERRIDE { |
| 65 scoped_ptr<Application> app(new Application(shell_handle.Pass())); | 65 scoped_ptr<Application> app(new Application(shell_handle.Pass())); |
| 66 app->AddServiceConnector( | 66 app->AddServiceConnector( |
| 67 new ServiceConnector<services::view_manager::ViewManagerConnection, | 67 new ServiceConnector<services::view_manager::ViewManagerConnection, |
| 68 services::view_manager::RootNodeManager>( | 68 services::view_manager::RootNodeManager>( |
| 69 &root_node_manager_)); | 69 &root_node_manager_)); |
| 70 apps_.push_back(app.release()); | 70 apps_.push_back(app.release()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 virtual void OnServiceError(ServiceManager* manager, | 73 virtual void OnServiceError(ServiceManager* manager, |
| 74 const GURL& url) OVERRIDE { | 74 const GURL& url) OVERRIDE { |
| 75 } | 75 } |
| 76 | 76 |
| 77 services::view_manager::RootNodeManager root_node_manager_; | 77 services::view_manager::RootNodeManager root_node_manager_; |
| 78 ScopedVector<Application> apps_; | 78 ScopedVector<Application> apps_; |
| 79 | 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(ViewManagerLoader); | 80 DISALLOW_COPY_AND_ASSIGN(ViewManagerLoader); |
| 81 }; | 81 }; |
| 82 #endif | 82 #endif |
| 83 | 83 |
| 84 } // namespace | 84 } // namespace |
| 85 | 85 |
| 86 class Context::NativeViewportServiceLoader : public ServiceLoader { | 86 class Context::NativeViewportServiceLoader : public ServiceLoader { |
| 87 public: | 87 public: |
| 88 explicit NativeViewportServiceLoader(Context* context) : context_(context) {} | 88 explicit NativeViewportServiceLoader(Context* context) : context_(context) {} |
| 89 virtual ~NativeViewportServiceLoader() {} | 89 virtual ~NativeViewportServiceLoader() {} |
| 90 | 90 |
| 91 private: | 91 private: |
| 92 virtual void LoadService(ServiceManager* manager, | 92 virtual void LoadService(ServiceManager* manager, |
| 93 const GURL& url, | 93 const GURL& url, |
| 94 ScopedShellHandle service_handle) OVERRIDE { | 94 ScopedMessagePipeHandle service_handle) OVERRIDE { |
| 95 app_.reset(::CreateNativeViewportService(context_, service_handle.Pass())); | 95 app_.reset(::CreateNativeViewportService(context_, service_handle.Pass())); |
| 96 } | 96 } |
| 97 | 97 |
| 98 virtual void OnServiceError(ServiceManager* manager, | 98 virtual void OnServiceError(ServiceManager* manager, |
| 99 const GURL& url) OVERRIDE { | 99 const GURL& url) OVERRIDE { |
| 100 } | 100 } |
| 101 | 101 |
| 102 Context* context_; | 102 Context* context_; |
| 103 scoped_ptr<Application> app_; | 103 scoped_ptr<Application> app_; |
| 104 DISALLOW_COPY_AND_ASSIGN(NativeViewportServiceLoader); | 104 DISALLOW_COPY_AND_ASSIGN(NativeViewportServiceLoader); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 #if defined(USE_AURA) | 158 #if defined(USE_AURA) |
| 159 service_manager_.SetLoaderForURL( | 159 service_manager_.SetLoaderForURL( |
| 160 scoped_ptr<ServiceLoader>(), | 160 scoped_ptr<ServiceLoader>(), |
| 161 GURL("mojo:mojo_view_manager")); | 161 GURL("mojo:mojo_view_manager")); |
| 162 #endif | 162 #endif |
| 163 service_manager_.set_default_loader(scoped_ptr<ServiceLoader>()); | 163 service_manager_.set_default_loader(scoped_ptr<ServiceLoader>()); |
| 164 } | 164 } |
| 165 | 165 |
| 166 } // namespace shell | 166 } // namespace shell |
| 167 } // namespace mojo | 167 } // namespace mojo |
| OLD | NEW |