OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/common/app_group/app_group_metrics_mainapp.h" | 5 #include "ios/chrome/common/app_group/app_group_metrics_mainapp.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
9 #include "ios/chrome/common/app_group/app_group_constants.h" | 11 #include "ios/chrome/common/app_group/app_group_constants.h" |
10 #include "ios/chrome/common/app_group/app_group_metrics.h" | 12 #include "ios/chrome/common/app_group/app_group_metrics.h" |
11 | 13 |
12 namespace app_group { | 14 namespace app_group { |
13 | 15 |
14 namespace main_app { | 16 namespace main_app { |
15 | 17 |
16 void ProcessPendingLogs( | 18 void ProcessPendingLogs( |
(...skipping 15 matching lines...) Expand all Loading... |
32 NSData* log_content = [file_manager contentsAtPath:[file_url path]]; | 34 NSData* log_content = [file_manager contentsAtPath:[file_url path]]; |
33 callback.get()(log_content); | 35 callback.get()(log_content); |
34 } | 36 } |
35 [file_manager removeItemAtURL:file_url error:nil]; | 37 [file_manager removeItemAtURL:file_url error:nil]; |
36 } | 38 } |
37 } | 39 } |
38 } | 40 } |
39 | 41 |
40 void EnableMetrics(NSString* client_id, | 42 void EnableMetrics(NSString* client_id, |
41 NSString* brand_code, | 43 NSString* brand_code, |
42 int64 install_date, | 44 int64_t install_date, |
43 int64 enable_metrics_date) { | 45 int64_t enable_metrics_date) { |
44 base::scoped_nsobject<NSUserDefaults> shared_defaults( | 46 base::scoped_nsobject<NSUserDefaults> shared_defaults( |
45 [[NSUserDefaults alloc] initWithSuiteName:ApplicationGroup()]); | 47 [[NSUserDefaults alloc] initWithSuiteName:ApplicationGroup()]); |
46 [shared_defaults setObject:client_id forKey:@(kChromeAppClientID)]; | 48 [shared_defaults setObject:client_id forKey:@(kChromeAppClientID)]; |
47 | 49 |
48 [shared_defaults | 50 [shared_defaults |
49 setObject:[NSString stringWithFormat:@"%lld", enable_metrics_date] | 51 setObject:[NSString stringWithFormat:@"%lld", enable_metrics_date] |
50 forKey:@(kUserMetricsEnabledDate)]; | 52 forKey:@(kUserMetricsEnabledDate)]; |
51 | 53 |
52 [shared_defaults setObject:[NSString stringWithFormat:@"%lld", install_date] | 54 [shared_defaults setObject:[NSString stringWithFormat:@"%lld", install_date] |
53 forKey:@(kInstallDate)]; | 55 forKey:@(kInstallDate)]; |
54 | 56 |
55 [shared_defaults setObject:brand_code forKey:@(kBrandCode)]; | 57 [shared_defaults setObject:brand_code forKey:@(kBrandCode)]; |
56 } | 58 } |
57 | 59 |
58 void DisableMetrics() { | 60 void DisableMetrics() { |
59 base::scoped_nsobject<NSUserDefaults> shared_defaults( | 61 base::scoped_nsobject<NSUserDefaults> shared_defaults( |
60 [[NSUserDefaults alloc] initWithSuiteName:ApplicationGroup()]); | 62 [[NSUserDefaults alloc] initWithSuiteName:ApplicationGroup()]); |
61 [shared_defaults removeObjectForKey:@(kChromeAppClientID)]; | 63 [shared_defaults removeObjectForKey:@(kChromeAppClientID)]; |
62 } | 64 } |
63 | 65 |
64 } // namespace main_app | 66 } // namespace main_app |
65 | 67 |
66 } // namespace app_group | 68 } // namespace app_group |
OLD | NEW |