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 "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 void NotificationPromo::RegisterPrefs(PrefRegistrySimple* registry) { | 319 void NotificationPromo::RegisterPrefs(PrefRegistrySimple* registry) { |
320 registry->RegisterDictionaryPref(kPrefPromoObject); | 320 registry->RegisterDictionaryPref(kPrefPromoObject); |
321 } | 321 } |
322 | 322 |
323 // static | 323 // static |
324 void NotificationPromo::RegisterProfilePrefs( | 324 void NotificationPromo::RegisterProfilePrefs( |
325 user_prefs::PrefRegistrySyncable* registry) { | 325 user_prefs::PrefRegistrySyncable* registry) { |
326 // TODO(dbeam): Registered only for migration. Remove in M28 when | 326 // TODO(dbeam): Registered only for migration. Remove in M28 when |
327 // we're reasonably sure all prefs are gone. | 327 // we're reasonably sure all prefs are gone. |
328 // http://crbug.com/168887 | 328 // http://crbug.com/168887 |
329 registry->RegisterDictionaryPref( | 329 registry->RegisterDictionaryPref(kPrefPromoObject); |
330 kPrefPromoObject, user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
331 } | 330 } |
332 | 331 |
333 // static | 332 // static |
334 void NotificationPromo::MigrateUserPrefs(PrefService* user_prefs) { | 333 void NotificationPromo::MigrateUserPrefs(PrefService* user_prefs) { |
335 user_prefs->ClearPref(kPrefPromoObject); | 334 user_prefs->ClearPref(kPrefPromoObject); |
336 } | 335 } |
337 | 336 |
338 void NotificationPromo::WritePrefs() { | 337 void NotificationPromo::WritePrefs() { |
339 base::DictionaryValue* ntp_promo = new base::DictionaryValue; | 338 base::DictionaryValue* ntp_promo = new base::DictionaryValue; |
340 ntp_promo->SetString(kPrefPromoText, promo_text_); | 339 ntp_promo->SetString(kPrefPromoText, promo_text_); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 if (group_ < initial_segment_) | 481 if (group_ < initial_segment_) |
483 return start_; | 482 return start_; |
484 return start_ + | 483 return start_ + |
485 std::ceil(static_cast<float>(group_ - initial_segment_ + 1) / increment_) | 484 std::ceil(static_cast<float>(group_ - initial_segment_ + 1) / increment_) |
486 * time_slice_; | 485 * time_slice_; |
487 } | 486 } |
488 | 487 |
489 double NotificationPromo::EndTime() const { | 488 double NotificationPromo::EndTime() const { |
490 return end_; | 489 return end_; |
491 } | 490 } |
OLD | NEW |