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/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 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
890 switches::kEnableAppsFileAssociations)) { | 890 switches::kEnableAppsFileAssociations)) { |
891 UpdateFileTypes(plist, file_handlers_info_); | 891 UpdateFileTypes(plist, file_handlers_info_); |
892 } | 892 } |
893 | 893 |
894 return [plist writeToFile:plist_path | 894 return [plist writeToFile:plist_path |
895 atomically:YES]; | 895 atomically:YES]; |
896 } | 896 } |
897 | 897 |
898 bool WebAppShortcutCreator::UpdateDisplayName( | 898 bool WebAppShortcutCreator::UpdateDisplayName( |
899 const base::FilePath& app_path) const { | 899 const base::FilePath& app_path) const { |
900 // OSX searches for the best language in the order of preferred languages. | 900 // Localization is used to display the app name (rather than the bundle |
901 // Since we only have one localization directory, it will choose this one. | 901 // filename). OSX searches for the best language in the order of preferred |
902 base::FilePath localized_dir = GetResourcesPath(app_path).Append("en.lproj"); | 902 // languages, but one of them must be found otherwise it will default to |
903 // the filename. | |
904 NSString* language = [[NSLocale preferredLanguages] objectAtIndex:0]; | |
tapted
2015/05/14 07:53:14
should it use l10n_util::NormalizeLocale(l10n_util
jackhou1
2015/05/15 00:41:08
With the app shim, we don't actually care what lan
| |
905 base::FilePath localized_dir = GetResourcesPath(app_path).Append( | |
906 base::SysNSStringToUTF8(language) + ".lproj"); | |
903 if (!base::CreateDirectory(localized_dir)) | 907 if (!base::CreateDirectory(localized_dir)) |
904 return false; | 908 return false; |
905 | 909 |
906 NSString* bundle_name = base::SysUTF16ToNSString(info_->title); | 910 NSString* bundle_name = base::SysUTF16ToNSString(info_->title); |
907 NSString* display_name = base::SysUTF16ToNSString(info_->title); | 911 NSString* display_name = base::SysUTF16ToNSString(info_->title); |
908 if (HasExistingExtensionShim(GetApplicationsDirname(), info_->extension_id, | 912 if (HasExistingExtensionShim(GetApplicationsDirname(), info_->extension_id, |
909 app_path.BaseName())) { | 913 app_path.BaseName())) { |
910 display_name = [bundle_name | 914 display_name = [bundle_name |
911 stringByAppendingString:base::SysUTF8ToNSString( | 915 stringByAppendingString:base::SysUTF8ToNSString( |
912 " (" + info_->profile_name + ")")]; | 916 " (" + info_->profile_name + ")")]; |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1208 web_app::GetShortcutInfoForApp( | 1212 web_app::GetShortcutInfoForApp( |
1209 app, | 1213 app, |
1210 profile, | 1214 profile, |
1211 base::Bind(&web_app::CreateAppShortcutInfoLoaded, | 1215 base::Bind(&web_app::CreateAppShortcutInfoLoaded, |
1212 profile, | 1216 profile, |
1213 app, | 1217 app, |
1214 close_callback)); | 1218 close_callback)); |
1215 } | 1219 } |
1216 | 1220 |
1217 } // namespace chrome | 1221 } // namespace chrome |
OLD | NEW |