| 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 19 matching lines...) Expand all Loading... |
| 30 const char promo_server_url[] = "https://clients3.google.com/crsignal/client"; | 30 const char promo_server_url[] = "https://clients3.google.com/crsignal/client"; |
| 31 | 31 |
| 32 double GetTimeFromPrefs(PrefService* prefs, const char* pref) { | 32 double GetTimeFromPrefs(PrefService* prefs, const char* pref) { |
| 33 return prefs->HasPrefPath(pref) ? prefs->GetDouble(pref) : 0.0; | 33 return prefs->HasPrefPath(pref) ? prefs->GetDouble(pref) : 0.0; |
| 34 } | 34 } |
| 35 | 35 |
| 36 // Returns a string suitable for the Promo Server URL 'osname' value. | 36 // Returns a string suitable for the Promo Server URL 'osname' value. |
| 37 const char* PlatformString() { | 37 const char* PlatformString() { |
| 38 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
| 39 return "win"; | 39 return "win"; |
| 40 #elif defined(OS_IOS) |
| 41 return "ios"; |
| 40 #elif defined(OS_MACOSX) | 42 #elif defined(OS_MACOSX) |
| 41 return "mac"; | 43 return "mac"; |
| 42 #elif defined(OS_CHROMEOS) | 44 #elif defined(OS_CHROMEOS) |
| 43 return "chromeos"; | 45 return "chromeos"; |
| 44 #elif defined(OS_LINUX) | 46 #elif defined(OS_LINUX) |
| 45 return "linux"; | 47 return "linux"; |
| 46 #else | 48 #else |
| 47 return "none"; | 49 return "none"; |
| 48 #endif | 50 #endif |
| 49 } | 51 } |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 if (group_ < initial_segment_) | 335 if (group_ < initial_segment_) |
| 334 return start_; | 336 return start_; |
| 335 return start_ + | 337 return start_ + |
| 336 std::ceil(static_cast<float>(group_ - initial_segment_ + 1) / increment_) | 338 std::ceil(static_cast<float>(group_ - initial_segment_ + 1) / increment_) |
| 337 * time_slice_; | 339 * time_slice_; |
| 338 } | 340 } |
| 339 | 341 |
| 340 double NotificationPromo::EndTime() const { | 342 double NotificationPromo::EndTime() const { |
| 341 return end_; | 343 return end_; |
| 342 } | 344 } |
| OLD | NEW |