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 | |
35 namespace core_services { | 31 namespace core_services { |
36 | 32 |
37 // A helper class for hosting a mojo::ApplicationImpl on its own thread. | 33 // A helper class for hosting a mojo::ApplicationImpl on its own thread. |
38 class ApplicationThread : public base::SimpleThread { | 34 class ApplicationThread : public base::SimpleThread { |
39 public: | 35 public: |
40 ApplicationThread( | 36 ApplicationThread( |
41 const base::WeakPtr<CoreServicesApplicationDelegate> | 37 const base::WeakPtr<CoreServicesApplicationDelegate> |
42 core_services_application, | 38 core_services_application, |
43 const std::string& url, | 39 const std::string& url, |
44 scoped_ptr<mojo::ApplicationDelegate> delegate, | 40 scoped_ptr<mojo::ApplicationDelegate> delegate, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 mojo::URLResponsePtr response) { | 123 mojo::URLResponsePtr response) { |
128 std::string url = response->url; | 124 std::string url = response->url; |
129 | 125 |
130 scoped_ptr<mojo::ApplicationDelegate> delegate; | 126 scoped_ptr<mojo::ApplicationDelegate> delegate; |
131 if (url == "mojo://browser/") { | 127 if (url == "mojo://browser/") { |
132 delegate.reset(new mandoline::BrowserManager); | 128 delegate.reset(new mandoline::BrowserManager); |
133 } else if (url == "mojo://clipboard/") { | 129 } else if (url == "mojo://clipboard/") { |
134 delegate.reset(new clipboard::ClipboardApplicationDelegate); | 130 delegate.reset(new clipboard::ClipboardApplicationDelegate); |
135 } else if (url == "mojo://filesystem/") { | 131 } else if (url == "mojo://filesystem/") { |
136 delegate.reset(new filesystem::FileSystemApp); | 132 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 | |
141 } else if (url == "mojo://surfaces_service/") { | 133 } else if (url == "mojo://surfaces_service/") { |
142 delegate.reset(new surfaces::SurfacesServiceApplication); | 134 delegate.reset(new surfaces::SurfacesServiceApplication); |
143 } else if (url == "mojo://tracing/") { | 135 } else if (url == "mojo://tracing/") { |
144 delegate.reset(new tracing::TracingApp); | 136 delegate.reset(new tracing::TracingApp); |
145 #if defined(USE_AURA) | 137 #if defined(USE_AURA) |
146 } else if (url == "mojo://omnibox/") { | 138 } else if (url == "mojo://omnibox/") { |
147 delegate.reset(new mandoline::OmniboxImpl); | 139 delegate.reset(new mandoline::OmniboxImpl); |
148 #endif | 140 #endif |
149 #if !defined(OS_ANDROID) | 141 #if !defined(OS_ANDROID) |
150 } else if (url == "mojo://network_service/") { | 142 } else if (url == "mojo://network_service/") { |
151 delegate.reset(new mojo::NetworkServiceDelegate); | 143 delegate.reset(new mojo::NetworkServiceDelegate); |
152 } else if (url == "mojo://resource_provider/") { | 144 } else if (url == "mojo://resource_provider/") { |
153 delegate.reset( | 145 delegate.reset( |
154 new resource_provider::ResourceProviderApp("mojo:core_services")); | 146 new resource_provider::ResourceProviderApp("mojo:core_services")); |
155 } else if (url == "mojo://view_manager/") { | 147 } else if (url == "mojo://view_manager/") { |
156 delegate.reset(new view_manager::ViewManagerApp); | 148 delegate.reset(new view_manager::ViewManagerApp); |
157 #endif | 149 #endif |
158 } else { | 150 } else { |
159 NOTREACHED() << "This application package does not support " << url; | 151 NOTREACHED() << "This application package does not support " << url; |
160 } | 152 } |
161 | 153 |
162 scoped_ptr<ApplicationThread> thread( | 154 scoped_ptr<ApplicationThread> thread( |
163 new ApplicationThread(weak_factory_.GetWeakPtr(), url, delegate.Pass(), | 155 new ApplicationThread(weak_factory_.GetWeakPtr(), url, delegate.Pass(), |
164 request.Pass())); | 156 request.Pass())); |
165 thread->Start(); | 157 thread->Start(); |
166 application_threads_.push_back(thread.Pass()); | 158 application_threads_.push_back(thread.Pass()); |
167 } | 159 } |
168 | 160 |
169 } // namespace core_services | 161 } // namespace core_services |
OLD | NEW |