| Index: chrome/browser/apps/ephemeral_app_launcher.cc
|
| diff --git a/chrome/browser/apps/ephemeral_app_launcher.cc b/chrome/browser/apps/ephemeral_app_launcher.cc
|
| index 92f7bd81ae5f87b73c53a8d4a7a21b2850661a49..d05e54340280d5e6ec93755341d5ef23a4d5f3ff 100644
|
| --- a/chrome/browser/apps/ephemeral_app_launcher.cc
|
| +++ b/chrome/browser/apps/ephemeral_app_launcher.cc
|
| @@ -20,6 +20,7 @@
|
| #include "extensions/browser/extension_prefs.h"
|
| #include "extensions/browser/extension_registry.h"
|
| #include "extensions/browser/extension_system.h"
|
| +#include "extensions/browser/install_flag.h"
|
| #include "extensions/browser/management_policy.h"
|
| #include "extensions/common/permissions/permissions_data.h"
|
|
|
| @@ -45,6 +46,8 @@ const char kFeatureDisabledError[] = "Launching ephemeral apps is not enabled";
|
| const char kMissingAppError[] = "App is not installed";
|
| const char kAppDisabledError[] = "App is disabled";
|
|
|
| +const int kInstallFlags = extensions::kInstallFlagIsEphemeral;
|
| +
|
| Profile* ProfileForWebContents(content::WebContents* contents) {
|
| if (!contents)
|
| return NULL;
|
| @@ -63,6 +66,7 @@ gfx::NativeWindow NativeWindowForWebContents(content::WebContents* contents) {
|
| // be currently installed.
|
| bool CheckCommonLaunchCriteria(Profile* profile,
|
| const Extension* extension,
|
| + int install_flags,
|
| webstore_install::Result* reason,
|
| std::string* error) {
|
| // Only apps can be launched.
|
| @@ -76,7 +80,8 @@ bool CheckCommonLaunchCriteria(Profile* profile,
|
| ManagementPolicy* management_policy =
|
| ExtensionSystem::Get(profile)->management_policy();
|
| base::string16 policy_error;
|
| - if (!management_policy->UserMayLoad(extension, &policy_error)) {
|
| + if (!management_policy->UserMayLoad(
|
| + extension, install_flags, &policy_error)) {
|
| *reason = webstore_install::BLOCKED_BY_POLICY;
|
| *error = base::UTF16ToUTF8(policy_error);
|
| return false;
|
| @@ -203,11 +208,14 @@ bool EphemeralAppLauncher::CanLaunchInstalledApp(
|
| const extensions::Extension* extension,
|
| webstore_install::Result* reason,
|
| std::string* error) {
|
| - if (!CheckCommonLaunchCriteria(profile(), extension, reason, error))
|
| + ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(profile());
|
| + int install_flags = extension_prefs->GetInstallFlags(extension->id());
|
| + if (!CheckCommonLaunchCriteria(
|
| + profile(), extension, install_flags, reason, error))
|
| return false;
|
|
|
| // Do not launch blacklisted apps.
|
| - if (ExtensionPrefs::Get(profile())->IsExtensionBlacklisted(extension->id())) {
|
| + if (extension_prefs->IsExtensionBlacklisted(extension->id())) {
|
| *reason = webstore_install::BLACKLISTED;
|
| *error = kBlacklistedError;
|
| return false;
|
| @@ -310,7 +318,7 @@ void EphemeralAppLauncher::CheckEphemeralInstallPermitted() {
|
| install_checker_ = CreateInstallChecker();
|
| DCHECK(install_checker_.get());
|
|
|
| - install_checker_->set_extension(extension);
|
| + install_checker_->set_extension(extension, kInstallFlags);
|
| install_checker_->Start(ExtensionInstallChecker::CHECK_BLACKLIST |
|
| ExtensionInstallChecker::CHECK_REQUIREMENTS,
|
| true,
|
| @@ -398,7 +406,8 @@ void EphemeralAppLauncher::OnManifestParsed() {
|
|
|
| webstore_install::Result result = webstore_install::UNKNOWN_ERROR;
|
| std::string error;
|
| - if (!CheckCommonLaunchCriteria(profile(), extension, &result, &error)) {
|
| + if (!CheckCommonLaunchCriteria(
|
| + profile(), extension, kInstallFlags, &result, &error)) {
|
| AbortLaunch(result, error);
|
| return;
|
| }
|
|
|