OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/browser/web_resource/web_resource_service.h" | 4 #include "chrome/browser/web_resource/web_resource_service.h" |
5 | 5 |
6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
7 #include "base/time.h" | 7 #include "base/time.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 : web_resource_service_(web_resource_service), | 99 : web_resource_service_(web_resource_service), |
100 json_data_(json_data), got_response_(false) { | 100 json_data_(json_data), got_response_(false) { |
101 } | 101 } |
102 | 102 |
103 void Start() { | 103 void Start() { |
104 AddRef(); // balanced in Cleanup. | 104 AddRef(); // balanced in Cleanup. |
105 | 105 |
106 // If we don't have a resource_dispatcher_host_, assume we're in | 106 // If we don't have a resource_dispatcher_host_, assume we're in |
107 // a test and run the unpacker directly in-process. | 107 // a test and run the unpacker directly in-process. |
108 bool use_utility_process = | 108 bool use_utility_process = |
109 web_resource_service_->resource_dispatcher_host_ != NULL; | 109 web_resource_service_->resource_dispatcher_host_ != NULL && |
| 110 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); |
110 | 111 |
111 #if defined(OS_POSIX) | 112 #if defined(OS_POSIX) |
112 // TODO(port): Don't use a utility process on linux (crbug.com/22703) or | 113 // TODO(port): Don't use a utility process on linux (crbug.com/22703) or |
113 // MacOS (crbug.com/8102) until problems related to autoupdate are fixed. | 114 // MacOS (crbug.com/8102) until problems related to autoupdate are fixed. |
114 use_utility_process = false; | 115 use_utility_process = false; |
115 #endif | 116 #endif |
116 | 117 |
117 if (use_utility_process) { | 118 if (use_utility_process) { |
118 ChromeThread::PostTask( | 119 ChromeThread::PostTask( |
119 ChromeThread::IO, FROM_HERE, | 120 ChromeThread::IO, FROM_HERE, |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 // languages, which can be different from the locale. | 306 // languages, which can be different from the locale. |
306 std::wstring languageList = prefs->GetString(prefs::kAcceptLanguages); | 307 std::wstring languageList = prefs->GetString(prefs::kAcceptLanguages); |
307 int pos = languageList.find(L","); | 308 int pos = languageList.find(L","); |
308 pos = pos >= 0 ? pos : languageList.length(); | 309 pos = pos >= 0 ? pos : languageList.length(); |
309 return languageList.substr(0, pos); | 310 return languageList.substr(0, pos); |
310 #else | 311 #else |
311 return ASCIIToWide(g_browser_process->GetApplicationLocale()); | 312 return ASCIIToWide(g_browser_process->GetApplicationLocale()); |
312 #endif | 313 #endif |
313 } | 314 } |
314 | 315 |
OLD | NEW |