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

Side by Side Diff: chrome/browser/web_resource/promo_resource_service.cc

Issue 11741003: Remove PrefServiceSimple, replacing it with PrefService and PrefRegistrySimple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix double registration in Chrome Frame test. Created 7 years, 10 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
« no previous file with comments | « chrome/browser/web_resource/promo_resource_service.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/prefs/pref_service_simple.h" 13 #include "chrome/browser/prefs/pref_registry_simple.h"
14 #include "chrome/browser/prefs/pref_service_syncable.h" 14 #include "chrome/browser/prefs/pref_service_syncable.h"
15 #include "chrome/browser/web_resource/notification_promo.h" 15 #include "chrome/browser/web_resource/notification_promo.h"
16 #include "chrome/common/chrome_notification_types.h" 16 #include "chrome/common/chrome_notification_types.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
19 #include "content/public/browser/notification_service.h" 19 #include "content/public/browser/notification_service.h"
20 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
21 21
22 namespace { 22 namespace {
23 23
(...skipping 30 matching lines...) Expand all
54 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kPromoServerURL); 54 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kPromoServerURL);
55 } 55 }
56 56
57 int GetCacheUpdateDelay() { 57 int GetCacheUpdateDelay() {
58 return IsTest() ? kTestCacheUpdateDelay : kCacheUpdateDelay; 58 return IsTest() ? kTestCacheUpdateDelay : kCacheUpdateDelay;
59 } 59 }
60 60
61 } // namespace 61 } // namespace
62 62
63 // static 63 // static
64 void PromoResourceService::RegisterPrefs(PrefServiceSimple* local_state) { 64 void PromoResourceService::RegisterPrefs(PrefRegistrySimple* registry) {
65 local_state->RegisterStringPref(prefs::kNtpPromoResourceCacheUpdate, "0"); 65 registry->RegisterStringPref(prefs::kNtpPromoResourceCacheUpdate, "0");
66 NotificationPromo::RegisterPrefs(local_state); 66 NotificationPromo::RegisterPrefs(registry);
67 } 67 }
68 68
69 // static 69 // static
70 void PromoResourceService::RegisterUserPrefs(PrefServiceSyncable* prefs) { 70 void PromoResourceService::RegisterUserPrefs(PrefServiceSyncable* prefs) {
71 // TODO(dbeam): remove in M28 when all prefs have been cleared. 71 // TODO(dbeam): remove in M28 when all prefs have been cleared.
72 // http://crbug.com/168887 72 // http://crbug.com/168887
73 prefs->RegisterStringPref(prefs::kNtpPromoResourceCacheUpdate, 73 prefs->RegisterStringPref(prefs::kNtpPromoResourceCacheUpdate,
74 "0", 74 "0",
75 PrefServiceSyncable::UNSYNCABLE_PREF); 75 PrefServiceSyncable::UNSYNCABLE_PREF);
76 prefs->ClearPref(prefs::kNtpPromoResourceCacheUpdate); 76 prefs->ClearPref(prefs::kNtpPromoResourceCacheUpdate);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 162
163 void PromoResourceService::Unpack(const DictionaryValue& parsed_json) { 163 void PromoResourceService::Unpack(const DictionaryValue& parsed_json) {
164 for (size_t i = 0; i < arraysize(kValidPromoTypes); ++i) { 164 for (size_t i = 0; i < arraysize(kValidPromoTypes); ++i) {
165 NotificationPromo notification_promo; 165 NotificationPromo notification_promo;
166 notification_promo.InitFromJson(parsed_json, kValidPromoTypes[i]); 166 notification_promo.InitFromJson(parsed_json, kValidPromoTypes[i]);
167 if (notification_promo.new_notification()) 167 if (notification_promo.new_notification())
168 ScheduleNotification(notification_promo); 168 ScheduleNotification(notification_promo);
169 } 169 }
170 } 170 }
OLDNEW
« no previous file with comments | « chrome/browser/web_resource/promo_resource_service.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698