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

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

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again, previous had unrelated broken win_rel test. Created 7 years, 12 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
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/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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 } 309 }
310 310
311 void NotificationPromo::OnNewNotification() { 311 void NotificationPromo::OnNewNotification() {
312 DVLOG(1) << "OnNewNotification"; 312 DVLOG(1) << "OnNewNotification";
313 // Create a new promo group. 313 // Create a new promo group.
314 group_ = base::RandInt(0, num_groups_ - 1); 314 group_ = base::RandInt(0, num_groups_ - 1);
315 WritePrefs(); 315 WritePrefs();
316 } 316 }
317 317
318 // static 318 // static
319 void NotificationPromo::RegisterUserPrefs(PrefService* prefs) { 319 void NotificationPromo::RegisterUserPrefs(PrefServiceSyncable* prefs) {
320 prefs->RegisterDictionaryPref(kPrefPromoObject, 320 prefs->RegisterDictionaryPref(kPrefPromoObject,
321 new base::DictionaryValue, 321 new base::DictionaryValue,
322 PrefService::UNSYNCABLE_PREF); 322 PrefServiceSyncable::UNSYNCABLE_PREF);
323 } 323 }
324 324
325 void NotificationPromo::WritePrefs() { 325 void NotificationPromo::WritePrefs() {
326 base::DictionaryValue* ntp_promo = new base::DictionaryValue; 326 base::DictionaryValue* ntp_promo = new base::DictionaryValue;
327 ntp_promo->SetString(kPrefPromoText, promo_text_); 327 ntp_promo->SetString(kPrefPromoText, promo_text_);
328 ntp_promo->Set(kPrefPromoPayload, promo_payload_->DeepCopy()); 328 ntp_promo->Set(kPrefPromoPayload, promo_payload_->DeepCopy());
329 ntp_promo->SetDouble(kPrefPromoStart, start_); 329 ntp_promo->SetDouble(kPrefPromoStart, start_);
330 ntp_promo->SetDouble(kPrefPromoEnd, end_); 330 ntp_promo->SetDouble(kPrefPromoEnd, end_);
331 331
332 ntp_promo->SetInteger(kPrefPromoNumGroups, num_groups_); 332 ntp_promo->SetInteger(kPrefPromoNumGroups, num_groups_);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 if (group_ < initial_segment_) 452 if (group_ < initial_segment_)
453 return start_; 453 return start_;
454 return start_ + 454 return start_ +
455 std::ceil(static_cast<float>(group_ - initial_segment_ + 1) / increment_) 455 std::ceil(static_cast<float>(group_ - initial_segment_ + 1) / increment_)
456 * time_slice_; 456 * time_slice_;
457 } 457 }
458 458
459 double NotificationPromo::EndTime() const { 459 double NotificationPromo::EndTime() const {
460 return end_; 460 return end_;
461 } 461 }
OLDNEW
« no previous file with comments | « chrome/browser/web_resource/notification_promo.h ('k') | chrome/browser/web_resource/plugins_resource_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698