diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-17 19:45:06 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-17 19:45:06 +0000 |
commit | cbf88887820316b01f48d5321f45267d48076f13 (patch) | |
tree | 9d79c7c5e5c80ccac2020a32eddb9f164bba3d0a /chrome | |
parent | 8724e921c34ebed8e5d637e83ab6fcf290409b9e (diff) | |
download | chromium_src-cbf88887820316b01f48d5321f45267d48076f13.zip chromium_src-cbf88887820316b01f48d5321f45267d48076f13.tar.gz chromium_src-cbf88887820316b01f48d5321f45267d48076f13.tar.bz2 |
Only the stable channel should have a brand code.
BUG=82922
TEST=none
Review URL: http://codereview.chromium.org/7017019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85659 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/cocoa/keystone_glue.mm | 29 | ||||
-rwxr-xr-x | chrome/installer/mac/keystone_install.sh | 75 |
2 files changed, 71 insertions, 33 deletions
diff --git a/chrome/browser/cocoa/keystone_glue.mm b/chrome/browser/cocoa/keystone_glue.mm index 181bc98..4c7ca50 100644 --- a/chrome/browser/cocoa/keystone_glue.mm +++ b/chrome/browser/cocoa/keystone_glue.mm @@ -17,6 +17,7 @@ #include "base/task.h" #include "base/threading/worker_pool.h" #include "chrome/browser/cocoa/authorization_util.h" +#include "chrome/browser/platform_util.h" #include "chrome/common/chrome_constants.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -344,17 +345,33 @@ NSString* const kBrandKey = @"KSBrandID"; if (brandFileType_ == kBrandFileTypeNotDetermined) { + NSFileManager* fm = [NSFileManager defaultManager]; + NSString* userBrandFile = UserBrandFilePath(); + NSString* systemBrandFile = SystemBrandFilePath(); + // Default to none. brandFileType_ = kBrandFileTypeNone; - // Having a channel means Dev/Beta, so there is no brand code to go with - // those. - if ([channel_ length] == 0) { + // Only the stable channel has a brand code. + platform_util::Channel channel = platform_util::GetChannel(); + + if (channel == platform_util::CHANNEL_DEV || + channel == platform_util::CHANNEL_BETA) { - NSString* userBrandFile = UserBrandFilePath(); - NSString* systemBrandFile = SystemBrandFilePath(); + // If on the dev or beta channel, this installation may have replaced + // an older system-level installation. Check for a user brand file and + // nuke it if present. Don't try to remove the system brand file, there + // wouldn't be any permission to do so. + // + // Don't do this on the canary channel. The canary can run side-by-side + // with another Google Chrome installation whose brand code, if any, + // should remain intact. + + if ([fm fileExistsAtPath:userBrandFile]) { + [fm removeItemAtPath:userBrandFile error:NULL]; + } - NSFileManager* fm = [NSFileManager defaultManager]; + } else if (channel == platform_util::CHANNEL_STABLE) { // If there is a system brand file, use it. if ([fm fileExistsAtPath:systemBrandFile]) { diff --git a/chrome/installer/mac/keystone_install.sh b/chrome/installer/mac/keystone_install.sh index 61b3cf2..d8ce6c1 100755 --- a/chrome/installer/mac/keystone_install.sh +++ b/chrome/installer/mac/keystone_install.sh @@ -987,39 +987,60 @@ main() { note "brand_plist = ${brand_plist}" note "brand_plist_path = ${brand_plist_path}" - # If the user manually updated their copy of Chrome, there might be new - # brand information in the app bundle, and that needs to be copied out into - # the file Keystone looks at. - if [[ -n "${old_brand}" ]]; then - local brand_dir - brand_dir="$(dirname "${brand_plist_path}")" - note "brand_dir = ${brand_dir}" - if ! mkdir -p "${brand_dir}"; then - err "couldn't mkdir brand_dir, continuing" - else - if ! defaults write "${brand_plist}" "${KS_BRAND_KEY}" \ - -string "${old_brand}"; then - err "couldn't write brand_plist, continuing" - elif [[ -n "${set_brand_file_access}" ]]; then - if ! chown "root:wheel" "${brand_plist_path}"; then - err "couldn't chown brand_plist_path, continuing" - else - if ! chmod 644 "${brand_plist_path}"; then - err "couldn't chmod brand_plist_path, continuing" + local ksadmin_brand_plist_path + local ksadmin_brand_key + + # Only the stable channel, identified by an empty channel string, has a + # brand code. On the beta and dev channels, remove the brand plist if + # present. Its presence means that the ticket used to manage a + # stable-channel Chrome but the user has since replaced it with a beta or + # dev channel version. Since the canary channel can run side-by-side with + # another Chrome installation, don't remove the brand plist on that channel, + # but skip the rest of the brand logic. + if [[ "${channel}" = "beta" ]] || [[ "${channel}" = "dev" ]]; then + note "defeating brand code on channel ${channel}" + rm -f "${brand_plist_path}" 2>/dev/null || true + elif [[ -n "${channel}" ]]; then + # Canary channel. + note "skipping brand code on channel ${channel}" + else + # Stable channel. + # If the user manually updated their copy of Chrome, there might be new + # brand information in the app bundle, and that needs to be copied out + # into the file Keystone looks at. + if [[ -n "${old_brand}" ]]; then + local brand_dir + brand_dir="$(dirname "${brand_plist_path}")" + note "brand_dir = ${brand_dir}" + if ! mkdir -p "${brand_dir}"; then + err "couldn't mkdir brand_dir, continuing" + else + if ! defaults write "${brand_plist}" "${KS_BRAND_KEY}" \ + -string "${old_brand}"; then + err "couldn't write brand_plist, continuing" + elif [[ -n "${set_brand_file_access}" ]]; then + if ! chown "root:wheel" "${brand_plist_path}"; then + err "couldn't chown brand_plist_path, continuing" + else + if ! chmod 644 "${brand_plist_path}"; then + err "couldn't chmod brand_plist_path, continuing" + fi fi fi fi fi - fi - # Confirm that the brand file exists. It's optional. - local ksadmin_brand_plist_path="${brand_plist_path}" - local ksadmin_brand_key="${KS_BRAND_KEY}" - if [[ ! -f "${ksadmin_brand_plist_path}" ]]; then - # Clear any branding information. - ksadmin_brand_plist_path= - ksadmin_brand_key= + # Confirm that the brand file exists. It's optional. + ksadmin_brand_plist_path="${brand_plist_path}" + ksadmin_brand_key="${KS_BRAND_KEY}" + + if [[ ! -f "${ksadmin_brand_plist_path}" ]]; then + # Clear any branding information. + ksadmin_brand_plist_path= + ksadmin_brand_key= + fi fi + note "ksadmin_brand_plist_path = ${ksadmin_brand_plist_path}" note "ksadmin_brand_key = ${ksadmin_brand_key}" |