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

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

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Really fix. And rebase Created 9 years, 7 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/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 frequency_seconds_ = std::min(frequency_seconds_, kMaxUpdateFrequencySeconds); 492 frequency_seconds_ = std::min(frequency_seconds_, kMaxUpdateFrequencySeconds);
493 } 493 }
494 494
495 ExtensionUpdater::~ExtensionUpdater() { 495 ExtensionUpdater::~ExtensionUpdater() {
496 Stop(); 496 Stop();
497 } 497 }
498 498
499 static void EnsureInt64PrefRegistered(PrefService* prefs, 499 static void EnsureInt64PrefRegistered(PrefService* prefs,
500 const char name[]) { 500 const char name[]) {
501 if (!prefs->FindPreference(name)) 501 if (!prefs->FindPreference(name))
502 prefs->RegisterInt64Pref(name, 0); 502 prefs->RegisterInt64Pref(name, 0, PrefService::UNSYNCABLE_PREF);
503 } 503 }
504 504
505 static void EnsureBlacklistVersionPrefRegistered(PrefService* prefs) { 505 static void EnsureBlacklistVersionPrefRegistered(PrefService* prefs) {
506 if (!prefs->FindPreference(kExtensionBlacklistUpdateVersion)) 506 if (!prefs->FindPreference(kExtensionBlacklistUpdateVersion)) {
507 prefs->RegisterStringPref(kExtensionBlacklistUpdateVersion, "0"); 507 prefs->RegisterStringPref(kExtensionBlacklistUpdateVersion,
508 "0",
509 PrefService::UNSYNCABLE_PREF);
510 }
508 } 511 }
509 512
510 // The overall goal here is to balance keeping clients up to date while 513 // The overall goal here is to balance keeping clients up to date while
511 // avoiding a thundering herd against update servers. 514 // avoiding a thundering herd against update servers.
512 TimeDelta ExtensionUpdater::DetermineFirstCheckDelay() { 515 TimeDelta ExtensionUpdater::DetermineFirstCheckDelay() {
513 DCHECK(alive_); 516 DCHECK(alive_);
514 // If someone's testing with a quick frequency, just allow it. 517 // If someone's testing with a quick frequency, just allow it.
515 if (frequency_seconds_ < kStartupWaitSeconds) 518 if (frequency_seconds_ < kStartupWaitSeconds)
516 return TimeDelta::FromSeconds(frequency_seconds_); 519 return TimeDelta::FromSeconds(frequency_seconds_);
517 520
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 std::set<std::string>::const_iterator i; 1171 std::set<std::string>::const_iterator i;
1169 for (i = ids.begin(); i != ids.end(); ++i) 1172 for (i = ids.begin(); i != ids.end(); ++i)
1170 in_progress_ids_.insert(*i); 1173 in_progress_ids_.insert(*i);
1171 } 1174 }
1172 1175
1173 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) { 1176 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) {
1174 std::set<std::string>::const_iterator i; 1177 std::set<std::string>::const_iterator i;
1175 for (i = ids.begin(); i != ids.end(); ++i) 1178 for (i = ids.begin(); i != ids.end(); ++i)
1176 in_progress_ids_.erase(*i); 1179 in_progress_ids_.erase(*i);
1177 } 1180 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_prefs_unittest.cc ('k') | chrome/browser/extensions/extension_web_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698