OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #import "ios/chrome/app/application_delegate/metrics_mediator.h" | 5 #import "ios/chrome/app/application_delegate/metrics_mediator.h" |
6 | 6 |
7 #include "base/mac/bind_objc_block.h" | 7 #include "base/mac/bind_objc_block.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/metrics/user_metrics_action.h" | 9 #include "base/metrics/user_metrics_action.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 // recording the first user action since fresh start wouldn't be triggered. | 137 // recording the first user action since fresh start wouldn't be triggered. |
138 NSDate* lastAppClose = [[NSUserDefaults standardUserDefaults] | 138 NSDate* lastAppClose = [[NSUserDefaults standardUserDefaults] |
139 objectForKey:kAppEnteredBackgroundDateKey]; | 139 objectForKey:kAppEnteredBackgroundDateKey]; |
140 if (lastAppClose) { | 140 if (lastAppClose) { |
141 NSTimeInterval interval = -[lastAppClose timeIntervalSinceNow]; | 141 NSTimeInterval interval = -[lastAppClose timeIntervalSinceNow]; |
142 [startupInformation | 142 [startupInformation |
143 activateFirstUserActionRecorderWithBackgroundTime:interval]; | 143 activateFirstUserActionRecorderWithBackgroundTime:interval]; |
144 GURL ntpUrl = GURL(kChromeUINewTabURL); | 144 GURL ntpUrl = GURL(kChromeUINewTabURL); |
145 | 145 |
146 Tab* currentTab = [[browserViewInformation currentTabModel] currentTab]; | 146 Tab* currentTab = [[browserViewInformation currentTabModel] currentTab]; |
147 if (currentTab && [currentTab url] == ntpUrl) { | 147 if (currentTab.lastCommittedURL == ntpUrl) { |
kkhorimoto
2017/04/14 20:28:51
These metrics are gathered at startup, so I think
| |
148 startupInformation.firstUserActionRecorder->RecordStartOnNTP(); | 148 startupInformation.firstUserActionRecorder->RecordStartOnNTP(); |
149 [startupInformation resetFirstUserActionRecorder]; | 149 [startupInformation resetFirstUserActionRecorder]; |
150 } else { | 150 } else { |
151 [startupInformation | 151 [startupInformation |
152 expireFirstUserActionRecorderAfterDelay:kFirstUserActionTimeout]; | 152 expireFirstUserActionRecorderAfterDelay:kFirstUserActionTimeout]; |
153 } | 153 } |
154 // Remove the value so it's not reused if the app crashes. | 154 // Remove the value so it's not reused if the app crashes. |
155 [[NSUserDefaults standardUserDefaults] | 155 [[NSUserDefaults standardUserDefaults] |
156 removeObjectForKey:kAppEnteredBackgroundDateKey]; | 156 removeObjectForKey:kAppEnteredBackgroundDateKey]; |
157 } | 157 } |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
387 } | 387 } |
388 | 388 |
389 - (BOOL)isMetricsReportingEnabledWifiOnly { | 389 - (BOOL)isMetricsReportingEnabledWifiOnly { |
390 return GetApplicationContext()->GetLocalState()->GetBoolean( | 390 return GetApplicationContext()->GetLocalState()->GetBoolean( |
391 metrics::prefs::kMetricsReportingEnabled) && | 391 metrics::prefs::kMetricsReportingEnabled) && |
392 GetApplicationContext()->GetLocalState()->GetBoolean( | 392 GetApplicationContext()->GetLocalState()->GetBoolean( |
393 prefs::kMetricsReportingWifiOnly); | 393 prefs::kMetricsReportingWifiOnly); |
394 } | 394 } |
395 | 395 |
396 @end | 396 @end |
OLD | NEW |