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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 default: | 178 default: |
179 // For everything else, just make a copy. | 179 // For everything else, just make a copy. |
180 return node->DeepCopy(); | 180 return node->DeepCopy(); |
181 } | 181 } |
182 } | 182 } |
183 | 183 |
184 void AppendQueryParameter(GURL* url, | 184 void AppendQueryParameter(GURL* url, |
185 const std::string& param, | 185 const std::string& param, |
186 const std::string& value) { | 186 const std::string& value) { |
187 *url = chrome_common_net::AppendQueryParameter(*url, param, value); | 187 *url = net::AppendQueryParameter(*url, param, value); |
188 } | 188 } |
189 | 189 |
190 } // namespace | 190 } // namespace |
191 | 191 |
192 NotificationPromo::NotificationPromo() | 192 NotificationPromo::NotificationPromo() |
193 : prefs_(g_browser_process->local_state()), | 193 : prefs_(g_browser_process->local_state()), |
194 promo_type_(NO_PROMO), | 194 promo_type_(NO_PROMO), |
195 promo_payload_(new base::DictionaryValue()), | 195 promo_payload_(new base::DictionaryValue()), |
196 start_(0.0), | 196 start_(0.0), |
197 end_(0.0), | 197 end_(0.0), |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 if (group_ < initial_segment_) | 444 if (group_ < initial_segment_) |
445 return start_; | 445 return start_; |
446 return start_ + | 446 return start_ + |
447 std::ceil(static_cast<float>(group_ - initial_segment_ + 1) / increment_) | 447 std::ceil(static_cast<float>(group_ - initial_segment_ + 1) / increment_) |
448 * time_slice_; | 448 * time_slice_; |
449 } | 449 } |
450 | 450 |
451 double NotificationPromo::EndTime() const { | 451 double NotificationPromo::EndTime() const { |
452 return end_; | 452 return end_; |
453 } | 453 } |
OLD | NEW |