| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 101 } |
| 102 | 102 |
| 103 struct PromoMapEntry { | 103 struct PromoMapEntry { |
| 104 NotificationPromo::PromoType promo_type; | 104 NotificationPromo::PromoType promo_type; |
| 105 const char* promo_type_str; | 105 const char* promo_type_str; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 const PromoMapEntry kPromoMap[] = { | 108 const PromoMapEntry kPromoMap[] = { |
| 109 { NotificationPromo::NO_PROMO, "" }, | 109 { NotificationPromo::NO_PROMO, "" }, |
| 110 { NotificationPromo::NTP_NOTIFICATION_PROMO, "ntp_notification_promo" }, | 110 { NotificationPromo::NTP_NOTIFICATION_PROMO, "ntp_notification_promo" }, |
| 111 { NotificationPromo::BUBBLE_PROMO, "bubble_promo" }, | 111 { NotificationPromo::NTP_BUBBLE_PROMO, "bubble_promo" }, |
| 112 { NotificationPromo::MOBILE_NTP_SYNC_PROMO, "mobile_ntp_sync_promo" }, | 112 { NotificationPromo::MOBILE_NTP_SYNC_PROMO, "mobile_ntp_sync_promo" }, |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 // Convert PromoType to appropriate string. | 115 // Convert PromoType to appropriate string. |
| 116 const char* PromoTypeToString(NotificationPromo::PromoType promo_type) { | 116 const char* PromoTypeToString(NotificationPromo::PromoType promo_type) { |
| 117 for (size_t i = 0; i < arraysize(kPromoMap); ++i) { | 117 for (size_t i = 0; i < arraysize(kPromoMap); ++i) { |
| 118 if (kPromoMap[i].promo_type == promo_type) | 118 if (kPromoMap[i].promo_type == promo_type) |
| 119 return kPromoMap[i].promo_type_str; | 119 return kPromoMap[i].promo_type_str; |
| 120 } | 120 } |
| 121 NOTREACHED(); | 121 NOTREACHED(); |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 if (group_ < initial_segment_) | 537 if (group_ < initial_segment_) |
| 538 return start_; | 538 return start_; |
| 539 return start_ + | 539 return start_ + |
| 540 std::ceil(static_cast<float>(group_ - initial_segment_ + 1) / increment_) | 540 std::ceil(static_cast<float>(group_ - initial_segment_ + 1) / increment_) |
| 541 * time_slice_; | 541 * time_slice_; |
| 542 } | 542 } |
| 543 | 543 |
| 544 double NotificationPromo::EndTime() const { | 544 double NotificationPromo::EndTime() const { |
| 545 return end_; | 545 return end_; |
| 546 } | 546 } |
| OLD | NEW |