Index: chrome/browser/web_applications/web_app_mac.mm |
diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm |
index 5c933cd5239e7f8d4d1ba6460265ca76067acf2a..6359f93651fb82e0b7057fc17a83678de1f18e78 100644 |
--- a/chrome/browser/web_applications/web_app_mac.mm |
+++ b/chrome/browser/web_applications/web_app_mac.mm |
@@ -6,16 +6,22 @@ |
#import <Cocoa/Cocoa.h> |
+#include "base/callback.h" |
+#include "base/command_line.h" |
#include "base/file_util.h" |
#include "base/files/scoped_temp_dir.h" |
#include "base/mac/bundle_locations.h" |
#include "base/mac/foundation_util.h" |
+#include "base/mac/launch_services_util.h" |
#include "base/mac/mac_logging.h" |
#include "base/mac/mac_util.h" |
#include "base/mac/scoped_cftyperef.h" |
#include "base/memory/scoped_nsobject.h" |
#include "base/strings/sys_string_conversions.h" |
#include "base/utf_string_conversions.h" |
+#include "chrome/common/chrome_switches.h" |
+#include "chrome/browser/profiles/profile.h" |
+#include "chrome/browser/ui/web_applications/web_app_ui.h" |
#include "chrome/browser/web_applications/web_app.h" |
#include "chrome/common/chrome_paths_internal.h" |
#include "chrome/common/mac/app_mode_common.h" |
@@ -300,6 +306,32 @@ base::FilePath GetAppInstallPath( |
return shortcut_creator.GetShortcutPath(); |
} |
+void LaunchShimOnFileThread(Profile* profile, |
+ const extensions::Extension* extension, |
+ base::Callback<void(bool)> completed) { |
tapted
2013/05/17 06:44:00
Is there only one entrypoint now? It looks like |c
jackhou1
2013/05/21 03:13:22
Done.
|
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
+ base::FilePath shim_path = GetAppInstallPath( |
+ web_app::ShortcutInfoForExtensionAndProfile(extension, profile)); |
+ if (shim_path.empty()) { |
+ content::BrowserThread::PostTask( |
+ content::BrowserThread::UI, FROM_HERE, base::Bind(completed, false)); |
+ return; |
+ } |
+ CommandLine command_line(CommandLine::NO_PROGRAM); |
+ command_line.AppendSwitch(app_mode::kNoLaunchApp); |
+ base::mac::OpenApplicationWithPath(shim_path, command_line, NULL); |
+ content::BrowserThread::PostTask( |
+ content::BrowserThread::UI, FROM_HERE, base::Bind(completed, true)); |
+} |
+ |
+void LaunchShim(Profile* profile, |
tapted
2013/05/17 06:44:00
I think this should first check with the shim mana
jackhou1
2013/05/21 03:13:22
ATM the shim manager doesn't keep track of shims a
|
+ const extensions::Extension* extension, |
+ base::Callback<void(bool)> completed) { |
+ content::BrowserThread::PostTask( |
+ content::BrowserThread::FILE, FROM_HERE, |
+ base::Bind(&LaunchShimOnFileThread, profile, extension, completed)); |
+} |
+ |
namespace internals { |
base::FilePath GetAppBundleByExtensionId(std::string extension_id) { |