Chromium Code Reviews| Index: chrome/browser/mac/keystone_glue.mm |
| diff --git a/chrome/browser/mac/keystone_glue.mm b/chrome/browser/mac/keystone_glue.mm |
| index 247231207a856cf159b91a6c0d7480ded9ce7e92..42c123a1cedf8eae4fba7323f51b80a0cf68b0c8 100644 |
| --- a/chrome/browser/mac/keystone_glue.mm |
| +++ b/chrome/browser/mac/keystone_glue.mm |
| @@ -41,11 +41,22 @@ namespace ksr = keystone_registration; |
| #error Unknown branding |
| #endif |
| +#if defined(GOOGLE_CHROME_BUILD) |
| +#define kMasterPreferencesFileName @"Google Chrome Master Preferences"; |
|
Mark Mentovai
2011/08/24 21:37:31
You equipped this for a separate master preference
|
| +#elif defined(CHROMIUM_BUILD) |
| +#define kMasterPreferencesFileName @"Chromium Master Preferences"; |
| +#else |
| +#error Unknown branding |
| +#endif |
| + |
| // These directories are hardcoded in Keystone promotion preflight and the |
| // Keystone install script, so NSSearchPathForDirectoriesInDomains isn't used |
| // since the scripts couldn't use anything like that. |
| NSString* kBrandUserFile = @"~/Library/Google/" kBrandFileName; |
| NSString* kBrandSystemFile = @"/Library/Google/" kBrandFileName; |
| +// Only support a system-level master preferences file. |
| +NSString* kMasterPreferencesFile |
| + = @"/Library/Google/" kMasterPreferencesFileName; |
| NSString* UserBrandFilePath() { |
| return [kBrandUserFile stringByStandardizingPath]; |
| @@ -917,6 +928,28 @@ NSString* const kVersionKey = @"KSVersion"; |
| namespace keystone_glue { |
| +FilePath MasterPrefsPath() { |
| + return FilePath([[kMasterPreferencesFile stringByStandardizingPath] |
|
Mark Mentovai
2011/08/23 16:25:12
stringByStandardizingPath doesn’t gain anything he
|
| + fileSystemRepresentation]); |
| +} |
| + |
| +std::string BrandCode() { |
| + KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue]; |
|
Mark Mentovai
2011/08/23 16:25:12
Name things like keystone_glue. You‘re not in an @
|
| + NSString* brand_path = [keystoneGlue brandFilePath]; |
| + |
| + if (![brand_path length]) |
| + return std::string(); |
| + |
| + NSString* brand_code = |
|
Mark Mentovai
2011/08/23 16:25:12
On which thread will this be called? Remember, we
Avi (use Gerrit)
2011/08/24 20:38:36
This is called only on the first run, on the main
|
| + [NSString stringWithContentsOfFile:brand_path |
| + encoding:NSASCIIStringEncoding |
| + error:nil]; |
| + if (!brand_code) |
| + return std::string(); |
| + |
| + return base::SysNSStringToUTF8(brand_code); |
|
TVL
2011/08/23 16:51:31
We're also paying a lot in conversions ASC -> NSS
|
| +} |
| + |
| bool KeystoneEnabled() { |
| return [KeystoneGlue defaultKeystoneGlue] != nil; |
| } |