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

Side by Side Diff: chrome/browser/web_resource/promo_resource_service.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/web_resource/promo_resource_service.h" 5 #include "chrome/browser/web_resource/promo_resource_service.h"
6 6
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/threading/thread_restrictions.h" 8 #include "base/threading/thread_restrictions.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 "https://www.google.com/support/chrome/bin/topic/1142433/inproduct?hl="; 55 "https://www.google.com/support/chrome/bin/topic/1142433/inproduct?hl=";
56 56
57 // static 57 // static
58 void PromoResourceService::RegisterPrefs(PrefService* local_state) { 58 void PromoResourceService::RegisterPrefs(PrefService* local_state) {
59 local_state->RegisterIntegerPref(prefs::kNTPPromoVersion, 0); 59 local_state->RegisterIntegerPref(prefs::kNTPPromoVersion, 0);
60 local_state->RegisterStringPref(prefs::kNTPPromoLocale, std::string()); 60 local_state->RegisterStringPref(prefs::kNTPPromoLocale, std::string());
61 } 61 }
62 62
63 // static 63 // static
64 void PromoResourceService::RegisterUserPrefs(PrefService* prefs) { 64 void PromoResourceService::RegisterUserPrefs(PrefService* prefs) {
65 prefs->RegisterDoublePref(prefs::kNTPCustomLogoStart, 0); 65 prefs->RegisterDoublePref(prefs::kNTPCustomLogoStart,
66 prefs->RegisterDoublePref(prefs::kNTPCustomLogoEnd, 0); 66 0,
67 prefs->RegisterDoublePref(prefs::kNTPPromoStart, 0); 67 PrefService::UNSYNCABLE_PREF);
68 prefs->RegisterDoublePref(prefs::kNTPPromoEnd, 0); 68 prefs->RegisterDoublePref(prefs::kNTPCustomLogoEnd,
69 prefs->RegisterStringPref(prefs::kNTPPromoLine, std::string()); 69 0,
70 prefs->RegisterBooleanPref(prefs::kNTPPromoClosed, false); 70 PrefService::UNSYNCABLE_PREF);
71 prefs->RegisterIntegerPref(prefs::kNTPPromoGroup, -1); 71 prefs->RegisterDoublePref(prefs::kNTPPromoStart,
72 prefs->RegisterIntegerPref(prefs::kNTPPromoBuild, 72 0,
73 CANARY_BUILD | DEV_BUILD | BETA_BUILD | STABLE_BUILD); 73 PrefService::UNSYNCABLE_PREF);
74 prefs->RegisterIntegerPref(prefs::kNTPPromoGroupTimeSlice, 0); 74 prefs->RegisterDoublePref(prefs::kNTPPromoEnd,
75 0,
76 PrefService::UNSYNCABLE_PREF);
77 prefs->RegisterStringPref(prefs::kNTPPromoLine,
78 std::string(),
79 PrefService::UNSYNCABLE_PREF);
80 prefs->RegisterBooleanPref(prefs::kNTPPromoClosed,
81 false,
82 PrefService::UNSYNCABLE_PREF);
83 prefs->RegisterIntegerPref(prefs::kNTPPromoGroup,
84 -1,
85 PrefService::UNSYNCABLE_PREF);
86 prefs->RegisterIntegerPref(
87 prefs::kNTPPromoBuild,
88 CANARY_BUILD | DEV_BUILD | BETA_BUILD | STABLE_BUILD,
89 PrefService::UNSYNCABLE_PREF);
90 prefs->RegisterIntegerPref(prefs::kNTPPromoGroupTimeSlice,
91 0,
92 PrefService::UNSYNCABLE_PREF);
75 } 93 }
76 94
77 // static 95 // static
78 bool PromoResourceService::IsBuildTargeted(platform_util::Channel channel, 96 bool PromoResourceService::IsBuildTargeted(platform_util::Channel channel,
79 int builds_allowed) { 97 int builds_allowed) {
80 if (builds_allowed == NO_BUILD) 98 if (builds_allowed == NO_BUILD)
81 return false; 99 return false;
82 switch (channel) { 100 switch (channel) {
83 case platform_util::CHANNEL_CANARY: 101 case platform_util::CHANNEL_CANARY:
84 return (CANARY_BUILD & builds_allowed) != 0; 102 return (CANARY_BUILD & builds_allowed) != 0;
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 base::ThreadRestrictions::ScopedAllowIO allow_io; 452 base::ThreadRestrictions::ScopedAllowIO allow_io;
435 platform_util::Channel channel = platform_util::GetChannel(); 453 platform_util::Channel channel = platform_util::GetChannel();
436 is_promo_build = PromoResourceService::IsBuildTargeted( 454 is_promo_build = PromoResourceService::IsBuildTargeted(
437 channel, prefs->GetInteger(prefs::kNTPPromoBuild)); 455 channel, prefs->GetInteger(prefs::kNTPPromoBuild));
438 } 456 }
439 457
440 return !promo_closed && !is_synced && is_promo_build; 458 return !promo_closed && !is_synced && is_promo_build;
441 } 459 }
442 460
443 } // namespace PromoResourceServiceUtil 461 } // namespace PromoResourceServiceUtil
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/plugins_ui.cc ('k') | chrome/browser/web_resource/web_resource_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698