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

Side by Side Diff: chrome/browser/mac/keystone_glue.mm

Issue 7249003: Move GetVersionStringModifier() and GetChannel() from platform_util_* to chrome_version_info_* (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: correct nits Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/diagnostics/recon_diagnostics.cc ('k') | chrome/browser/platform_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/param.h> 7 #include <sys/param.h>
8 #include <sys/mount.h> 8 #include <sys/mount.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/mac/mac_util.h" 13 #include "base/mac/mac_util.h"
14 #include "base/mac/scoped_nsautorelease_pool.h" 14 #include "base/mac/scoped_nsautorelease_pool.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/sys_string_conversions.h" 16 #include "base/sys_string_conversions.h"
17 #include "base/task.h" 17 #include "base/task.h"
18 #include "base/threading/worker_pool.h" 18 #include "base/threading/worker_pool.h"
19 #include "chrome/browser/mac/authorization_util.h" 19 #include "chrome/browser/mac/authorization_util.h"
20 #import "chrome/browser/mac/keystone_registration.h" 20 #import "chrome/browser/mac/keystone_registration.h"
21 #include "chrome/browser/platform_util.h"
22 #include "chrome/common/chrome_constants.h" 21 #include "chrome/common/chrome_constants.h"
22 #include "chrome/common/chrome_version_info.h"
23 #include "grit/chromium_strings.h" 23 #include "grit/chromium_strings.h"
24 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
25 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
26 #include "ui/base/l10n/l10n_util_mac.h" 26 #include "ui/base/l10n/l10n_util_mac.h"
27 27
28 namespace { 28 namespace {
29 29
30 namespace ksr = keystone_registration; 30 namespace ksr = keystone_registration;
31 31
32 // Constants for the brand file (uses an external file so it can survive 32 // Constants for the brand file (uses an external file so it can survive
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 if (brandFileType_ == kBrandFileTypeNotDetermined) { 291 if (brandFileType_ == kBrandFileTypeNotDetermined) {
292 292
293 NSFileManager* fm = [NSFileManager defaultManager]; 293 NSFileManager* fm = [NSFileManager defaultManager];
294 NSString* userBrandFile = UserBrandFilePath(); 294 NSString* userBrandFile = UserBrandFilePath();
295 NSString* systemBrandFile = SystemBrandFilePath(); 295 NSString* systemBrandFile = SystemBrandFilePath();
296 296
297 // Default to none. 297 // Default to none.
298 brandFileType_ = kBrandFileTypeNone; 298 brandFileType_ = kBrandFileTypeNone;
299 299
300 // Only the stable channel has a brand code. 300 // Only the stable channel has a brand code.
301 platform_util::Channel channel = platform_util::GetChannel(); 301 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
302 302
303 if (channel == platform_util::CHANNEL_DEV || 303 if (channel == chrome::VersionInfo::CHANNEL_DEV ||
304 channel == platform_util::CHANNEL_BETA) { 304 channel == chrome::VersionInfo::CHANNEL_BETA) {
305 305
306 // If on the dev or beta channel, this installation may have replaced 306 // If on the dev or beta channel, this installation may have replaced
307 // an older system-level installation. Check for a user brand file and 307 // an older system-level installation. Check for a user brand file and
308 // nuke it if present. Don't try to remove the system brand file, there 308 // nuke it if present. Don't try to remove the system brand file, there
309 // wouldn't be any permission to do so. 309 // wouldn't be any permission to do so.
310 // 310 //
311 // Don't do this on the canary channel. The canary can run side-by-side 311 // Don't do this on the canary channel. The canary can run side-by-side
312 // with another Google Chrome installation whose brand code, if any, 312 // with another Google Chrome installation whose brand code, if any,
313 // should remain intact. 313 // should remain intact.
314 314
315 if ([fm fileExistsAtPath:userBrandFile]) { 315 if ([fm fileExistsAtPath:userBrandFile]) {
316 [fm removeItemAtPath:userBrandFile error:NULL]; 316 [fm removeItemAtPath:userBrandFile error:NULL];
317 } 317 }
318 318
319 } else if (channel == platform_util::CHANNEL_STABLE) { 319 } else if (channel == chrome::VersionInfo::CHANNEL_STABLE) {
320 320
321 // If there is a system brand file, use it. 321 // If there is a system brand file, use it.
322 if ([fm fileExistsAtPath:systemBrandFile]) { 322 if ([fm fileExistsAtPath:systemBrandFile]) {
323 // System 323 // System
324 324
325 // Use the system file that is there. 325 // Use the system file that is there.
326 brandFileType_ = kBrandFileTypeSystem; 326 brandFileType_ = kBrandFileTypeSystem;
327 327
328 // Clean up any old user level file. 328 // Clean up any old user level file.
329 if ([fm fileExistsAtPath:userBrandFile]) { 329 if ([fm fileExistsAtPath:userBrandFile]) {
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 return [KeystoneGlue defaultKeystoneGlue] != nil; 912 return [KeystoneGlue defaultKeystoneGlue] != nil;
913 } 913 }
914 914
915 string16 CurrentlyInstalledVersion() { 915 string16 CurrentlyInstalledVersion() {
916 KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue]; 916 KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue];
917 NSString* version = [keystoneGlue currentlyInstalledVersion]; 917 NSString* version = [keystoneGlue currentlyInstalledVersion];
918 return base::SysNSStringToUTF16(version); 918 return base::SysNSStringToUTF16(version);
919 } 919 }
920 920
921 } // namespace keystone_glue 921 } // namespace keystone_glue
OLDNEW
« no previous file with comments | « chrome/browser/diagnostics/recon_diagnostics.cc ('k') | chrome/browser/platform_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698