| 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/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 L"https://clients2.google.com/tools/service/npredir?r=chrometips_mac&hl="; | 189 L"https://clients2.google.com/tools/service/npredir?r=chrometips_mac&hl="; |
| 190 #elif defined(OS_LINUX) | 190 #elif defined(OS_LINUX) |
| 191 L"https://clients2.google.com/tools/service/npredir?r=chrometips_linux&hl="; | 191 L"https://clients2.google.com/tools/service/npredir?r=chrometips_linux&hl="; |
| 192 #else | 192 #else |
| 193 L"https://clients2.google.com/tools/service/npredir?r=chrometips_win&hl="; | 193 L"https://clients2.google.com/tools/service/npredir?r=chrometips_win&hl="; |
| 194 #endif | 194 #endif |
| 195 | 195 |
| 196 const char* WebResourceService::kResourceDirectoryName = | 196 const char* WebResourceService::kResourceDirectoryName = |
| 197 "Resources"; | 197 "Resources"; |
| 198 | 198 |
| 199 WebResourceService::WebResourceService(Profile* profile, | 199 WebResourceService::WebResourceService(Profile* profile) : |
| 200 MessageLoop* backend_loop) : | |
| 201 prefs_(profile->GetPrefs()), | 200 prefs_(profile->GetPrefs()), |
| 202 web_resource_dir_(profile->GetPath().AppendASCII(kResourceDirectoryName)), | 201 web_resource_dir_(profile->GetPath().AppendASCII(kResourceDirectoryName)), |
| 203 backend_loop_(backend_loop), | |
| 204 in_fetch_(false) { | 202 in_fetch_(false) { |
| 205 Init(); | 203 Init(); |
| 206 } | 204 } |
| 207 | 205 |
| 208 WebResourceService::~WebResourceService() { } | 206 WebResourceService::~WebResourceService() { } |
| 209 | 207 |
| 210 void WebResourceService::Init() { | 208 void WebResourceService::Init() { |
| 211 resource_dispatcher_host_ = g_browser_process->resource_dispatcher_host(); | 209 resource_dispatcher_host_ = g_browser_process->resource_dispatcher_host(); |
| 212 web_resource_fetcher_ = new WebResourceFetcher(this); | 210 web_resource_fetcher_ = new WebResourceFetcher(this); |
| 213 prefs_->RegisterStringPref(prefs::kNTPTipsCacheUpdate, L"0"); | 211 prefs_->RegisterStringPref(prefs::kNTPTipsCacheUpdate, L"0"); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 // languages, which can be different from the locale. | 308 // languages, which can be different from the locale. |
| 311 std::wstring languageList = prefs->GetString(prefs::kAcceptLanguages); | 309 std::wstring languageList = prefs->GetString(prefs::kAcceptLanguages); |
| 312 int pos = languageList.find(L","); | 310 int pos = languageList.find(L","); |
| 313 pos = pos >= 0 ? pos : languageList.length(); | 311 pos = pos >= 0 ? pos : languageList.length(); |
| 314 return languageList.substr(0, pos); | 312 return languageList.substr(0, pos); |
| 315 #else | 313 #else |
| 316 return ASCIIToWide(g_browser_process->GetApplicationLocale()); | 314 return ASCIIToWide(g_browser_process->GetApplicationLocale()); |
| 317 #endif | 315 #endif |
| 318 } | 316 } |
| 319 | 317 |
| OLD | NEW |