| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 110 |
| 111 #if defined(OS_POSIX) | 111 #if defined(OS_POSIX) |
| 112 // TODO(port): Don't use a utility process on linux (crbug.com/22703) or | 112 // 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. | 113 // MacOS (crbug.com/8102) until problems related to autoupdate are fixed. |
| 114 use_utility_process = false; | 114 use_utility_process = false; |
| 115 #endif | 115 #endif |
| 116 | 116 |
| 117 if (use_utility_process) { | 117 if (use_utility_process) { |
| 118 ChromeThread::GetMessageLoop(ChromeThread::IO)->PostTask(FROM_HERE, | 118 ChromeThread::PostTask( |
| 119 ChromeThread::IO, FROM_HERE, |
| 119 NewRunnableMethod(this, &UnpackerClient::StartProcessOnIOThread, | 120 NewRunnableMethod(this, &UnpackerClient::StartProcessOnIOThread, |
| 120 web_resource_service_->resource_dispatcher_host_, | 121 web_resource_service_->resource_dispatcher_host_, |
| 121 MessageLoop::current())); | 122 MessageLoop::current())); |
| 122 } else { | 123 } else { |
| 123 WebResourceUnpacker unpacker(json_data_); | 124 WebResourceUnpacker unpacker(json_data_); |
| 124 if (unpacker.Run()) { | 125 if (unpacker.Run()) { |
| 125 OnUnpackWebResourceSucceeded(*unpacker.parsed_json()); | 126 OnUnpackWebResourceSucceeded(*unpacker.parsed_json()); |
| 126 } else { | 127 } else { |
| 127 OnUnpackWebResourceFailed(unpacker.error_message()); | 128 OnUnpackWebResourceFailed(unpacker.error_message()); |
| 128 } | 129 } |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // languages, which can be different from the locale. | 305 // languages, which can be different from the locale. |
| 305 std::wstring languageList = prefs->GetString(prefs::kAcceptLanguages); | 306 std::wstring languageList = prefs->GetString(prefs::kAcceptLanguages); |
| 306 int pos = languageList.find(L","); | 307 int pos = languageList.find(L","); |
| 307 pos = pos >= 0 ? pos : languageList.length(); | 308 pos = pos >= 0 ? pos : languageList.length(); |
| 308 return languageList.substr(0, pos); | 309 return languageList.substr(0, pos); |
| 309 #else | 310 #else |
| 310 return ASCIIToWide(g_browser_process->GetApplicationLocale()); | 311 return ASCIIToWide(g_browser_process->GetApplicationLocale()); |
| 311 #endif | 312 #endif |
| 312 } | 313 } |
| 313 | 314 |
| OLD | NEW |