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/notification_promo.h" | 5 #include "chrome/browser/web_resource/notification_promo.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "apps/pref_names.h" | 10 #include "apps/pref_names.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 group_ = base::RandInt(0, num_groups_ - 1); | 309 group_ = base::RandInt(0, num_groups_ - 1); |
310 WritePrefs(); | 310 WritePrefs(); |
311 } | 311 } |
312 | 312 |
313 // static | 313 // static |
314 void NotificationPromo::RegisterPrefs(PrefRegistrySimple* registry) { | 314 void NotificationPromo::RegisterPrefs(PrefRegistrySimple* registry) { |
315 registry->RegisterDictionaryPref(kPrefPromoObject); | 315 registry->RegisterDictionaryPref(kPrefPromoObject); |
316 } | 316 } |
317 | 317 |
318 // static | 318 // static |
319 void NotificationPromo::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 319 void NotificationPromo::RegisterUserPrefs( |
| 320 user_prefs::PrefRegistrySyncable* registry) { |
320 // TODO(dbeam): Registered only for migration. Remove in M28 when | 321 // TODO(dbeam): Registered only for migration. Remove in M28 when |
321 // we're reasonably sure all prefs are gone. | 322 // we're reasonably sure all prefs are gone. |
322 // http://crbug.com/168887 | 323 // http://crbug.com/168887 |
323 registry->RegisterDictionaryPref(kPrefPromoObject, | 324 registry->RegisterDictionaryPref( |
324 PrefRegistrySyncable::UNSYNCABLE_PREF); | 325 kPrefPromoObject, user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
325 } | 326 } |
326 | 327 |
327 // static | 328 // static |
328 void NotificationPromo::MigrateUserPrefs(PrefService* user_prefs) { | 329 void NotificationPromo::MigrateUserPrefs(PrefService* user_prefs) { |
329 user_prefs->ClearPref(kPrefPromoObject); | 330 user_prefs->ClearPref(kPrefPromoObject); |
330 } | 331 } |
331 | 332 |
332 void NotificationPromo::WritePrefs() { | 333 void NotificationPromo::WritePrefs() { |
333 base::DictionaryValue* ntp_promo = new base::DictionaryValue; | 334 base::DictionaryValue* ntp_promo = new base::DictionaryValue; |
334 ntp_promo->SetString(kPrefPromoText, promo_text_); | 335 ntp_promo->SetString(kPrefPromoText, promo_text_); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 if (group_ < initial_segment_) | 465 if (group_ < initial_segment_) |
465 return start_; | 466 return start_; |
466 return start_ + | 467 return start_ + |
467 std::ceil(static_cast<float>(group_ - initial_segment_ + 1) / increment_) | 468 std::ceil(static_cast<float>(group_ - initial_segment_ + 1) / increment_) |
468 * time_slice_; | 469 * time_slice_; |
469 } | 470 } |
470 | 471 |
471 double NotificationPromo::EndTime() const { | 472 double NotificationPromo::EndTime() const { |
472 return end_; | 473 return end_; |
473 } | 474 } |
OLD | NEW |