| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 15 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
| 16 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 17 #include "gpu/command_buffer/service/mailbox_manager.h" | 18 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 18 #include "mojo/application_manager/application_loader.h" | 19 #include "mojo/application_manager/application_loader.h" |
| 19 #include "mojo/application_manager/application_manager.h" | 20 #include "mojo/application_manager/application_manager.h" |
| 20 #include "mojo/application_manager/background_shell_application_loader.h" | 21 #include "mojo/application_manager/background_shell_application_loader.h" |
| 21 #include "mojo/embedder/embedder.h" | 22 #include "mojo/embedder/embedder.h" |
| 22 #include "mojo/embedder/simple_platform_support.h" | 23 #include "mojo/embedder/simple_platform_support.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 public: | 119 public: |
| 119 NativeViewportApplicationLoader() | 120 NativeViewportApplicationLoader() |
| 120 : share_group_(new gfx::GLShareGroup), | 121 : share_group_(new gfx::GLShareGroup), |
| 121 mailbox_manager_(new gpu::gles2::MailboxManager) {} | 122 mailbox_manager_(new gpu::gles2::MailboxManager) {} |
| 122 virtual ~NativeViewportApplicationLoader() {} | 123 virtual ~NativeViewportApplicationLoader() {} |
| 123 | 124 |
| 124 private: | 125 private: |
| 125 // ApplicationLoader implementation. | 126 // ApplicationLoader implementation. |
| 126 virtual void Load(ApplicationManager* manager, | 127 virtual void Load(ApplicationManager* manager, |
| 127 const GURL& url, | 128 const GURL& url, |
| 128 scoped_refptr<LoadCallbacks> callbacks) OVERRIDE { | 129 scoped_refptr<LoadCallbacks> callbacks) override { |
| 129 ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication(); | 130 ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication(); |
| 130 if (shell_handle.is_valid()) | 131 if (shell_handle.is_valid()) |
| 131 app_.reset(new ApplicationImpl(this, shell_handle.Pass())); | 132 app_.reset(new ApplicationImpl(this, shell_handle.Pass())); |
| 132 } | 133 } |
| 133 | 134 |
| 134 virtual void OnApplicationError(ApplicationManager* manager, | 135 virtual void OnApplicationError(ApplicationManager* manager, |
| 135 const GURL& url) OVERRIDE {} | 136 const GURL& url) override {} |
| 136 | 137 |
| 137 // ApplicationDelegate implementation. | 138 // ApplicationDelegate implementation. |
| 138 virtual bool ConfigureIncomingConnection( | 139 virtual bool ConfigureIncomingConnection( |
| 139 mojo::ApplicationConnection* connection) OVERRIDE { | 140 mojo::ApplicationConnection* connection) override { |
| 140 connection->AddService<NativeViewport>(this); | 141 connection->AddService<NativeViewport>(this); |
| 141 connection->AddService<Gpu>(this); | 142 connection->AddService<Gpu>(this); |
| 142 return true; | 143 return true; |
| 143 } | 144 } |
| 144 | 145 |
| 145 // InterfaceFactory<NativeViewport> implementation. | 146 // InterfaceFactory<NativeViewport> implementation. |
| 146 virtual void Create(ApplicationConnection* connection, | 147 virtual void Create(ApplicationConnection* connection, |
| 147 InterfaceRequest<NativeViewport> request) OVERRIDE { | 148 InterfaceRequest<NativeViewport> request) override { |
| 148 BindToRequest(new NativeViewportImpl(app_.get(), false), &request); | 149 BindToRequest(new NativeViewportImpl(app_.get(), false), &request); |
| 149 } | 150 } |
| 150 | 151 |
| 151 // InterfaceFactory<Gpu> implementation. | 152 // InterfaceFactory<Gpu> implementation. |
| 152 virtual void Create(ApplicationConnection* connection, | 153 virtual void Create(ApplicationConnection* connection, |
| 153 InterfaceRequest<Gpu> request) OVERRIDE { | 154 InterfaceRequest<Gpu> request) override { |
| 154 BindToRequest(new GpuImpl(share_group_.get(), mailbox_manager_.get()), | 155 BindToRequest(new GpuImpl(share_group_.get(), mailbox_manager_.get()), |
| 155 &request); | 156 &request); |
| 156 } | 157 } |
| 157 | 158 |
| 158 scoped_refptr<gfx::GLShareGroup> share_group_; | 159 scoped_refptr<gfx::GLShareGroup> share_group_; |
| 159 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | 160 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
| 160 scoped_ptr<ApplicationImpl> app_; | 161 scoped_ptr<ApplicationImpl> app_; |
| 161 DISALLOW_COPY_AND_ASSIGN(NativeViewportApplicationLoader); | 162 DISALLOW_COPY_AND_ASSIGN(NativeViewportApplicationLoader); |
| 162 }; | 163 }; |
| 163 #endif | 164 #endif |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 ScopedMessagePipeHandle Context::ConnectToServiceByName( | 268 ScopedMessagePipeHandle Context::ConnectToServiceByName( |
| 268 const GURL& application_url, | 269 const GURL& application_url, |
| 269 const std::string& service_name) { | 270 const std::string& service_name) { |
| 270 app_urls_.insert(application_url); | 271 app_urls_.insert(application_url); |
| 271 return application_manager_.ConnectToServiceByName( | 272 return application_manager_.ConnectToServiceByName( |
| 272 application_url, service_name).Pass(); | 273 application_url, service_name).Pass(); |
| 273 } | 274 } |
| 274 | 275 |
| 275 } // namespace shell | 276 } // namespace shell |
| 276 } // namespace mojo | 277 } // namespace mojo |
| OLD | NEW |