Skip to content

Commit

Permalink
Add switch enable-linkable-ephemeral-apps
Browse files Browse the repository at this point in the history
Added switch "enable-linkable-ephemeral-apps" for experimentation with launching
ephemeral apps from hyperlinks. This functionality was previously behind
the "enable-ephemeral-apps" switch, but the two features will now be
separated.

This patch also ensures that only links appearing on a Google search
result page will launch the app.

Ephemeral apps are now enabled for Windows, Linux and ChromeOS platforms.

BUG=312460

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237722 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
tmdiep@chromium.org committed Nov 28, 2013
1 parent e983751 commit b100499
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
6 changes: 6 additions & 0 deletions chrome/app/generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -6660,6 +6660,12 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_FLAGS_ENABLE_EPHEMERAL_APPS_DESCRIPTION" desc="Description for the flag to enable ephemeral apps.">
Enables experimentation with ephemeral apps, which are launched without installing in Chrome.
</message>
<message name="IDS_FLAGS_ENABLE_LINKABLE_EPHEMERAL_APPS_NAME" desc="Name of the flag to enable linkable ephemeral apps.">
Enable experimental linkable ephemeral apps.
</message>
<message name="IDS_FLAGS_ENABLE_LINKABLE_EPHEMERAL_APPS_DESCRIPTION" desc="Description for the flag to enable linkable ephemeral apps.">
Enables experimentation with launching ephemeral apps from hyperlinks. For example, links to Chrome Web Store app detail pages in Google search results will launch the app rather than navigate to the detail page.
</message>
<message name="IDS_FLAGS_ENABLE_SERVICE_WORKER_NAME" desc="Name of the flag to enable streamlined ServiceWorker.">
Enable support for ServiceWorker.
</message>
Expand Down
9 changes: 8 additions & 1 deletion chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1780,9 +1780,16 @@ const Experiment kExperiments[] = {
"enable-ephemeral-apps",
IDS_FLAGS_ENABLE_EPHEMERAL_APPS_NAME,
IDS_FLAGS_ENABLE_EPHEMERAL_APPS_DESCRIPTION,
kOsWin | kOsCrOS,
kOsWin | kOsLinux | kOsCrOS,
SINGLE_VALUE_TYPE(switches::kEnableEphemeralApps)
},
{
"enable-linkable-ephemeral-apps",
IDS_FLAGS_ENABLE_LINKABLE_EPHEMERAL_APPS_NAME,
IDS_FLAGS_ENABLE_LINKABLE_EPHEMERAL_APPS_DESCRIPTION,
kOsWin | kOsLinux | kOsCrOS,
SINGLE_VALUE_TYPE(switches::kEnableLinkableEphemeralApps)
},
{
"enable-service-worker",
IDS_FLAGS_ENABLE_SERVICE_WORKER_NAME,
Expand Down
7 changes: 6 additions & 1 deletion chrome/browser/apps/ephemeral_app_throttle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ EphemeralAppThrottle::MaybeCreateThrottleForLaunch(
net::URLRequest* request,
ProfileIOData* profile_io_data) {
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableEphemeralApps))
switches::kEnableLinkableEphemeralApps))
return NULL;

if (request->method() != "GET" || !request->url().SchemeIsHTTPOrHTTPS())
Expand All @@ -90,6 +90,11 @@ EphemeralAppThrottle::MaybeCreateThrottleForLaunch(
if (profile_io_data->is_incognito())
return NULL;

// Only watch for links in Google search results.
if (request->referrer().find("http://www.google.com") == std::string::npos &&
request->referrer().find("https://www.google.com") == std::string::npos)
return NULL;

// Crudely watch for links to Chrome Web Store detail pages and assume that
// the app ID will be after the last slash of the URL. We cannot even
// differentiate between apps and extensions, so attempt to launch both.
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 @@ -626,6 +626,9 @@ const char kEnableIPv6[] = "enable-ipv6";
// attempt to use the existing connection.
const char kEnableIPPooling[] = "enable-ip-pooling";

// Enables experimentation with launching ephemeral apps via hyperlinks.
const char kEnableLinkableEphemeralApps[] = "enable-linkable-ephemeral-apps";

// Enable always using the local NTP for the first NTP load of a new window.
const char kEnableLocalFirstLoadNTP[] = "enable-local-first-load-ntp";

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 @@ -180,6 +180,7 @@ extern const char kEnableHttp2Draft04[];
extern const char kEnableInlineSignin[];
extern const char kEnableIPPooling[];
extern const char kEnableIPv6[];
extern const char kEnableLinkableEphemeralApps[];
extern const char kEnableLocalFirstLoadNTP[];
extern const char kEnableManagedStorage[];
extern const char kEnableManagedUsers[];
Expand Down

0 comments on commit b100499

Please sign in to comment.