Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: content/shell/browser/shell_content_browser_client.cc

Issue 2431753002: Mus experiment in content shell on Android.
Patch Set: Fix mac bot Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/shell/browser/shell_android.cc ('k') | content/shell/common/shell_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/shell/browser/shell_content_browser_client.h" 5 #include "content/shell/browser/shell_content_browser_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/base_switches.h" 10 #include "base/base_switches.h"
(...skipping 30 matching lines...) Expand all
41 #include "net/url_request/url_request_context_getter.h" 41 #include "net/url_request/url_request_context_getter.h"
42 #include "ui/base/resource/resource_bundle.h" 42 #include "ui/base/resource/resource_bundle.h"
43 #include "url/gurl.h" 43 #include "url/gurl.h"
44 #include "url/origin.h" 44 #include "url/origin.h"
45 45
46 #if defined(OS_ANDROID) 46 #if defined(OS_ANDROID)
47 #include "base/android/apk_assets.h" 47 #include "base/android/apk_assets.h"
48 #include "base/android/path_utils.h" 48 #include "base/android/path_utils.h"
49 #include "components/crash/content/browser/crash_dump_manager_android.h" 49 #include "components/crash/content/browser/crash_dump_manager_android.h"
50 #include "content/shell/android/shell_descriptors.h" 50 #include "content/shell/android/shell_descriptors.h"
51 #include "services/ui/demo/mus_demo.h" // nogncheck
52 #include "services/ui/ime/test_ime_driver/test_ime_application.h" // nogncheck
53 #include "services/ui/service.h" // nogncheck
51 #endif 54 #endif
52 55
53 #if defined(OS_POSIX) && !defined(OS_MACOSX) 56 #if defined(OS_POSIX) && !defined(OS_MACOSX)
54 #include "base/debug/leak_annotations.h" 57 #include "base/debug/leak_annotations.h"
55 #include "components/crash/content/app/breakpad_linux.h" 58 #include "components/crash/content/app/breakpad_linux.h"
56 #include "components/crash/content/browser/crash_handler_host_linux.h" 59 #include "components/crash/content/browser/crash_handler_host_linux.h"
57 #include "content/public/common/content_descriptors.h" 60 #include "content/public/common/content_descriptors.h"
58 #endif 61 #endif
59 62
60 #if defined(OS_WIN) 63 #if defined(OS_WIN)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 static breakpad::CrashHandlerHostLinux* crash_handler = NULL; 117 static breakpad::CrashHandlerHostLinux* crash_handler = NULL;
115 if (!crash_handler) 118 if (!crash_handler)
116 crash_handler = CreateCrashHandlerHost(process_type); 119 crash_handler = CreateCrashHandlerHost(process_type);
117 return crash_handler->GetDeathSignalSocket(); 120 return crash_handler->GetDeathSignalSocket();
118 } 121 }
119 122
120 return -1; 123 return -1;
121 } 124 }
122 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 125 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
123 126
127 #if defined(OS_ANDROID)
128
129 // Factory methods to create embedded services.
130
131 std::unique_ptr<service_manager::Service> CreateMojoUIApplication(
132 const base::Closure& quit_closure) {
133 return std::unique_ptr<service_manager::Service>(new ui::Service());
134 }
135
136 std::unique_ptr<service_manager::Service> CreateMojoTestIMEApplication(
137 const base::Closure& quit_closure) {
138 return std::unique_ptr<service_manager::Service>(
139 new ui::test::TestIMEApplication());
140 }
141
142 std::unique_ptr<service_manager::Service> CreateMojoMusDemoService(
143 const base::Closure& quit_closure) {
144 return std::unique_ptr<ui::demo::MusDemo>(new ui::demo::MusDemo());
145 }
146
147 #endif // defined(OS_ANDROID)
148
124 } // namespace 149 } // namespace
125 150
126 ShellContentBrowserClient* ShellContentBrowserClient::Get() { 151 ShellContentBrowserClient* ShellContentBrowserClient::Get() {
127 return g_browser_client; 152 return g_browser_client;
128 } 153 }
129 154
130 void ShellContentBrowserClient::SetSwapProcessesForRedirect(bool swap) { 155 void ShellContentBrowserClient::SetSwapProcessesForRedirect(bool swap) {
131 g_swap_processes_for_redirect = swap; 156 g_swap_processes_for_redirect = swap;
132 } 157 }
133 158
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 return false; 212 return false;
188 } 213 }
189 214
190 void ShellContentBrowserClient::RegisterInProcessServices( 215 void ShellContentBrowserClient::RegisterInProcessServices(
191 StaticServiceMap* services) { 216 StaticServiceMap* services) {
192 #if (ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) 217 #if (ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
193 content::ServiceInfo info; 218 content::ServiceInfo info;
194 info.factory = base::Bind(&media::CreateMediaServiceForTesting); 219 info.factory = base::Bind(&media::CreateMediaServiceForTesting);
195 services->insert(std::make_pair("service:media", info)); 220 services->insert(std::make_pair("service:media", info));
196 #endif 221 #endif
222 #if defined(OS_ANDROID)
223 // Register Mus and the required services for the Mus demo to run.
224 content::ServiceInfo mus_info;
225 mus_info.factory = base::Bind(&CreateMojoUIApplication);
226 mus_info.service_owns_context = true;
227 services->insert(std::make_pair("service:ui", mus_info));
228
229 content::ServiceInfo mus_demo_info;
230 mus_demo_info.factory = base::Bind(&CreateMojoMusDemoService);
231 mus_demo_info.service_owns_context = true;
232 services->insert(std::make_pair("service:mus_demo", mus_demo_info));
233
234 content::ServiceInfo test_ime_info;
235 test_ime_info.factory = base::Bind(&CreateMojoTestIMEApplication);
236 test_ime_info.service_owns_context = true;
237 services->insert(std::make_pair("service:test_ime_driver", test_ime_info));
238 #endif
197 } 239 }
198 240
199 void ShellContentBrowserClient::RegisterOutOfProcessServices( 241 void ShellContentBrowserClient::RegisterOutOfProcessServices(
200 OutOfProcessServiceMap* services) { 242 OutOfProcessServiceMap* services) {
201 services->insert(std::make_pair(kTestServiceUrl, 243 services->insert(std::make_pair(kTestServiceUrl,
202 base::UTF8ToUTF16("Test Service"))); 244 base::UTF8ToUTF16("Test Service")));
203 } 245 }
204 246
205 std::unique_ptr<base::Value> 247 std::unique_ptr<base::Value>
206 ShellContentBrowserClient::GetServiceManifestOverlay( 248 ShellContentBrowserClient::GetServiceManifestOverlay(
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 ShellBrowserContext* ShellContentBrowserClient::browser_context() { 414 ShellBrowserContext* ShellContentBrowserClient::browser_context() {
373 return shell_browser_main_parts_->browser_context(); 415 return shell_browser_main_parts_->browser_context();
374 } 416 }
375 417
376 ShellBrowserContext* 418 ShellBrowserContext*
377 ShellContentBrowserClient::off_the_record_browser_context() { 419 ShellContentBrowserClient::off_the_record_browser_context() {
378 return shell_browser_main_parts_->off_the_record_browser_context(); 420 return shell_browser_main_parts_->off_the_record_browser_context();
379 } 421 }
380 422
381 } // namespace content 423 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/shell_android.cc ('k') | content/shell/common/shell_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698