OLD | NEW |
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/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 } // namespace | 62 } // namespace |
63 | 63 |
64 // static | 64 // static |
65 void PromoResourceService::RegisterPrefs(PrefRegistrySimple* registry) { | 65 void PromoResourceService::RegisterPrefs(PrefRegistrySimple* registry) { |
66 registry->RegisterStringPref(prefs::kNtpPromoResourceCacheUpdate, "0"); | 66 registry->RegisterStringPref(prefs::kNtpPromoResourceCacheUpdate, "0"); |
67 NotificationPromo::RegisterPrefs(registry); | 67 NotificationPromo::RegisterPrefs(registry); |
68 } | 68 } |
69 | 69 |
70 // static | 70 // static |
71 void PromoResourceService::RegisterUserPrefs( | 71 void PromoResourceService::RegisterProfilePrefs( |
72 user_prefs::PrefRegistrySyncable* registry) { | 72 user_prefs::PrefRegistrySyncable* registry) { |
73 // TODO(dbeam): This is registered only for migration; remove in M28 | 73 // TODO(dbeam): This is registered only for migration; remove in M28 |
74 // when all prefs have been cleared. http://crbug.com/168887 | 74 // when all prefs have been cleared. http://crbug.com/168887 |
75 registry->RegisterStringPref( | 75 registry->RegisterStringPref( |
76 prefs::kNtpPromoResourceCacheUpdate, | 76 prefs::kNtpPromoResourceCacheUpdate, |
77 "0", | 77 "0", |
78 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 78 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
79 NotificationPromo::RegisterUserPrefs(registry); | 79 NotificationPromo::RegisterProfilePrefs(registry); |
80 } | 80 } |
81 | 81 |
82 // static | 82 // static |
83 void PromoResourceService::MigrateUserPrefs(PrefService* user_prefs) { | 83 void PromoResourceService::MigrateUserPrefs(PrefService* user_prefs) { |
84 user_prefs->ClearPref(prefs::kNtpPromoResourceCacheUpdate); | 84 user_prefs->ClearPref(prefs::kNtpPromoResourceCacheUpdate); |
85 NotificationPromo::MigrateUserPrefs(user_prefs); | 85 NotificationPromo::MigrateUserPrefs(user_prefs); |
86 } | 86 } |
87 | 87 |
88 PromoResourceService::PromoResourceService() | 88 PromoResourceService::PromoResourceService() |
89 : WebResourceService(g_browser_process->local_state(), | 89 : WebResourceService(g_browser_process->local_state(), |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 | 169 |
170 void PromoResourceService::Unpack(const DictionaryValue& parsed_json) { | 170 void PromoResourceService::Unpack(const DictionaryValue& parsed_json) { |
171 for (size_t i = 0; i < arraysize(kValidPromoTypes); ++i) { | 171 for (size_t i = 0; i < arraysize(kValidPromoTypes); ++i) { |
172 NotificationPromo notification_promo; | 172 NotificationPromo notification_promo; |
173 notification_promo.InitFromJson(parsed_json, kValidPromoTypes[i]); | 173 notification_promo.InitFromJson(parsed_json, kValidPromoTypes[i]); |
174 if (notification_promo.new_notification()) | 174 if (notification_promo.new_notification()) |
175 ScheduleNotification(notification_promo); | 175 ScheduleNotification(notification_promo); |
176 } | 176 } |
177 } | 177 } |
OLD | NEW |