Chromium Code Reviews| Index: chrome/browser/apps/app_shim/extension_app_shim_handler_mac.cc |
| diff --git a/chrome/browser/apps/app_shim/extension_app_shim_handler_mac.cc b/chrome/browser/apps/app_shim/extension_app_shim_handler_mac.cc |
| index f7e3c3c5329c3604811b246dec3af513a308c44b..f32ec468031d10bea96b2a5319bb4145f8c2458b 100644 |
| --- a/chrome/browser/apps/app_shim/extension_app_shim_handler_mac.cc |
| +++ b/chrome/browser/apps/app_shim/extension_app_shim_handler_mac.cc |
| @@ -13,11 +13,13 @@ |
| #include "chrome/browser/chrome_notification_types.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| +#include "chrome/browser/ui/extensions/application_launch.h" |
| #include "chrome/browser/ui/extensions/extension_enable_flow.h" |
| #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" |
| #include "chrome/browser/web_applications/web_app_mac.h" |
| #include "chrome/common/extensions/extension_constants.h" |
| #include "chrome/common/extensions/extension_metrics.h" |
| +#include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
| #include "chrome/common/mac/app_shim_messages.h" |
| #include "components/crx_file/id_util.h" |
| #include "content/public/browser/notification_details.h" |
| @@ -169,7 +171,9 @@ ExtensionAppShimHandler::Delegate::GetAppExtension( |
| ExtensionRegistry* registry = ExtensionRegistry::Get(profile); |
| const extensions::Extension* extension = |
| registry->GetExtensionById(extension_id, ExtensionRegistry::ENABLED); |
| - return extension && extension->is_platform_app() ? extension : NULL; |
| + return extension && |
| + (extension->is_platform_app() || extension->is_hosted_app()) |
|
jackhou1
2014/12/03 05:12:05
The indentation here looks a bit awkward. Run "git
mitchellj
2014/12/04 04:53:52
Acknowledged.
|
| + ? extension : NULL; |
| } |
| void ExtensionAppShimHandler::Delegate::EnableExtension( |
| @@ -185,6 +189,14 @@ void ExtensionAppShimHandler::Delegate::LaunchApp( |
| const std::vector<base::FilePath>& files) { |
| extensions::RecordAppLaunchType( |
| extension_misc::APP_LAUNCH_CMD_LINE_APP, extension->GetType()); |
| + if (extension->is_hosted_app()) { |
| + AppLaunchParams launch_params( |
| + profile, |
| + extension, |
| + NEW_FOREGROUND_TAB, |
| + extensions::SOURCE_COMMAND_LINE); |
| + OpenApplication(launch_params); |
|
jackhou1
2014/12/03 05:12:05
Return here since the rest of this function is spe
mitchellj
2014/12/04 04:53:52
Done.
|
| + } |
| if (files.empty()) { |
| apps::LaunchPlatformApp( |
| profile, extension, extensions::SOURCE_COMMAND_LINE); |
| @@ -388,6 +400,10 @@ void ExtensionAppShimHandler::OnProfileLoaded( |
| delegate_->GetAppExtension(profile, app_id); |
| if (extension) { |
| delegate_->LaunchApp(profile, extension, files); |
| + // If it's a hosted app, just kill it immediately after opening for now. |
| + if (extension->is_hosted_app()) { |
|
jackhou1
2014/12/03 05:12:05
No braces on single line if block.
mitchellj
2014/12/04 04:53:52
Done.
|
| + host->OnAppLaunchComplete(APP_SHIM_LAUNCH_DUPLICATE_HOST); |
| + } |
| return; |
| } |