| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "mandoline/services/core_services/core_services_application_delegate.h" | 5 #include "mandoline/services/core_services/core_services_application_delegate.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/threading/simple_thread.h" | 9 #include "base/threading/simple_thread.h" |
| 10 #include "components/clipboard/clipboard_application_delegate.h" | 10 #include "components/clipboard/clipboard_application_delegate.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #if defined(USE_AURA) | 21 #if defined(USE_AURA) |
| 22 #include "mandoline/ui/omnibox/omnibox_impl.h" | 22 #include "mandoline/ui/omnibox/omnibox_impl.h" |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 #if !defined(OS_ANDROID) | 25 #if !defined(OS_ANDROID) |
| 26 #include "components/resource_provider/resource_provider_app.h" | 26 #include "components/resource_provider/resource_provider_app.h" |
| 27 #include "components/view_manager/view_manager_app.h" | 27 #include "components/view_manager/view_manager_app.h" |
| 28 #include "mojo/services/network/network_service_delegate.h" | 28 #include "mojo/services/network/network_service_delegate.h" |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 #if defined(OS_LINUX) && !defined(OS_ANDROID) |
| 32 #include "components/font_service/font_service_app.h" |
| 33 #endif |
| 34 |
| 31 namespace core_services { | 35 namespace core_services { |
| 32 | 36 |
| 33 // A helper class for hosting a mojo::ApplicationImpl on its own thread. | 37 // A helper class for hosting a mojo::ApplicationImpl on its own thread. |
| 34 class ApplicationThread : public base::SimpleThread { | 38 class ApplicationThread : public base::SimpleThread { |
| 35 public: | 39 public: |
| 36 ApplicationThread( | 40 ApplicationThread( |
| 37 const base::WeakPtr<CoreServicesApplicationDelegate> | 41 const base::WeakPtr<CoreServicesApplicationDelegate> |
| 38 core_services_application, | 42 core_services_application, |
| 39 const std::string& url, | 43 const std::string& url, |
| 40 scoped_ptr<mojo::ApplicationDelegate> delegate, | 44 scoped_ptr<mojo::ApplicationDelegate> delegate, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 mojo::URLResponsePtr response) { | 127 mojo::URLResponsePtr response) { |
| 124 std::string url = response->url; | 128 std::string url = response->url; |
| 125 | 129 |
| 126 scoped_ptr<mojo::ApplicationDelegate> delegate; | 130 scoped_ptr<mojo::ApplicationDelegate> delegate; |
| 127 if (url == "mojo://browser/") { | 131 if (url == "mojo://browser/") { |
| 128 delegate.reset(new mandoline::BrowserManager); | 132 delegate.reset(new mandoline::BrowserManager); |
| 129 } else if (url == "mojo://clipboard/") { | 133 } else if (url == "mojo://clipboard/") { |
| 130 delegate.reset(new clipboard::ClipboardApplicationDelegate); | 134 delegate.reset(new clipboard::ClipboardApplicationDelegate); |
| 131 } else if (url == "mojo://filesystem/") { | 135 } else if (url == "mojo://filesystem/") { |
| 132 delegate.reset(new filesystem::FileSystemApp); | 136 delegate.reset(new filesystem::FileSystemApp); |
| 137 #if defined(OS_LINUX) && !defined(OS_ANDROID) |
| 138 } else if (url == "mojo://font_service/") { |
| 139 delegate.reset(new font_service::FontServiceApp); |
| 140 #endif |
| 133 } else if (url == "mojo://surfaces_service/") { | 141 } else if (url == "mojo://surfaces_service/") { |
| 134 delegate.reset(new surfaces::SurfacesServiceApplication); | 142 delegate.reset(new surfaces::SurfacesServiceApplication); |
| 135 } else if (url == "mojo://tracing/") { | 143 } else if (url == "mojo://tracing/") { |
| 136 delegate.reset(new tracing::TracingApp); | 144 delegate.reset(new tracing::TracingApp); |
| 137 #if defined(USE_AURA) | 145 #if defined(USE_AURA) |
| 138 } else if (url == "mojo://omnibox/") { | 146 } else if (url == "mojo://omnibox/") { |
| 139 delegate.reset(new mandoline::OmniboxImpl); | 147 delegate.reset(new mandoline::OmniboxImpl); |
| 140 #endif | 148 #endif |
| 141 #if !defined(OS_ANDROID) | 149 #if !defined(OS_ANDROID) |
| 142 } else if (url == "mojo://network_service/") { | 150 } else if (url == "mojo://network_service/") { |
| 143 delegate.reset(new mojo::NetworkServiceDelegate); | 151 delegate.reset(new mojo::NetworkServiceDelegate); |
| 144 } else if (url == "mojo://resource_provider/") { | 152 } else if (url == "mojo://resource_provider/") { |
| 145 delegate.reset( | 153 delegate.reset( |
| 146 new resource_provider::ResourceProviderApp("mojo:core_services")); | 154 new resource_provider::ResourceProviderApp("mojo:core_services")); |
| 147 } else if (url == "mojo://view_manager/") { | 155 } else if (url == "mojo://view_manager/") { |
| 148 delegate.reset(new view_manager::ViewManagerApp); | 156 delegate.reset(new view_manager::ViewManagerApp); |
| 149 #endif | 157 #endif |
| 150 } else { | 158 } else { |
| 151 NOTREACHED() << "This application package does not support " << url; | 159 NOTREACHED() << "This application package does not support " << url; |
| 152 } | 160 } |
| 153 | 161 |
| 154 scoped_ptr<ApplicationThread> thread( | 162 scoped_ptr<ApplicationThread> thread( |
| 155 new ApplicationThread(weak_factory_.GetWeakPtr(), url, delegate.Pass(), | 163 new ApplicationThread(weak_factory_.GetWeakPtr(), url, delegate.Pass(), |
| 156 request.Pass())); | 164 request.Pass())); |
| 157 thread->Start(); | 165 thread->Start(); |
| 158 application_threads_.push_back(thread.Pass()); | 166 application_threads_.push_back(thread.Pass()); |
| 159 } | 167 } |
| 160 | 168 |
| 161 } // namespace core_services | 169 } // namespace core_services |
| OLD | NEW |