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 "apps/app_shim/app_shim_mac.h" | 10 #include "apps/app_shim/app_shim_mac.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 return base::FilePath(kChromiumAppDirName); | 235 return base::FilePath(kChromiumAppDirName); |
236 | 236 |
237 case chrome::VersionInfo::CHANNEL_CANARY: | 237 case chrome::VersionInfo::CHANNEL_CANARY: |
238 return base::FilePath(kChromeCanaryAppDirName); | 238 return base::FilePath(kChromeCanaryAppDirName); |
239 | 239 |
240 default: | 240 default: |
241 return base::FilePath(kChromeAppDirName); | 241 return base::FilePath(kChromeAppDirName); |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
| 245 base::string16 GetAppShortcutsSubdirName() { |
| 246 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
| 247 if (channel == chrome::VersionInfo::CHANNEL_CANARY) |
| 248 return l10n_util::GetStringUTF16(IDS_APP_SHORTCUTS_SUBDIR_NAME_CANARY); |
| 249 return l10n_util::GetStringUTF16(IDS_APP_SHORTCUTS_SUBDIR_NAME); |
| 250 } |
| 251 |
245 // Adds a localized strings file for the Chrome Apps directory using the current | 252 // Adds a localized strings file for the Chrome Apps directory using the current |
246 // locale. OSX will use this for the display name. | 253 // locale. OSX will use this for the display name. |
247 // + Chrome Apps.localized (|apps_directory|) | 254 // + Chrome Apps.localized (|apps_directory|) |
248 // | + .localized | 255 // | + .localized |
249 // | | en.strings | 256 // | | en.strings |
250 // | | de.strings | 257 // | | de.strings |
251 void UpdateAppShortcutsSubdirLocalizedName( | 258 void UpdateAppShortcutsSubdirLocalizedName( |
252 const base::FilePath& apps_directory) { | 259 const base::FilePath& apps_directory) { |
253 base::FilePath localized = apps_directory.Append(".localized"); | 260 base::FilePath localized = apps_directory.Append(".localized"); |
254 if (!file_util::CreateDirectory(localized)) | 261 if (!file_util::CreateDirectory(localized)) |
255 return; | 262 return; |
256 | 263 |
257 base::FilePath directory_name = apps_directory.BaseName().RemoveExtension(); | 264 base::FilePath directory_name = apps_directory.BaseName().RemoveExtension(); |
258 string16 localized_name = web_app::GetAppShortcutsSubdirName(); | 265 base::string16 localized_name = GetAppShortcutsSubdirName(); |
259 NSDictionary* strings_dict = @{ | 266 NSDictionary* strings_dict = @{ |
260 base::mac::FilePathToNSString(directory_name) : | 267 base::mac::FilePathToNSString(directory_name) : |
261 base::SysUTF16ToNSString(localized_name) | 268 base::SysUTF16ToNSString(localized_name) |
262 }; | 269 }; |
263 | 270 |
264 std::string locale = l10n_util::NormalizeLocale( | 271 std::string locale = l10n_util::NormalizeLocale( |
265 l10n_util::GetApplicationLocale(std::string())); | 272 l10n_util::GetApplicationLocale(std::string())); |
266 | 273 |
267 NSString* strings_path = base::mac::FilePathToNSString( | 274 NSString* strings_path = base::mac::FilePathToNSString( |
268 localized.Append(locale + ".strings")); | 275 localized.Append(locale + ".strings")); |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 ShellIntegration::ShortcutInfo shortcut_info = | 747 ShellIntegration::ShortcutInfo shortcut_info = |
741 BuildShortcutInfoFromBundle(*it); | 748 BuildShortcutInfoFromBundle(*it); |
742 WebAppShortcutCreator shortcut_creator(it->DirName(), shortcut_info); | 749 WebAppShortcutCreator shortcut_creator(it->DirName(), shortcut_info); |
743 shortcut_creator.DeleteShortcuts(); | 750 shortcut_creator.DeleteShortcuts(); |
744 } | 751 } |
745 } | 752 } |
746 | 753 |
747 } // namespace internals | 754 } // namespace internals |
748 | 755 |
749 } // namespace web_app | 756 } // namespace web_app |
OLD | NEW |