| 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 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 if (brandFileType_ == kBrandFileTypeNotDetermined) { | 324 if (brandFileType_ == kBrandFileTypeNotDetermined) { |
| 325 | 325 |
| 326 NSFileManager* fm = [NSFileManager defaultManager]; | 326 NSFileManager* fm = [NSFileManager defaultManager]; |
| 327 NSString* userBrandFile = UserBrandFilePath(); | 327 NSString* userBrandFile = UserBrandFilePath(); |
| 328 NSString* systemBrandFile = SystemBrandFilePath(); | 328 NSString* systemBrandFile = SystemBrandFilePath(); |
| 329 | 329 |
| 330 // Default to none. | 330 // Default to none. |
| 331 brandFileType_ = kBrandFileTypeNone; | 331 brandFileType_ = kBrandFileTypeNone; |
| 332 | 332 |
| 333 // Only the stable channel has a brand code. | 333 // Only the stable channel has a brand code. |
| 334 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 334 version_info::Channel channel = chrome::VersionInfo::GetChannel(); |
| 335 | 335 |
| 336 if (channel == chrome::VersionInfo::CHANNEL_DEV || | 336 if (channel == version_info::Channel::DEV || |
| 337 channel == chrome::VersionInfo::CHANNEL_BETA) { | 337 channel == version_info::Channel::BETA) { |
| 338 | 338 |
| 339 // If on the dev or beta channel, this installation may have replaced | 339 // 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 | 340 // 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 | 341 // nuke it if present. Don't try to remove the system brand file, there |
| 342 // wouldn't be any permission to do so. | 342 // wouldn't be any permission to do so. |
| 343 // | 343 // |
| 344 // Don't do this on the canary channel. The canary can run side-by-side | 344 // Don't do this on the canary channel. The canary can run side-by-side |
| 345 // with another Google Chrome installation whose brand code, if any, | 345 // with another Google Chrome installation whose brand code, if any, |
| 346 // should remain intact. | 346 // should remain intact. |
| 347 | 347 |
| 348 if ([fm fileExistsAtPath:userBrandFile]) { | 348 if ([fm fileExistsAtPath:userBrandFile]) { |
| 349 [fm removeItemAtPath:userBrandFile error:NULL]; | 349 [fm removeItemAtPath:userBrandFile error:NULL]; |
| 350 } | 350 } |
| 351 | 351 |
| 352 } else if (channel == chrome::VersionInfo::CHANNEL_STABLE) { | 352 } else if (channel == version_info::Channel::STABLE) { |
| 353 | 353 |
| 354 // If there is a system brand file, use it. | 354 // If there is a system brand file, use it. |
| 355 if ([fm fileExistsAtPath:systemBrandFile]) { | 355 if ([fm fileExistsAtPath:systemBrandFile]) { |
| 356 // System | 356 // System |
| 357 | 357 |
| 358 // Use the system file that is there. | 358 // Use the system file that is there. |
| 359 brandFileType_ = kBrandFileTypeSystem; | 359 brandFileType_ = kBrandFileTypeSystem; |
| 360 | 360 |
| 361 // Clean up any old user level file. | 361 // Clean up any old user level file. |
| 362 if ([fm fileExistsAtPath:userBrandFile]) { | 362 if ([fm fileExistsAtPath:userBrandFile]) { |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 return [KeystoneGlue defaultKeystoneGlue] != nil; | 1136 return [KeystoneGlue defaultKeystoneGlue] != nil; |
| 1137 } | 1137 } |
| 1138 | 1138 |
| 1139 base::string16 CurrentlyInstalledVersion() { | 1139 base::string16 CurrentlyInstalledVersion() { |
| 1140 KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue]; | 1140 KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue]; |
| 1141 NSString* version = [keystoneGlue currentlyInstalledVersion]; | 1141 NSString* version = [keystoneGlue currentlyInstalledVersion]; |
| 1142 return base::SysNSStringToUTF16(version); | 1142 return base::SysNSStringToUTF16(version); |
| 1143 } | 1143 } |
| 1144 | 1144 |
| 1145 } // namespace keystone_glue | 1145 } // namespace keystone_glue |
| OLD | NEW |