| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/web_resource/web_resource_service.h" | 5 #include "chrome/browser/web_resource/web_resource_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 in_fetch_(false), | 211 in_fetch_(false), |
| 212 web_resource_server_(web_resource_server), | 212 web_resource_server_(web_resource_server), |
| 213 apply_locale_to_url_(apply_locale_to_url), | 213 apply_locale_to_url_(apply_locale_to_url), |
| 214 notification_type_(notification_type), | 214 notification_type_(notification_type), |
| 215 last_update_time_pref_name_(last_update_time_pref_name), | 215 last_update_time_pref_name_(last_update_time_pref_name), |
| 216 start_fetch_delay_(start_fetch_delay), | 216 start_fetch_delay_(start_fetch_delay), |
| 217 cache_update_delay_(cache_update_delay), | 217 cache_update_delay_(cache_update_delay), |
| 218 web_resource_update_scheduled_(false) { | 218 web_resource_update_scheduled_(false) { |
| 219 DCHECK(prefs); | 219 DCHECK(prefs); |
| 220 DCHECK(profile); | 220 DCHECK(profile); |
| 221 prefs_->RegisterStringPref(last_update_time_pref_name, "0"); | 221 prefs_->RegisterStringPref(last_update_time_pref_name, |
| 222 "0", |
| 223 PrefService::UNSYNCABLE_PREF); |
| 222 resource_dispatcher_host_ = g_browser_process->resource_dispatcher_host(); | 224 resource_dispatcher_host_ = g_browser_process->resource_dispatcher_host(); |
| 223 web_resource_fetcher_.reset(new WebResourceFetcher(this)); | 225 web_resource_fetcher_.reset(new WebResourceFetcher(this)); |
| 224 } | 226 } |
| 225 | 227 |
| 226 WebResourceService::~WebResourceService() { } | 228 WebResourceService::~WebResourceService() { } |
| 227 | 229 |
| 228 void WebResourceService::PostNotification(int64 delay_ms) { | 230 void WebResourceService::PostNotification(int64 delay_ms) { |
| 229 if (web_resource_update_scheduled_) | 231 if (web_resource_update_scheduled_) |
| 230 return; | 232 return; |
| 231 if (delay_ms > 0) { | 233 if (delay_ms > 0) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 } | 283 } |
| 282 | 284 |
| 283 void WebResourceService::UpdateResourceCache(const std::string& json_data) { | 285 void WebResourceService::UpdateResourceCache(const std::string& json_data) { |
| 284 UnpackerClient* client = new UnpackerClient(this, json_data); | 286 UnpackerClient* client = new UnpackerClient(this, json_data); |
| 285 client->Start(); | 287 client->Start(); |
| 286 | 288 |
| 287 // Set cache update time in preferences. | 289 // Set cache update time in preferences. |
| 288 prefs_->SetString(last_update_time_pref_name_, | 290 prefs_->SetString(last_update_time_pref_name_, |
| 289 base::DoubleToString(base::Time::Now().ToDoubleT())); | 291 base::DoubleToString(base::Time::Now().ToDoubleT())); |
| 290 } | 292 } |
| OLD | NEW |