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/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // static | 63 // static |
64 void PromoResourceService::RegisterPrefs(PrefServiceSimple* local_state) { | 64 void PromoResourceService::RegisterPrefs(PrefServiceSimple* local_state) { |
65 local_state->RegisterStringPref(prefs::kNtpPromoResourceCacheUpdate, "0"); | 65 local_state->RegisterStringPref(prefs::kNtpPromoResourceCacheUpdate, "0"); |
66 NotificationPromo::RegisterPrefs(local_state); | 66 NotificationPromo::RegisterPrefs(local_state); |
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 prefs->RegisterStringPref(prefs::kNtpPromoResourceCacheUpdate, | 73 prefs->RegisterStringPref(prefs::kNtpPromoResourceCacheUpdate, |
73 "0", | 74 "0", |
74 PrefServiceSyncable::UNSYNCABLE_PREF); | 75 PrefServiceSyncable::UNSYNCABLE_PREF); |
75 prefs->ClearPref(prefs::kNtpPromoResourceCacheUpdate); | 76 prefs->ClearPref(prefs::kNtpPromoResourceCacheUpdate); |
76 NotificationPromo::RegisterUserPrefs(prefs); | 77 NotificationPromo::RegisterUserPrefs(prefs); |
77 } | 78 } |
78 | 79 |
79 PromoResourceService::PromoResourceService() | 80 PromoResourceService::PromoResourceService() |
80 : WebResourceService(g_browser_process->local_state(), | 81 : WebResourceService(g_browser_process->local_state(), |
81 GetPromoResourceURL(), | 82 GetPromoResourceURL(), |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } | 161 } |
161 | 162 |
162 void PromoResourceService::Unpack(const DictionaryValue& parsed_json) { | 163 void PromoResourceService::Unpack(const DictionaryValue& parsed_json) { |
163 for (size_t i = 0; i < arraysize(kValidPromoTypes); ++i) { | 164 for (size_t i = 0; i < arraysize(kValidPromoTypes); ++i) { |
164 NotificationPromo notification_promo; | 165 NotificationPromo notification_promo; |
165 notification_promo.InitFromJson(parsed_json, kValidPromoTypes[i]); | 166 notification_promo.InitFromJson(parsed_json, kValidPromoTypes[i]); |
166 if (notification_promo.new_notification()) | 167 if (notification_promo.new_notification()) |
167 ScheduleNotification(notification_promo); | 168 ScheduleNotification(notification_promo); |
168 } | 169 } |
169 } | 170 } |
OLD | NEW |