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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/files/file_enumerator.h" | 13 #include "base/files/file_enumerator.h" |
14 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
15 #include "base/mac/foundation_util.h" | 15 #include "base/mac/foundation_util.h" |
16 #include "base/mac/launch_services_util.h" | 16 #include "base/mac/launch_services_util.h" |
17 #include "base/mac/mac_util.h" | 17 #include "base/mac/mac_util.h" |
18 #include "base/mac/scoped_cftyperef.h" | 18 #include "base/mac/scoped_cftyperef.h" |
19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
20 #include "base/process/process.h" | |
20 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
21 #include "base/strings/string16.h" | 22 #include "base/strings/string16.h" |
23 #include "base/strings/string_number_conversions.h" | |
benwells
2013/08/23 13:04:52
Nit: move above string_util
jackhou1
2013/08/26 04:29:45
Done.
| |
22 #include "base/strings/sys_string_conversions.h" | 24 #include "base/strings/sys_string_conversions.h" |
23 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
24 #import "chrome/browser/mac/dock.h" | 26 #import "chrome/browser/mac/dock.h" |
25 #include "chrome/common/chrome_constants.h" | 27 #include "chrome/common/chrome_constants.h" |
26 #include "chrome/common/chrome_paths.h" | 28 #include "chrome/common/chrome_paths.h" |
27 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/common/chrome_version_info.h" | 30 #include "chrome/common/chrome_version_info.h" |
29 #include "chrome/common/extensions/extension.h" | 31 #include "chrome/common/extensions/extension.h" |
30 #import "chrome/common/mac/app_mode_common.h" | 32 #import "chrome/common/mac/app_mode_common.h" |
31 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 // one in the web app's |app_data_dir_|. | 205 // one in the web app's |app_data_dir_|. |
204 base::FilePath app_data_dir = web_app::GetWebAppDataDirectory( | 206 base::FilePath app_data_dir = web_app::GetWebAppDataDirectory( |
205 shortcut_info.profile_path, shortcut_info.extension_id, GURL()); | 207 shortcut_info.profile_path, shortcut_info.extension_id, GURL()); |
206 shim_path = app_data_dir.Append(shim_path.BaseName()); | 208 shim_path = app_data_dir.Append(shim_path.BaseName()); |
207 } | 209 } |
208 | 210 |
209 if (!base::PathExists(shim_path)) | 211 if (!base::PathExists(shim_path)) |
210 return; | 212 return; |
211 | 213 |
212 CommandLine command_line(CommandLine::NO_PROGRAM); | 214 CommandLine command_line(CommandLine::NO_PROGRAM); |
213 command_line.AppendSwitch(app_mode::kNoLaunchApp); | 215 command_line.AppendSwitchASCII( |
216 app_mode::kLaunchedByChromeProcessId, | |
217 base::IntToString(base::Process::Current().pid())); | |
Robert Sesek
2013/08/23 18:47:32
Use base::GetCurrentProcessId() in base/process/pr
jackhou1
2013/08/26 04:29:45
Done.
| |
214 // Launch without activating (kLSLaunchDontSwitch). | 218 // Launch without activating (kLSLaunchDontSwitch). |
215 base::mac::OpenApplicationWithPath( | 219 base::mac::OpenApplicationWithPath( |
216 shim_path, command_line, kLSLaunchDefaults | kLSLaunchDontSwitch, NULL); | 220 shim_path, command_line, kLSLaunchDefaults | kLSLaunchDontSwitch, NULL); |
217 } | 221 } |
218 | 222 |
219 base::FilePath GetAppLoaderPath() { | 223 base::FilePath GetAppLoaderPath() { |
220 return base::mac::PathForFrameworkBundleResource( | 224 return base::mac::PathForFrameworkBundleResource( |
221 base::mac::NSToCFCast(@"app_mode_loader.app")); | 225 base::mac::NSToCFCast(@"app_mode_loader.app")); |
222 } | 226 } |
223 | 227 |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
739 ShellIntegration::ShortcutInfo shortcut_info = | 743 ShellIntegration::ShortcutInfo shortcut_info = |
740 BuildShortcutInfoFromBundle(*it); | 744 BuildShortcutInfoFromBundle(*it); |
741 WebAppShortcutCreator shortcut_creator(it->DirName(), shortcut_info); | 745 WebAppShortcutCreator shortcut_creator(it->DirName(), shortcut_info); |
742 shortcut_creator.DeleteShortcuts(); | 746 shortcut_creator.DeleteShortcuts(); |
743 } | 747 } |
744 } | 748 } |
745 | 749 |
746 } // namespace internals | 750 } // namespace internals |
747 | 751 |
748 } // namespace web_app | 752 } // namespace web_app |
OLD | NEW |