| 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" |
| 11 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
| 12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/sys_info.h" | 14 #include "base/sys_info.h" |
| 15 #include "base/threading/thread_restrictions.h" | 15 #include "base/threading/thread_restrictions.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/prefs/pref_service.h" | 19 #include "chrome/browser/prefs/pref_service.h" |
| 20 #include "chrome/browser/prefs/pref_service_simple.h" | 20 #include "chrome/browser/prefs/pref_service_simple.h" |
| 21 #include "chrome/browser/prefs/pref_service_syncable.h" | 21 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 22 #include "chrome/browser/web_resource/promo_resource_service.h" | 22 #include "chrome/browser/web_resource/promo_resource_service.h" |
| 23 #include "chrome/common/chrome_version_info.h" | 23 #include "chrome/common/chrome_version_info.h" |
| 24 #include "chrome/common/net/url_util.h" | |
| 25 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
| 26 #include "content/public/browser/user_metrics.h" | 25 #include "content/public/browser/user_metrics.h" |
| 27 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
| 27 #include "net/base/url_util.h" |
| 28 | 28 |
| 29 #if defined(OS_ANDROID) | 29 #if defined(OS_ANDROID) |
| 30 #include "base/command_line.h" | 30 #include "base/command_line.h" |
| 31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 32 #endif // defined(OS_ANDROID) | 32 #endif // defined(OS_ANDROID) |
| 33 | 33 |
| 34 using content::UserMetricsAction; | 34 using content::UserMetricsAction; |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 179 |
| 180 default: | 180 default: |
| 181 // For everything else, just make a copy. | 181 // For everything else, just make a copy. |
| 182 return node->DeepCopy(); | 182 return node->DeepCopy(); |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 | 185 |
| 186 void AppendQueryParameter(GURL* url, | 186 void AppendQueryParameter(GURL* url, |
| 187 const std::string& param, | 187 const std::string& param, |
| 188 const std::string& value) { | 188 const std::string& value) { |
| 189 *url = chrome_common_net::AppendQueryParameter(*url, param, value); | 189 *url = net::AppendQueryParameter(*url, param, value); |
| 190 } | 190 } |
| 191 | 191 |
| 192 } // namespace | 192 } // namespace |
| 193 | 193 |
| 194 NotificationPromo::NotificationPromo() | 194 NotificationPromo::NotificationPromo() |
| 195 : prefs_(g_browser_process->local_state()), | 195 : prefs_(g_browser_process->local_state()), |
| 196 promo_type_(NO_PROMO), | 196 promo_type_(NO_PROMO), |
| 197 promo_payload_(new base::DictionaryValue()), | 197 promo_payload_(new base::DictionaryValue()), |
| 198 start_(0.0), | 198 start_(0.0), |
| 199 end_(0.0), | 199 end_(0.0), |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 if (group_ < initial_segment_) | 446 if (group_ < initial_segment_) |
| 447 return start_; | 447 return start_; |
| 448 return start_ + | 448 return start_ + |
| 449 std::ceil(static_cast<float>(group_ - initial_segment_ + 1) / increment_) | 449 std::ceil(static_cast<float>(group_ - initial_segment_ + 1) / increment_) |
| 450 * time_slice_; | 450 * time_slice_; |
| 451 } | 451 } |
| 452 | 452 |
| 453 double NotificationPromo::EndTime() const { | 453 double NotificationPromo::EndTime() const { |
| 454 return end_; | 454 return end_; |
| 455 } | 455 } |
| OLD | NEW |