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

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

Issue 22903025: Send Chrome's process id to the app shim. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
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 "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"
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.AppendSwitch(app_mode::kNoLaunchApp);
216 command_line.AppendSwitchASCII(
217 app_mode::kChromeProcessId,
218 base::IntToString(base::Process::Current().pid()));
219 LOG(INFO) << "pid " << base::Process::Current().pid();
tapted 2013/08/22 05:21:49 ohno! It's a LOG
jackhou1 2013/08/22 05:33:32 Oops, removed.
214 // Launch without activating (kLSLaunchDontSwitch). 220 // Launch without activating (kLSLaunchDontSwitch).
215 base::mac::OpenApplicationWithPath( 221 base::mac::OpenApplicationWithPath(
216 shim_path, command_line, kLSLaunchDefaults | kLSLaunchDontSwitch, NULL); 222 shim_path, command_line, kLSLaunchDefaults | kLSLaunchDontSwitch, NULL);
217 } 223 }
218 224
219 base::FilePath GetAppLoaderPath() { 225 base::FilePath GetAppLoaderPath() {
220 return base::mac::PathForFrameworkBundleResource( 226 return base::mac::PathForFrameworkBundleResource(
221 base::mac::NSToCFCast(@"app_mode_loader.app")); 227 base::mac::NSToCFCast(@"app_mode_loader.app"));
222 } 228 }
223 229
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 ShellIntegration::ShortcutInfo shortcut_info = 745 ShellIntegration::ShortcutInfo shortcut_info =
740 BuildShortcutInfoFromBundle(*it); 746 BuildShortcutInfoFromBundle(*it);
741 WebAppShortcutCreator shortcut_creator(it->DirName(), shortcut_info); 747 WebAppShortcutCreator shortcut_creator(it->DirName(), shortcut_info);
742 shortcut_creator.DeleteShortcuts(); 748 shortcut_creator.DeleteShortcuts();
743 } 749 }
744 } 750 }
745 751
746 } // namespace internals 752 } // namespace internals
747 753
748 } // namespace web_app 754 } // namespace web_app
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698