OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/install_time_util.h" | 5 #include "ios/chrome/browser/install_time_util.h" |
6 | 6 |
7 #include <Foundation/Foundation.h> | 7 #include <Foundation/Foundation.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
11 | 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." |
| 14 #endif |
| 15 |
12 namespace { | 16 namespace { |
13 | 17 |
14 NSString* const kInstallationTimeKey = @"omaha.InstallationTime"; | 18 NSString* const kInstallationTimeKey = @"omaha.InstallationTime"; |
15 | 19 |
16 // Returns the installation time of the application: this is the time the | 20 // Returns the installation time of the application: this is the time the |
17 // application was first installed, not the time the last version was installed. | 21 // application was first installed, not the time the last version was installed. |
18 // If the installation time is unknown, returns a base::Time corresponding to | 22 // If the installation time is unknown, returns a base::Time corresponding to |
19 // |kUnknownInstallDate|. | 23 // |kUnknownInstallDate|. |
20 // To be noted: this value is reset if the application is uninstalled. | 24 // To be noted: this value is reset if the application is uninstalled. |
21 base::Time GetNSUserDefaultsInstallationTime() { | 25 base::Time GetNSUserDefaultsInstallationTime() { |
(...skipping 23 matching lines...) Expand all Loading... |
45 if (is_first_run) | 49 if (is_first_run) |
46 return base::Time::Now(); | 50 return base::Time::Now(); |
47 | 51 |
48 if (ns_user_defaults_install_time.is_null()) | 52 if (ns_user_defaults_install_time.is_null()) |
49 return base::Time::FromTimeT(kUnknownInstallDate); | 53 return base::Time::FromTimeT(kUnknownInstallDate); |
50 | 54 |
51 return ns_user_defaults_install_time; | 55 return ns_user_defaults_install_time; |
52 } | 56 } |
53 | 57 |
54 } // namespace install_time_util | 58 } // namespace install_time_util |
OLD | NEW |