OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/instant/promo_counter.h" | 5 #include "chrome/browser/instant/promo_counter.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 | 11 |
12 // Pref keys. These are relative to pref_key_. | 12 // Pref keys. These are relative to pref_key_. |
13 static const char* kShowKey = ".show"; | 13 static const char* kShowKey = ".show"; |
14 static const char* kNumSessionsKey = ".num_sessions"; | 14 static const char* kNumSessionsKey = ".num_sessions"; |
15 static const char* kInitialTimeKey = ".initial_time"; | 15 static const char* kInitialTimeKey = ".initial_time"; |
16 | 16 |
17 // Values used for histograms. These are relative to histogram_key_. | 17 // Values used for histograms. These are relative to histogram_key_. |
18 static const char* kHistogramHide = ".hide"; | 18 static const char* kHistogramHide = ".hide"; |
19 static const char* kHistogramMaxSessions = ".max_sessions"; | 19 static const char* kHistogramMaxSessions = ".max_sessions"; |
20 static const char* kHistogramMaxTime = ".max_time"; | 20 static const char* kHistogramMaxTime = ".max_time"; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 106 } |
107 | 107 |
108 void PromoCounter::MaxTimeLapsed(base::Time current_time) { | 108 void PromoCounter::MaxTimeLapsed(base::Time current_time) { |
109 show_ = false; | 109 show_ = false; |
110 UMA_HISTOGRAM_CUSTOM_COUNTS(histogram_key_ + kHistogramMaxTime, | 110 UMA_HISTOGRAM_CUSTOM_COUNTS(histogram_key_ + kHistogramMaxTime, |
111 (current_time - initial_show_).InHours(), | 111 (current_time - initial_show_).InHours(), |
112 1, max_days_ * 24, 24); | 112 1, max_days_ * 24, 24); |
113 if (profile_->GetPrefs()) | 113 if (profile_->GetPrefs()) |
114 profile_->GetPrefs()->SetBoolean((pref_key_ + kShowKey).c_str(), false); | 114 profile_->GetPrefs()->SetBoolean((pref_key_ + kShowKey).c_str(), false); |
115 } | 115 } |
OLD | NEW |