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