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 "shell/context.h" | 5 #include "shell/context.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 #if defined(OS_ANDROID) | 144 #if defined(OS_ANDROID) |
145 // TODO(eseidel): On Android we pass command line arguments is via the | 145 // TODO(eseidel): On Android we pass command line arguments is via the |
146 // 'parameters' key on the intent, which we specify during 'am shell start' | 146 // 'parameters' key on the intent, which we specify during 'am shell start' |
147 // via --esa, however that expects comma-separated values and says: | 147 // via --esa, however that expects comma-separated values and says: |
148 // am shell --help: | 148 // am shell --help: |
149 // [--esa <EXTRA_KEY> <EXTRA_STRING_VALUE>[,<EXTRA_STRING_VALUE...]] | 149 // [--esa <EXTRA_KEY> <EXTRA_STRING_VALUE>[,<EXTRA_STRING_VALUE...]] |
150 // (to embed a comma into a string escape it using "\,") | 150 // (to embed a comma into a string escape it using "\,") |
151 // Whatever takes 'parameters' and constructs a CommandLine is failing to | 151 // Whatever takes 'parameters' and constructs a CommandLine is failing to |
152 // un-escape the commas, we need to move this fix to that file. | 152 // un-escape the commas, we need to move this fix to that file. |
153 ReplaceSubstringsAfterOffset(&handlers_spec, 0, "\\,", ","); | 153 base::ReplaceSubstringsAfterOffset(&handlers_spec, 0, "\\,", ","); |
154 #endif | 154 #endif |
155 | 155 |
156 std::vector<std::string> parts; | 156 std::vector<std::string> parts; |
157 base::SplitString(handlers_spec, ',', &parts); | 157 base::SplitString(handlers_spec, ',', &parts); |
158 if (parts.size() % 2 != 0) { | 158 if (parts.size() % 2 != 0) { |
159 LOG(ERROR) << "Invalid value for switch " << switches::kContentHandlers | 159 LOG(ERROR) << "Invalid value for switch " << switches::kContentHandlers |
160 << ": must be a comma-separated list of mimetype/url pairs." | 160 << ": must be a comma-separated list of mimetype/url pairs." |
161 << " Value was: " << handlers_spec; | 161 << " Value was: " << handlers_spec; |
162 return; | 162 return; |
163 } | 163 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 TRACE_EVENT0("mojo_shell", "Context::InitWithPaths"); | 289 TRACE_EVENT0("mojo_shell", "Context::InitWithPaths"); |
290 const base::CommandLine& command_line = | 290 const base::CommandLine& command_line = |
291 *base::CommandLine::ForCurrentProcess(); | 291 *base::CommandLine::ForCurrentProcess(); |
292 | 292 |
293 if (command_line.HasSwitch(switches::kWaitForDebugger)) | 293 if (command_line.HasSwitch(switches::kWaitForDebugger)) |
294 base::debug::WaitForDebugger(60, true); | 294 base::debug::WaitForDebugger(60, true); |
295 | 295 |
296 mojo_shell_child_path_ = shell_child_path; | 296 mojo_shell_child_path_ = shell_child_path; |
297 | 297 |
298 task_runners_.reset( | 298 task_runners_.reset( |
299 new TaskRunners(base::MessageLoop::current()->message_loop_proxy())); | 299 new TaskRunners(base::MessageLoop::current()->task_runner())); |
300 | 300 |
301 #if !defined(OS_MACOSX) | 301 #if !defined(OS_MACOSX) |
302 application_manager()->SetLoaderForURL( | 302 application_manager()->SetLoaderForURL( |
303 make_scoped_ptr(new BackgroundApplicationLoader( | 303 make_scoped_ptr(new BackgroundApplicationLoader( |
304 make_scoped_ptr( | 304 make_scoped_ptr( |
305 new URLResponseDiskCacheLoader(task_runners_->blocking_pool(), | 305 new URLResponseDiskCacheLoader(task_runners_->blocking_pool(), |
306 url_response_disk_cache_delegate)), | 306 url_response_disk_cache_delegate)), |
307 "url_response_disk_cache", base::MessageLoop::TYPE_DEFAULT)), | 307 "url_response_disk_cache", base::MessageLoop::TYPE_DEFAULT)), |
308 GURL("mojo:url_response_disk_cache")); | 308 GURL("mojo:url_response_disk_cache")); |
309 #endif | 309 #endif |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 if (app_urls_.find(url) != app_urls_.end()) { | 399 if (app_urls_.find(url) != app_urls_.end()) { |
400 app_urls_.erase(url); | 400 app_urls_.erase(url); |
401 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { | 401 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { |
402 DCHECK(task_runners_->shell_runner()->RunsTasksOnCurrentThread()); | 402 DCHECK(task_runners_->shell_runner()->RunsTasksOnCurrentThread()); |
403 base::MessageLoop::current()->Quit(); | 403 base::MessageLoop::current()->Quit(); |
404 } | 404 } |
405 } | 405 } |
406 } | 406 } |
407 | 407 |
408 } // namespace shell | 408 } // namespace shell |
OLD | NEW |