Commit 4510c9ab authored by tmdiep@chromium.org's avatar tmdiep@chromium.org

Always show prompt when installing ephemeral apps

Always show a prompt before an ephemeral app is about to be installed
and launched, whether it has permission warnings or not.

BUG=324817, 312460

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238361 0039d316-1c4b-4281-b951-d872f2087c98
parent 2e8c601f
...@@ -10,12 +10,10 @@ ...@@ -10,12 +10,10 @@
#include "chrome/browser/extensions/extension_system.h" #include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/extensions/application_launch.h" #include "chrome/browser/ui/extensions/application_launch.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_details.h" #include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h" #include "content/public/browser/notification_source.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h" #include "content/public/browser/web_contents_view.h"
#include "extensions/common/permissions/permissions_data.h"
using content::WebContents; using content::WebContents;
using extensions::Extension; using extensions::Extension;
...@@ -24,7 +22,6 @@ using extensions::WebstoreInstaller; ...@@ -24,7 +22,6 @@ using extensions::WebstoreInstaller;
namespace { namespace {
const char kInvalidManifestError[] = "Invalid manifest";
const char kExtensionTypeError[] = "Ephemeral extensions are not permitted"; const char kExtensionTypeError[] = "Ephemeral extensions are not permitted";
Profile* ProfileForWebContents(content::WebContents* contents) { Profile* ProfileForWebContents(content::WebContents* contents) {
...@@ -157,15 +154,6 @@ WebContents* EphemeralAppLauncher::GetWebContents() const { ...@@ -157,15 +154,6 @@ WebContents* EphemeralAppLauncher::GetWebContents() const {
scoped_ptr<ExtensionInstallPrompt::Prompt> scoped_ptr<ExtensionInstallPrompt::Prompt>
EphemeralAppLauncher::CreateInstallPrompt() const { EphemeralAppLauncher::CreateInstallPrompt() const {
DCHECK(extension_.get() != NULL);
// Skip the prompt by returning null if the app does not need to display
// permission warnings.
extensions::PermissionMessages permissions =
extensions::PermissionsData::GetPermissionMessages(extension_.get());
if (permissions.empty())
return scoped_ptr<ExtensionInstallPrompt::Prompt>();
return make_scoped_ptr(new ExtensionInstallPrompt::Prompt( return make_scoped_ptr(new ExtensionInstallPrompt::Prompt(
ExtensionInstallPrompt::LAUNCH_PROMPT)); ExtensionInstallPrompt::LAUNCH_PROMPT));
} }
...@@ -187,21 +175,10 @@ bool EphemeralAppLauncher::CheckRequestorPermitted( ...@@ -187,21 +175,10 @@ bool EphemeralAppLauncher::CheckRequestorPermitted(
bool EphemeralAppLauncher::CheckInstallValid( bool EphemeralAppLauncher::CheckInstallValid(
const base::DictionaryValue& manifest, const base::DictionaryValue& manifest,
std::string* error) { std::string* error) {
extension_ = Extension::Create( extensions::Manifest extension_manifest(
base::FilePath(),
extensions::Manifest::INTERNAL, extensions::Manifest::INTERNAL,
manifest, scoped_ptr<DictionaryValue>(manifest.DeepCopy()));
Extension::REQUIRE_KEY | if (!extension_manifest.is_app()) {
Extension::FROM_WEBSTORE |
Extension::IS_EPHEMERAL,
id(),
error);
if (!extension_.get()) {
*error = kInvalidManifestError;
return false;
}
if (!extension_->is_app()) {
*error = kExtensionTypeError; *error = kExtensionTypeError;
return false; return false;
} }
......
...@@ -99,9 +99,6 @@ class EphemeralAppLauncher ...@@ -99,9 +99,6 @@ class EphemeralAppLauncher
gfx::NativeWindow parent_window_; gfx::NativeWindow parent_window_;
scoped_ptr<content::WebContents> dummy_web_contents_; scoped_ptr<content::WebContents> dummy_web_contents_;
// Created in CheckInstallValid().
scoped_refptr<extensions::Extension> extension_;
DISALLOW_COPY_AND_ASSIGN(EphemeralAppLauncher); DISALLOW_COPY_AND_ASSIGN(EphemeralAppLauncher);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment