Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1034)

Unified Diff: chrome/browser/mac/keystone_glue.mm

Issue 7655056: Enable brand codes and master preferences on the Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copy/paste error Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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";
+#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]
+ fileSystemRepresentation]);
+}
+
+std::string BrandCode() {
+ KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue];
+ NSString* brand_path = [keystoneGlue brandFilePath];
+
+ if (![brand_path length])
+ return std::string();
+
+ NSString* brand_code =
+ [NSString stringWithContentsOfFile:brand_path
+ encoding:NSASCIIStringEncoding
+ error:nil];
+ if (!brand_code)
+ return std::string();
+
+ return base::SysNSStringToUTF8(brand_code);
+}
+
bool KeystoneEnabled() {
return [KeystoneGlue defaultKeystoneGlue] != nil;
}
« chrome/browser/first_run/first_run_mac.mm ('K') | « chrome/browser/mac/keystone_glue.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698