Chromium Code Reviews| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 346 if (prefs_->HasPrefPath(prefs::kNtpPromoViewsMax)) | 346 if (prefs_->HasPrefPath(prefs::kNtpPromoViewsMax)) |
| 347 max_views_ = prefs_->GetInteger(prefs::kNtpPromoViewsMax); | 347 max_views_ = prefs_->GetInteger(prefs::kNtpPromoViewsMax); |
| 348 | 348 |
| 349 if (prefs_->HasPrefPath(prefs::kNtpPromoViews)) | 349 if (prefs_->HasPrefPath(prefs::kNtpPromoViews)) |
| 350 views_ = prefs_->GetInteger(prefs::kNtpPromoViews); | 350 views_ = prefs_->GetInteger(prefs::kNtpPromoViews); |
| 351 | 351 |
| 352 prefs_->SetInteger(prefs::kNtpPromoViews, ++views_); | 352 prefs_->SetInteger(prefs::kNtpPromoViews, ++views_); |
| 353 return views_ >= max_views_; | 353 return views_ >= max_views_; |
| 354 } | 354 } |
| 355 | 355 |
| 356 bool NotificationPromo::IsBuildAllowed(int builds_allowed) const { | 356 bool NotificationPromo::IsBuildAllowed(int builds_allowed) const { |
|
Yaron
2012/04/09 17:12:55
Seems like we might want to remove the PromoResour
Dan Beam
2012/04/09 17:20:16
+1
Jerome
2012/04/09 18:24:06
Done.
| |
| 357 #if !defined(OS_ANDROID) | |
| 357 if (delegate_) // For testing. | 358 if (delegate_) // For testing. |
| 358 return delegate_->IsBuildAllowed(builds_allowed); | 359 return delegate_->IsBuildAllowed(builds_allowed); |
| 359 else | 360 else |
| 360 return PromoResourceService::IsBuildTargeted( | 361 return PromoResourceService::IsBuildTargeted( |
| 361 PromoResourceService::GetChannel(), builds_allowed); | 362 PromoResourceService::GetChannel(), builds_allowed); |
| 363 #else | |
| 364 return false; | |
| 365 #endif | |
| 362 } | 366 } |
| 363 | 367 |
| 364 bool NotificationPromo::IsPlatformAllowed(int target_platform) const { | 368 bool NotificationPromo::IsPlatformAllowed(int target_platform) const { |
| 365 const int current_platform = delegate_? delegate_->CurrentPlatform() | 369 const int current_platform = delegate_? delegate_->CurrentPlatform() |
| 366 : CurrentPlatform(); | 370 : CurrentPlatform(); |
| 367 return (target_platform & current_platform) != 0; | 371 return (target_platform & current_platform) != 0; |
| 368 } | 372 } |
| 369 | 373 |
| 370 // static | 374 // static |
| 371 int NotificationPromo::CurrentPlatform() { | 375 int NotificationPromo::CurrentPlatform() { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 417 max_group_ == other.max_group_ && | 421 max_group_ == other.max_group_ && |
| 418 max_views_ == other.max_views_ && | 422 max_views_ == other.max_views_ && |
| 419 platform_ == other.platform_ && | 423 platform_ == other.platform_ && |
| 420 group_ == other.group_ && | 424 group_ == other.group_ && |
| 421 views_ == other.views_ && | 425 views_ == other.views_ && |
| 422 text_ == other.text_ && | 426 text_ == other.text_ && |
| 423 closed_ == other.closed_ && | 427 closed_ == other.closed_ && |
| 424 gplus_ == other.gplus_ && | 428 gplus_ == other.gplus_ && |
| 425 feature_mask_ == other.feature_mask_; | 429 feature_mask_ == other.feature_mask_; |
| 426 } | 430 } |
| OLD | NEW |