Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: chrome/browser/extensions/extension_updater.cc

Issue 8198007: Remove PrefService::ScheduleSavePersistentPrefs and SavePersistentPrefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/extensions/extension_updater.h" 5 #include "chrome/browser/extensions/extension_updater.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 } 823 }
824 std::vector<std::string> blacklist; 824 std::vector<std::string> blacklist;
825 base::SplitString(data, '\n', &blacklist); 825 base::SplitString(data, '\n', &blacklist);
826 826
827 // Tell ExtensionService to update prefs. 827 // Tell ExtensionService to update prefs.
828 service_->UpdateExtensionBlacklist(blacklist); 828 service_->UpdateExtensionBlacklist(blacklist);
829 829
830 // Update the pref value for blacklist version 830 // Update the pref value for blacklist version
831 prefs_->SetString(kExtensionBlacklistUpdateVersion, 831 prefs_->SetString(kExtensionBlacklistUpdateVersion,
832 current_extension_fetch_.version); 832 current_extension_fetch_.version);
833 prefs_->ScheduleSavePersistentPrefs();
834 } 833 }
835 834
836 void ExtensionUpdater::OnCRXFetchComplete( 835 void ExtensionUpdater::OnCRXFetchComplete(
837 const content::URLFetcher* source, 836 const content::URLFetcher* source,
838 const GURL& url, 837 const GURL& url,
839 const net::URLRequestStatus& status, 838 const net::URLRequestStatus& status,
840 int response_code) { 839 int response_code) {
841 840
842 base::PlatformFileError error_code = base::PLATFORM_FILE_OK; 841 base::PlatformFileError error_code = base::PLATFORM_FILE_OK;
843 if (source->FileErrorOccurred(&error_code)) { 842 if (source->FileErrorOccurred(&error_code)) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 // Add +/- 10% random jitter. 951 // Add +/- 10% random jitter.
953 double delay_ms = target_delay.InMillisecondsF(); 952 double delay_ms = target_delay.InMillisecondsF();
954 double jitter_factor = (RandDouble() * .2) - 0.1; 953 double jitter_factor = (RandDouble() * .2) - 0.1;
955 delay_ms += delay_ms * jitter_factor; 954 delay_ms += delay_ms * jitter_factor;
956 TimeDelta actual_delay = TimeDelta::FromMilliseconds( 955 TimeDelta actual_delay = TimeDelta::FromMilliseconds(
957 static_cast<int64>(delay_ms)); 956 static_cast<int64>(delay_ms));
958 957
959 // Save the time of next check. 958 // Save the time of next check.
960 Time next = Time::Now() + actual_delay; 959 Time next = Time::Now() + actual_delay;
961 prefs_->SetInt64(kNextExtensionsUpdateCheck, next.ToInternalValue()); 960 prefs_->SetInt64(kNextExtensionsUpdateCheck, next.ToInternalValue());
962 prefs_->ScheduleSavePersistentPrefs();
963 961
964 timer_.Start(FROM_HERE, actual_delay, this, &ExtensionUpdater::TimerFired); 962 timer_.Start(FROM_HERE, actual_delay, this, &ExtensionUpdater::TimerFired);
965 } 963 }
966 964
967 void ExtensionUpdater::TimerFired() { 965 void ExtensionUpdater::TimerFired() {
968 DCHECK(alive_); 966 DCHECK(alive_);
969 CheckNow(); 967 CheckNow();
970 968
971 // If the user has overridden the update frequency, don't bother reporting 969 // If the user has overridden the update frequency, don't bother reporting
972 // this. 970 // this.
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 std::set<std::string>::const_iterator i; 1280 std::set<std::string>::const_iterator i;
1283 for (i = ids.begin(); i != ids.end(); ++i) 1281 for (i = ids.begin(); i != ids.end(); ++i)
1284 in_progress_ids_.insert(*i); 1282 in_progress_ids_.insert(*i);
1285 } 1283 }
1286 1284
1287 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) { 1285 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) {
1288 std::set<std::string>::const_iterator i; 1286 std::set<std::string>::const_iterator i;
1289 for (i = ids.begin(); i != ids.end(); ++i) 1287 for (i = ids.begin(); i != ids.end(); ++i)
1290 in_progress_ids_.erase(*i); 1288 in_progress_ids_.erase(*i);
1291 } 1289 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_toolbar_model.cc ('k') | chrome/browser/extensions/test_extension_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698