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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 return "chromeos"; | 43 return "chromeos"; |
44 #elif defined(OS_LINUX) | 44 #elif defined(OS_LINUX) |
45 return "linux"; | 45 return "linux"; |
46 #else | 46 #else |
47 return "none"; | 47 return "none"; |
48 #endif | 48 #endif |
49 } | 49 } |
50 | 50 |
51 // Returns a string suitable for the Promo Server URL 'dist' value. | 51 // Returns a string suitable for the Promo Server URL 'dist' value. |
52 const char* ChannelString() { | 52 const char* ChannelString() { |
53 // GetChannel hits the registry on Windows. See http://crbug.com/70898. | |
54 base::ThreadRestrictions::ScopedAllowIO allow_io; | |
Dan Beam
2012/06/08 18:49:47
presubmit is angry at you for this ^, also
#if de
achuithb
2012/06/08 22:29:08
I'll add the OS_WIN #define. The ScopedAllowIO was
Dan Beam
2012/06/08 22:34:54
I still think you should move this #ifdef inside c
Robert Sesek
2012/06/08 22:35:53
I disagree with this. Clients of this function sho
| |
53 const chrome::VersionInfo::Channel channel = | 55 const chrome::VersionInfo::Channel channel = |
54 PromoResourceService::GetChannel(); | 56 chrome::VersionInfo::GetChannel(); |
55 switch (channel) { | 57 switch (channel) { |
56 case chrome::VersionInfo::CHANNEL_CANARY: | 58 case chrome::VersionInfo::CHANNEL_CANARY: |
57 return "canary"; | 59 return "canary"; |
58 case chrome::VersionInfo::CHANNEL_DEV: | 60 case chrome::VersionInfo::CHANNEL_DEV: |
59 return "dev"; | 61 return "dev"; |
60 case chrome::VersionInfo::CHANNEL_BETA: | 62 case chrome::VersionInfo::CHANNEL_BETA: |
61 return "beta"; | 63 return "beta"; |
62 case chrome::VersionInfo::CHANNEL_STABLE: | 64 case chrome::VersionInfo::CHANNEL_STABLE: |
63 return "stable"; | 65 return "stable"; |
64 default: | 66 default: |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
323 if (group_ < initial_segment_) | 325 if (group_ < initial_segment_) |
324 return start_; | 326 return start_; |
325 return start_ + | 327 return start_ + |
326 std::ceil(static_cast<float>(group_ - initial_segment_ + 1) / increment_) | 328 std::ceil(static_cast<float>(group_ - initial_segment_ + 1) / increment_) |
327 * time_slice_; | 329 * time_slice_; |
328 } | 330 } |
329 | 331 |
330 double NotificationPromo::EndTime() const { | 332 double NotificationPromo::EndTime() const { |
331 return end_; | 333 return end_; |
332 } | 334 } |
OLD | NEW |