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 15 matching lines...) Expand all Loading... |
26 #include "base/strings/sys_string_conversions.h" | 26 #include "base/strings/sys_string_conversions.h" |
27 #include "base/strings/utf_string_conversions.h" | 27 #include "base/strings/utf_string_conversions.h" |
28 #include "base/version.h" | 28 #include "base/version.h" |
29 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
30 #import "chrome/browser/mac/dock.h" | 30 #import "chrome/browser/mac/dock.h" |
31 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
32 #include "chrome/browser/profiles/profile_manager.h" | 32 #include "chrome/browser/profiles/profile_manager.h" |
33 #include "chrome/browser/shell_integration.h" | 33 #include "chrome/browser/shell_integration.h" |
34 #include "chrome/browser/ui/app_list/app_list_service.h" | 34 #include "chrome/browser/ui/app_list/app_list_service.h" |
35 #include "chrome/browser/ui/cocoa/key_equivalent_constants.h" | 35 #include "chrome/browser/ui/cocoa/key_equivalent_constants.h" |
| 36 #include "chrome/common/channel_info.h" |
36 #include "chrome/common/chrome_constants.h" | 37 #include "chrome/common/chrome_constants.h" |
37 #include "chrome/common/chrome_paths.h" | 38 #include "chrome/common/chrome_paths.h" |
38 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
39 #include "chrome/common/chrome_version_info.h" | |
40 #import "chrome/common/mac/app_mode_common.h" | 40 #import "chrome/common/mac/app_mode_common.h" |
41 #include "chrome/grit/generated_resources.h" | 41 #include "chrome/grit/generated_resources.h" |
42 #include "components/crx_file/id_util.h" | 42 #include "components/crx_file/id_util.h" |
| 43 #include "components/version_info/version_info.h" |
43 #include "content/public/browser/browser_thread.h" | 44 #include "content/public/browser/browser_thread.h" |
44 #include "extensions/browser/extension_registry.h" | 45 #include "extensions/browser/extension_registry.h" |
45 #include "extensions/common/extension.h" | 46 #include "extensions/common/extension.h" |
46 #include "grit/chrome_unscaled_resources.h" | 47 #include "grit/chrome_unscaled_resources.h" |
47 #import "skia/ext/skia_utils_mac.h" | 48 #import "skia/ext/skia_utils_mac.h" |
48 #include "third_party/skia/include/core/SkBitmap.h" | 49 #include "third_party/skia/include/core/SkBitmap.h" |
49 #include "third_party/skia/include/core/SkColor.h" | 50 #include "third_party/skia/include/core/SkColor.h" |
50 #include "ui/base/l10n/l10n_util.h" | 51 #include "ui/base/l10n/l10n_util.h" |
51 #import "ui/base/l10n/l10n_util_mac.h" | 52 #import "ui/base/l10n/l10n_util_mac.h" |
52 #include "ui/base/resource/resource_bundle.h" | 53 #include "ui/base/resource/resource_bundle.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 return; | 312 return; |
312 | 313 |
313 web_app::GetInfoForApp(extension, profile, base::Bind(&UpdateAndLaunchShim)); | 314 web_app::GetInfoForApp(extension, profile, base::Bind(&UpdateAndLaunchShim)); |
314 } | 315 } |
315 | 316 |
316 base::FilePath GetLocalizableAppShortcutsSubdirName() { | 317 base::FilePath GetLocalizableAppShortcutsSubdirName() { |
317 static const char kChromiumAppDirName[] = "Chromium Apps.localized"; | 318 static const char kChromiumAppDirName[] = "Chromium Apps.localized"; |
318 static const char kChromeAppDirName[] = "Chrome Apps.localized"; | 319 static const char kChromeAppDirName[] = "Chrome Apps.localized"; |
319 static const char kChromeCanaryAppDirName[] = "Chrome Canary Apps.localized"; | 320 static const char kChromeCanaryAppDirName[] = "Chrome Canary Apps.localized"; |
320 | 321 |
321 switch (chrome::VersionInfo::GetChannel()) { | 322 switch (chrome::GetChannel()) { |
322 case version_info::Channel::UNKNOWN: | 323 case version_info::Channel::UNKNOWN: |
323 return base::FilePath(kChromiumAppDirName); | 324 return base::FilePath(kChromiumAppDirName); |
324 | 325 |
325 case version_info::Channel::CANARY: | 326 case version_info::Channel::CANARY: |
326 return base::FilePath(kChromeCanaryAppDirName); | 327 return base::FilePath(kChromeCanaryAppDirName); |
327 | 328 |
328 default: | 329 default: |
329 return base::FilePath(kChromeAppDirName); | 330 return base::FilePath(kChromeAppDirName); |
330 } | 331 } |
331 } | 332 } |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 // Remove leading and trailing '@'s. | 865 // Remove leading and trailing '@'s. |
865 NSString* variable = | 866 NSString* variable = |
866 [value substringWithRange:NSMakeRange(1, [value length] - 2)]; | 867 [value substringWithRange:NSMakeRange(1, [value length] - 2)]; |
867 | 868 |
868 NSString* substitution = [replacement_dict valueForKey:variable]; | 869 NSString* substitution = [replacement_dict valueForKey:variable]; |
869 if (substitution) | 870 if (substitution) |
870 [plist setObject:substitution forKey:key]; | 871 [plist setObject:substitution forKey:key]; |
871 } | 872 } |
872 | 873 |
873 // 2. Fill in other values. | 874 // 2. Fill in other values. |
874 [plist setObject:base::SysUTF8ToNSString(chrome::VersionInfo().Version()) | 875 [plist setObject:base::SysUTF8ToNSString(version_info::GetVersionNumber()) |
875 forKey:app_mode::kCrBundleVersionKey]; | 876 forKey:app_mode::kCrBundleVersionKey]; |
876 [plist setObject:base::SysUTF8ToNSString(info_->version_for_display) | 877 [plist setObject:base::SysUTF8ToNSString(info_->version_for_display) |
877 forKey:app_mode::kCFBundleShortVersionStringKey]; | 878 forKey:app_mode::kCFBundleShortVersionStringKey]; |
878 [plist setObject:base::SysUTF8ToNSString(GetBundleIdentifier()) | 879 [plist setObject:base::SysUTF8ToNSString(GetBundleIdentifier()) |
879 forKey:base::mac::CFToNSCast(kCFBundleIdentifierKey)]; | 880 forKey:base::mac::CFToNSCast(kCFBundleIdentifierKey)]; |
880 [plist setObject:base::mac::FilePathToNSString(app_data_dir_) | 881 [plist setObject:base::mac::FilePathToNSString(app_data_dir_) |
881 forKey:app_mode::kCrAppModeUserDataDirKey]; | 882 forKey:app_mode::kCrAppModeUserDataDirKey]; |
882 [plist setObject:base::mac::FilePathToNSString(info_->profile_path.BaseName()) | 883 [plist setObject:base::mac::FilePathToNSString(info_->profile_path.BaseName()) |
883 forKey:app_mode::kCrAppModeProfileDirKey]; | 884 forKey:app_mode::kCrAppModeProfileDirKey]; |
884 [plist setObject:base::SysUTF8ToNSString(info_->profile_name) | 885 [plist setObject:base::SysUTF8ToNSString(info_->profile_name) |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 web_app::GetShortcutInfoForApp( | 1222 web_app::GetShortcutInfoForApp( |
1222 app, | 1223 app, |
1223 profile, | 1224 profile, |
1224 base::Bind(&web_app::CreateAppShortcutInfoLoaded, | 1225 base::Bind(&web_app::CreateAppShortcutInfoLoaded, |
1225 profile, | 1226 profile, |
1226 app, | 1227 app, |
1227 close_callback)); | 1228 close_callback)); |
1228 } | 1229 } |
1229 | 1230 |
1230 } // namespace chrome | 1231 } // namespace chrome |
OLD | NEW |