OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/mac/keystone_glue.h" | 5 #import "chrome/browser/mac/keystone_glue.h" |
6 | 6 |
7 #include <sys/param.h> | 7 #include <sys/param.h> |
8 #include <sys/mount.h> | 8 #include <sys/mount.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
| 12 #include "base/file_util.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/mac/mac_util.h" | 14 #include "base/mac/mac_util.h" |
14 #include "base/mac/scoped_nsautorelease_pool.h" | 15 #include "base/mac/scoped_nsautorelease_pool.h" |
15 #include "base/mac/scoped_nsexception_enabler.h" | 16 #include "base/mac/scoped_nsexception_enabler.h" |
16 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
17 #include "base/sys_string_conversions.h" | 18 #include "base/sys_string_conversions.h" |
18 #include "base/task.h" | 19 #include "base/task.h" |
19 #include "base/threading/worker_pool.h" | 20 #include "base/threading/worker_pool.h" |
20 #include "chrome/browser/mac/authorization_util.h" | 21 #include "chrome/browser/mac/authorization_util.h" |
21 #import "chrome/browser/mac/keystone_registration.h" | 22 #import "chrome/browser/mac/keystone_registration.h" |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 if (appPath != appPath_) { | 911 if (appPath != appPath_) { |
911 [appPath_ release]; | 912 [appPath_ release]; |
912 appPath_ = [appPath copy]; | 913 appPath_ = [appPath copy]; |
913 } | 914 } |
914 } | 915 } |
915 | 916 |
916 @end // @implementation KeystoneGlue | 917 @end // @implementation KeystoneGlue |
917 | 918 |
918 namespace keystone_glue { | 919 namespace keystone_glue { |
919 | 920 |
| 921 std::string BrandCode() { |
| 922 KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue]; |
| 923 NSString* brand_path = [keystoneGlue brandFilePath]; |
| 924 |
| 925 if (![brand_path length]) |
| 926 return std::string(); |
| 927 |
| 928 std::string brand_code; |
| 929 file_util::ReadFileToString(FilePath([brand_path fileSystemRepresentation]), |
| 930 &brand_code); |
| 931 |
| 932 return brand_code; |
| 933 } |
| 934 |
920 bool KeystoneEnabled() { | 935 bool KeystoneEnabled() { |
921 return [KeystoneGlue defaultKeystoneGlue] != nil; | 936 return [KeystoneGlue defaultKeystoneGlue] != nil; |
922 } | 937 } |
923 | 938 |
924 string16 CurrentlyInstalledVersion() { | 939 string16 CurrentlyInstalledVersion() { |
925 KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue]; | 940 KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue]; |
926 NSString* version = [keystoneGlue currentlyInstalledVersion]; | 941 NSString* version = [keystoneGlue currentlyInstalledVersion]; |
927 return base::SysNSStringToUTF16(version); | 942 return base::SysNSStringToUTF16(version); |
928 } | 943 } |
929 | 944 |
930 } // namespace keystone_glue | 945 } // namespace keystone_glue |
OLD | NEW |