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

Side by Side Diff: chrome/browser/web_applications/web_app_mac.mm

Issue 1016543004: [Mac] Use the app's version as the app shim bundle version. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use GetVersionForDisplay. Created 5 years, 9 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
OLDNEW
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/web_applications/web_app_mac.h" 5 #import "chrome/browser/web_applications/web_app_mac.h"
6 6
7 #import <Carbon/Carbon.h> 7 #import <Carbon/Carbon.h>
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 shortcut_info.profile_path = user_data_dir.DirName().DirName(); 493 shortcut_info.profile_path = user_data_dir.DirName().DirName();
494 else 494 else
495 shortcut_info.profile_path = user_data_dir.Append(profile_base_name); 495 shortcut_info.profile_path = user_data_dir.Append(profile_base_name);
496 496
497 return shortcut_info; 497 return shortcut_info;
498 } 498 }
499 499
500 web_app::ShortcutInfo RecordAppShimErrorAndBuildShortcutInfo( 500 web_app::ShortcutInfo RecordAppShimErrorAndBuildShortcutInfo(
501 const base::FilePath& bundle_path) { 501 const base::FilePath& bundle_path) {
502 NSDictionary* plist = ReadPlist(GetPlistPath(bundle_path)); 502 NSDictionary* plist = ReadPlist(GetPlistPath(bundle_path));
503 base::Version full_version(base::SysNSStringToUTF8( 503 NSString* version_string = [plist valueForKey:app_mode::kCrBundleVersionKey];
504 [plist valueForKey:app_mode::kCFBundleShortVersionStringKey])); 504 if (!version_string) {
505 // Older bundles have the Chrome version in the following key.
506 version_string =
507 [plist valueForKey:app_mode::kCFBundleShortVersionStringKey];
508 }
509 base::Version full_version(base::SysNSStringToUTF8(version_string));
505 uint32_t major_version = 0; 510 uint32_t major_version = 0;
506 if (full_version.IsValid()) 511 if (full_version.IsValid())
507 major_version = full_version.components()[0]; 512 major_version = full_version.components()[0];
508 UMA_HISTOGRAM_SPARSE_SLOWLY("Apps.AppShimErrorVersion", major_version); 513 UMA_HISTOGRAM_SPARSE_SLOWLY("Apps.AppShimErrorVersion", major_version);
509 514
510 return BuildShortcutInfoFromBundle(bundle_path); 515 return BuildShortcutInfoFromBundle(bundle_path);
511 } 516 }
512 517
513 void UpdateFileTypes(NSMutableDictionary* plist, 518 void UpdateFileTypes(NSMutableDictionary* plist,
514 const extensions::FileHandlersInfo& file_handlers_info) { 519 const extensions::FileHandlersInfo& file_handlers_info) {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 // Remove leading and trailing '@'s. 838 // Remove leading and trailing '@'s.
834 NSString* variable = 839 NSString* variable =
835 [value substringWithRange:NSMakeRange(1, [value length] - 2)]; 840 [value substringWithRange:NSMakeRange(1, [value length] - 2)];
836 841
837 NSString* substitution = [replacement_dict valueForKey:variable]; 842 NSString* substitution = [replacement_dict valueForKey:variable];
838 if (substitution) 843 if (substitution)
839 [plist setObject:substitution forKey:key]; 844 [plist setObject:substitution forKey:key];
840 } 845 }
841 846
842 // 2. Fill in other values. 847 // 2. Fill in other values.
848 [plist setObject:base::SysUTF8ToNSString(chrome::VersionInfo().Version())
849 forKey:app_mode::kCrBundleVersionKey];
850 [plist setObject:base::SysUTF8ToNSString(info_.version_for_display)
851 forKey:app_mode::kCFBundleShortVersionStringKey];
843 [plist setObject:base::SysUTF8ToNSString(GetBundleIdentifier()) 852 [plist setObject:base::SysUTF8ToNSString(GetBundleIdentifier())
844 forKey:base::mac::CFToNSCast(kCFBundleIdentifierKey)]; 853 forKey:base::mac::CFToNSCast(kCFBundleIdentifierKey)];
845 [plist setObject:base::mac::FilePathToNSString(app_data_dir_) 854 [plist setObject:base::mac::FilePathToNSString(app_data_dir_)
846 forKey:app_mode::kCrAppModeUserDataDirKey]; 855 forKey:app_mode::kCrAppModeUserDataDirKey];
847 [plist setObject:base::mac::FilePathToNSString(info_.profile_path.BaseName()) 856 [plist setObject:base::mac::FilePathToNSString(info_.profile_path.BaseName())
848 forKey:app_mode::kCrAppModeProfileDirKey]; 857 forKey:app_mode::kCrAppModeProfileDirKey];
849 [plist setObject:base::SysUTF8ToNSString(info_.profile_name) 858 [plist setObject:base::SysUTF8ToNSString(info_.profile_name)
850 forKey:app_mode::kCrAppModeProfileNameKey]; 859 forKey:app_mode::kCrAppModeProfileNameKey];
851 [plist setObject:[NSNumber numberWithBool:YES] 860 [plist setObject:[NSNumber numberWithBool:YES]
852 forKey:app_mode::kLSHasLocalizedDisplayNameKey]; 861 forKey:app_mode::kLSHasLocalizedDisplayNameKey];
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 web_app::GetShortcutInfoForApp( 1201 web_app::GetShortcutInfoForApp(
1193 app, 1202 app,
1194 profile, 1203 profile,
1195 base::Bind(&web_app::CreateAppShortcutInfoLoaded, 1204 base::Bind(&web_app::CreateAppShortcutInfoLoaded,
1196 profile, 1205 profile,
1197 app, 1206 app,
1198 close_callback)); 1207 close_callback));
1199 } 1208 }
1200 1209
1201 } // namespace chrome 1210 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/web_applications/web_app.cc ('k') | chrome/browser/web_applications/web_app_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698