| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/mount.h> | 7 #include <sys/mount.h> |
| 8 #include <sys/param.h> | 8 #include <sys/param.h> |
| 9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
| 10 | 10 |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/mac/authorization_util.h" | 16 #include "base/mac/authorization_util.h" |
| 17 #include "base/mac/bundle_locations.h" | 17 #include "base/mac/bundle_locations.h" |
| 18 #include "base/mac/foundation_util.h" | 18 #include "base/mac/foundation_util.h" |
| 19 #include "base/mac/mac_logging.h" | 19 #include "base/mac/mac_logging.h" |
| 20 #include "base/mac/scoped_nsautorelease_pool.h" | 20 #include "base/mac/scoped_nsautorelease_pool.h" |
| 21 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
| 22 #include "base/strings/sys_string_conversions.h" | 22 #include "base/strings/sys_string_conversions.h" |
| 23 #include "base/threading/worker_pool.h" | 23 #include "base/threading/worker_pool.h" |
| 24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 25 #import "chrome/browser/mac/keystone_registration.h" | 25 #import "chrome/browser/mac/keystone_registration.h" |
| 26 #include "chrome/browser/mac/obsolete_system.h" | 26 #include "chrome/browser/mac/obsolete_system.h" |
| 27 #include "chrome/common/channel_info.h" |
| 27 #include "chrome/common/chrome_constants.h" | 28 #include "chrome/common/chrome_constants.h" |
| 28 #include "chrome/common/chrome_version_info.h" | |
| 29 #include "chrome/grit/chromium_strings.h" | 29 #include "chrome/grit/chromium_strings.h" |
| 30 #include "chrome/grit/generated_resources.h" | 30 #include "chrome/grit/generated_resources.h" |
| 31 #include "components/version_info/version_info.h" |
| 31 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
| 32 #include "ui/base/l10n/l10n_util_mac.h" | 33 #include "ui/base/l10n/l10n_util_mac.h" |
| 33 | 34 |
| 34 namespace { | 35 namespace { |
| 35 | 36 |
| 36 namespace ksr = keystone_registration; | 37 namespace ksr = keystone_registration; |
| 37 | 38 |
| 38 // Constants for the brand file (uses an external file so it can survive | 39 // Constants for the brand file (uses an external file so it can survive |
| 39 // updates to Chrome.) | 40 // updates to Chrome.) |
| 40 | 41 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 if (brandFileType_ == kBrandFileTypeNotDetermined) { | 325 if (brandFileType_ == kBrandFileTypeNotDetermined) { |
| 325 | 326 |
| 326 NSFileManager* fm = [NSFileManager defaultManager]; | 327 NSFileManager* fm = [NSFileManager defaultManager]; |
| 327 NSString* userBrandFile = UserBrandFilePath(); | 328 NSString* userBrandFile = UserBrandFilePath(); |
| 328 NSString* systemBrandFile = SystemBrandFilePath(); | 329 NSString* systemBrandFile = SystemBrandFilePath(); |
| 329 | 330 |
| 330 // Default to none. | 331 // Default to none. |
| 331 brandFileType_ = kBrandFileTypeNone; | 332 brandFileType_ = kBrandFileTypeNone; |
| 332 | 333 |
| 333 // Only the stable channel has a brand code. | 334 // Only the stable channel has a brand code. |
| 334 version_info::Channel channel = chrome::VersionInfo::GetChannel(); | 335 version_info::Channel channel = chrome::GetChannel(); |
| 335 | 336 |
| 336 if (channel == version_info::Channel::DEV || | 337 if (channel == version_info::Channel::DEV || |
| 337 channel == version_info::Channel::BETA) { | 338 channel == version_info::Channel::BETA) { |
| 338 | 339 |
| 339 // If on the dev or beta channel, this installation may have replaced | 340 // If on the dev or beta channel, this installation may have replaced |
| 340 // an older system-level installation. Check for a user brand file and | 341 // an older system-level installation. Check for a user brand file and |
| 341 // nuke it if present. Don't try to remove the system brand file, there | 342 // nuke it if present. Don't try to remove the system brand file, there |
| 342 // wouldn't be any permission to do so. | 343 // wouldn't be any permission to do so. |
| 343 // | 344 // |
| 344 // Don't do this on the canary channel. The canary can run side-by-side | 345 // Don't do this on the canary channel. The canary can run side-by-side |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 return [KeystoneGlue defaultKeystoneGlue] != nil; | 1137 return [KeystoneGlue defaultKeystoneGlue] != nil; |
| 1137 } | 1138 } |
| 1138 | 1139 |
| 1139 base::string16 CurrentlyInstalledVersion() { | 1140 base::string16 CurrentlyInstalledVersion() { |
| 1140 KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue]; | 1141 KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue]; |
| 1141 NSString* version = [keystoneGlue currentlyInstalledVersion]; | 1142 NSString* version = [keystoneGlue currentlyInstalledVersion]; |
| 1142 return base::SysNSStringToUTF16(version); | 1143 return base::SysNSStringToUTF16(version); |
| 1143 } | 1144 } |
| 1144 | 1145 |
| 1145 } // namespace keystone_glue | 1146 } // namespace keystone_glue |
| OLD | NEW |