| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 #endif | 79 #endif |
| 80 } | 80 } |
| 81 | 81 |
| 82 // Returns a string suitable for the Promo Server URL 'dist' value. | 82 // Returns a string suitable for the Promo Server URL 'dist' value. |
| 83 const char* ChannelString() { | 83 const char* ChannelString() { |
| 84 #if defined (OS_WIN) | 84 #if defined (OS_WIN) |
| 85 // GetChannel hits the registry on Windows. See http://crbug.com/70898. | 85 // GetChannel hits the registry on Windows. See http://crbug.com/70898. |
| 86 // TODO(achuith): Move NotificationPromo::PromoServerURL to the blocking pool. | 86 // TODO(achuith): Move NotificationPromo::PromoServerURL to the blocking pool. |
| 87 base::ThreadRestrictions::ScopedAllowIO allow_io; | 87 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 88 #endif | 88 #endif |
| 89 const chrome::VersionInfo::Channel channel = | 89 const version_info::Channel channel = |
| 90 chrome::VersionInfo::GetChannel(); | 90 chrome::VersionInfo::GetChannel(); |
| 91 switch (channel) { | 91 switch (channel) { |
| 92 case chrome::VersionInfo::CHANNEL_CANARY: | 92 case version_info::Channel::CANARY: |
| 93 return "canary"; | 93 return "canary"; |
| 94 case chrome::VersionInfo::CHANNEL_DEV: | 94 case version_info::Channel::DEV: |
| 95 return "dev"; | 95 return "dev"; |
| 96 case chrome::VersionInfo::CHANNEL_BETA: | 96 case version_info::Channel::BETA: |
| 97 return "beta"; | 97 return "beta"; |
| 98 case chrome::VersionInfo::CHANNEL_STABLE: | 98 case version_info::Channel::STABLE: |
| 99 return "stable"; | 99 return "stable"; |
| 100 default: | 100 default: |
| 101 return "none"; | 101 return "none"; |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 struct PromoMapEntry { | 105 struct PromoMapEntry { |
| 106 NotificationPromo::PromoType promo_type; | 106 NotificationPromo::PromoType promo_type; |
| 107 const char* promo_type_str; | 107 const char* promo_type_str; |
| 108 }; | 108 }; |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 if (group_ < initial_segment_) | 481 if (group_ < initial_segment_) |
| 482 return start_; | 482 return start_; |
| 483 return start_ + | 483 return start_ + |
| 484 std::ceil(static_cast<float>(group_ - initial_segment_ + 1) / increment_) | 484 std::ceil(static_cast<float>(group_ - initial_segment_ + 1) / increment_) |
| 485 * time_slice_; | 485 * time_slice_; |
| 486 } | 486 } |
| 487 | 487 |
| 488 double NotificationPromo::EndTime() const { | 488 double NotificationPromo::EndTime() const { |
| 489 return end_; | 489 return end_; |
| 490 } | 490 } |
| OLD | NEW |