Skip to content

Commit

Permalink
Added flag --enable-hosted-app-shim-creation.
Browse files Browse the repository at this point in the history
When turned on, will create app shims for hosted apps on Mac.

BUG=442171

Review URL: https://codereview.chromium.org/799273002

Cr-Commit-Position: refs/heads/master@{#309123}
  • Loading branch information
mitchelljones authored and Commit bot committed Dec 19, 2014
1 parent af9a729 commit 58e3591
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 8 deletions.
6 changes: 6 additions & 0 deletions chrome/app/generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -6590,6 +6590,12 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_FLAGS_DISABLE_NEW_BOOKMARK_APPS_DESCRIPTION" desc="Description for the flag to disable the new bookmark app system.">
Disables the new system for creating bookmark apps.
</message>
<message name="IDS_FLAGS_ENABLE_HOSTED_APP_SHIM_CREATION_NAME" desc="Name of the flag to enable creation of app shims for hosted apps on Mac.">
Enable creation of app shims for hosted apps on Mac.
</message>
<message name="IDS_FLAGS_ENABLE_HOSTED_APP_SHIM_CREATION_DESCRIPTION" desc="Description for the flag to enable creation of app shims for hosted apps on Mac.">
Enables the creation of app shims on Mac when creating a hosted app.
</message>
<message name="IDS_FLAGS_ENABLE_EPHEMERAL_APPS_IN_WEBSTORE_NAME" desc="Name of the flag to enable ephemeral apps in the webstore.">
Enable experimental ephemeral apps from the webstore.
</message>
Expand Down
9 changes: 9 additions & 0 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,15 @@ const Experiment kExperiments[] = {
kOsWin | kOsCrOS | kOsLinux | kOsMac,
SINGLE_VALUE_TYPE(switches::kDisableNewBookmarkApps)
},
#if defined(OS_MACOSX)
{
"enable-hosted-app-shim-creation",
IDS_FLAGS_ENABLE_HOSTED_APP_SHIM_CREATION_NAME,
IDS_FLAGS_ENABLE_HOSTED_APP_SHIM_CREATION_DESCRIPTION,
kOsMac,
SINGLE_VALUE_TYPE(switches::kEnableHostedAppShimCreation)
},
#endif
{
"enable-ephemeral-apps-in-webstore",
IDS_FLAGS_ENABLE_EPHEMERAL_APPS_IN_WEBSTORE_NAME,
Expand Down
16 changes: 10 additions & 6 deletions chrome/browser/ui/cocoa/browser_window_cocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -574,12 +574,16 @@
extensions::CreateOrUpdateBookmarkApp(service, &new_web_app_info);
}

extensions::ExtensionRegistry* registry =
extensions::ExtensionRegistry::Get(profile);
const extensions::Extension* app = registry->GetExtensionById(
extension_id, extensions::ExtensionRegistry::ENABLED);

web_app::RevealAppShimInFinderForApp(profile, app);
// If we're not creating app shims, no need to reveal it in Finder.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableHostedAppShimCreation)) {
extensions::ExtensionRegistry* registry =
extensions::ExtensionRegistry::Get(profile);
const extensions::Extension* app = registry->GetExtensionById(
extension_id, extensions::ExtensionRegistry::ENABLED);

web_app::RevealAppShimInFinderForApp(profile, app);
}
} else {
service->UninstallExtension(extension_id,
extensions::UNINSTALL_REASON_INSTALL_CANCELED,
Expand Down
9 changes: 7 additions & 2 deletions chrome/browser/web_applications/web_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/i18n/file_util_icu.h"
#include "base/prefs/pref_service.h"
Expand All @@ -17,6 +18,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
#include "chrome/common/pref_names.h"
Expand Down Expand Up @@ -288,8 +290,11 @@ bool ShouldCreateShortcutFor(Profile* profile,
// An additional check here for OS X. We need app shims to be
// able to show them in the dock.
#if defined(OS_MACOSX)
app_type_requires_shortcut =
app_type_requires_shortcut || extension->is_hosted_app();
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableHostedAppShimCreation)) {
app_type_requires_shortcut =
app_type_requires_shortcut || extension->is_hosted_app();
}
#endif

return (app_type_requires_shortcut &&
Expand Down
3 changes: 3 additions & 0 deletions chrome/common/chrome_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,9 @@ const char kAppsKeepChromeAliveInTests[] = "apps-keep-chrome-alive-in-tests";
const char kDisableSystemFullscreenForTesting[] =
"disable-system-fullscreen-for-testing";

// Enables app shim creation for hosted apps on Mac.
const char kEnableHostedAppShimCreation[] = "enable-hosted-app-shim-creation";

// A process type (switches::kProcessType) that relaunches the browser. See
// chrome/browser/mac/relauncher.h.
const char kRelauncherProcess[] = "relauncher";
Expand Down
1 change: 1 addition & 0 deletions chrome/common/chrome_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ extern const char kMigrateDataDirForSxS[];
#if defined(OS_MACOSX)
extern const char kAppsKeepChromeAliveInTests[];
extern const char kDisableSystemFullscreenForTesting[];
extern const char kEnableHostedAppShimCreation[];
extern const char kRelauncherProcess[];
#endif

Expand Down
1 change: 1 addition & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49654,6 +49654,7 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="-2047822258" label="enable-avfoundation"/>
<int value="-2025367104" label="enable-material-design-ntp"/>
<int value="-2020024440" label="scroll-end-effect"/>
<int value="-2017953534" label="enable-hosted-app-shim-creation"/>
<int value="-2008272679" label="disable-webrtc-hw-encoding"/>
<int value="-2003354337"
label="enable-search-button-in-omnibox-for-str-or-iip"/>
Expand Down

0 comments on commit 58e3591

Please sign in to comment.