diff options
author | benwells <benwells@chromium.org> | 2015-10-13 16:38:46 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-13 23:39:38 +0000 |
commit | cb4422c1ee7c1909afed5edbce2cbc3dcaaea80a (patch) | |
tree | 51d55586cef6cb5b71a86ac17f6b5cb7734d4a5a /chrome/browser/extensions | |
parent | 778ff470b7022b5e0244a471d5041586aaf2b5b6 (diff) | |
download | chromium_src-cb4422c1ee7c1909afed5edbce2cbc3dcaaea80a.zip chromium_src-cb4422c1ee7c1909afed5edbce2cbc3dcaaea80a.tar.gz chromium_src-cb4422c1ee7c1909afed5edbce2cbc3dcaaea80a.tar.bz2 |
Remove ability for users to launch ephemeral apps.
Test code can still do this.
BUG=517735
Review URL: https://codereview.chromium.org/1395043002
Cr-Commit-Position: refs/heads/master@{#353904}
Diffstat (limited to 'chrome/browser/extensions')
12 files changed, 12 insertions, 165 deletions
diff --git a/chrome/browser/extensions/active_install_data.cc b/chrome/browser/extensions/active_install_data.cc index f9c9a0c..ee6cdfe 100644 --- a/chrome/browser/extensions/active_install_data.cc +++ b/chrome/browser/extensions/active_install_data.cc @@ -11,11 +11,11 @@ namespace extensions { // ActiveInstallData: ActiveInstallData::ActiveInstallData() - : percent_downloaded(0), is_ephemeral(false) { + : percent_downloaded(0) { } ActiveInstallData::ActiveInstallData(const std::string& extension_id) - : extension_id(extension_id), percent_downloaded(0), is_ephemeral(false) { + : extension_id(extension_id), percent_downloaded(0) { } // ScopedActiveInstall: diff --git a/chrome/browser/extensions/active_install_data.h b/chrome/browser/extensions/active_install_data.h index 4aa5887..c7dd9ba 100644 --- a/chrome/browser/extensions/active_install_data.h +++ b/chrome/browser/extensions/active_install_data.h @@ -23,7 +23,6 @@ struct ActiveInstallData { std::string extension_id; int percent_downloaded; - bool is_ephemeral; }; // Registers and deregisters and an active extension install with the diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc index 11e64a9..f127643 100644 --- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc @@ -14,7 +14,6 @@ #include "base/thread_task_runner_handle.h" #include "base/values.h" #include "base/version.h" -#include "chrome/browser/apps/ephemeral_app_launcher.h" #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" #include "chrome/browser/extensions/crx_installer.h" #include "chrome/browser/extensions/extension_install_ui_util.h" @@ -100,46 +99,6 @@ chrome::HostDesktopType GetHostDesktopTypeForWebContents( contents->GetTopLevelNativeWindow()); } -api::webstore_private::Result WebstoreInstallResultToApiResult( - webstore_install::Result result) { - switch (result) { - case webstore_install::SUCCESS: - return api::webstore_private::RESULT_SUCCESS; - case webstore_install::OTHER_ERROR: - return api::webstore_private::RESULT_UNKNOWN_ERROR; - case webstore_install::INVALID_ID: - return api::webstore_private::RESULT_INVALID_ID; - case webstore_install::NOT_PERMITTED: - case webstore_install::WEBSTORE_REQUEST_ERROR: - case webstore_install::INVALID_WEBSTORE_RESPONSE: - return api::webstore_private::RESULT_INSTALL_ERROR; - case webstore_install::INVALID_MANIFEST: - return api::webstore_private::RESULT_MANIFEST_ERROR; - case webstore_install::ICON_ERROR: - return api::webstore_private::RESULT_ICON_ERROR; - case webstore_install::ABORTED: - case webstore_install::USER_CANCELLED: - return api::webstore_private::RESULT_USER_CANCELLED; - case webstore_install::BLACKLISTED: - return api::webstore_private::RESULT_BLACKLISTED; - case webstore_install::MISSING_DEPENDENCIES: - case webstore_install::REQUIREMENT_VIOLATIONS: - return api::webstore_private::RESULT_MISSING_DEPENDENCIES; - case webstore_install::BLOCKED_BY_POLICY: - return api::webstore_private::RESULT_BLOCKED_BY_POLICY; - case webstore_install::LAUNCH_FEATURE_DISABLED: - return api::webstore_private::RESULT_FEATURE_DISABLED; - case webstore_install::LAUNCH_UNSUPPORTED_EXTENSION_TYPE: - return api::webstore_private::RESULT_UNSUPPORTED_EXTENSION_TYPE; - case webstore_install::INSTALL_IN_PROGRESS: - return api::webstore_private::RESULT_INSTALL_IN_PROGRESS; - case webstore_install::LAUNCH_IN_PROGRESS: - return api::webstore_private::RESULT_LAUNCH_IN_PROGRESS; - } - NOTREACHED(); - return api::webstore_private::RESULT_NONE; -} - api::webstore_private::Result WebstoreInstallHelperResultToApiResult( WebstoreInstallHelper::Delegate::InstallHelperResultCode result) { switch (result) { @@ -174,6 +133,8 @@ const char kNoPreviousBeginInstallWithManifestError[] = const char kUserCancelledError[] = "User cancelled install"; const char kIncognitoError[] = "Apps cannot be installed in guest/incognito mode"; +const char kEphemeralAppLaunchingNotSupported[] = + "Ephemeral launching of apps is no longer supported."; WebstoreInstaller::Delegate* test_webstore_installer_delegate = nullptr; @@ -746,60 +707,8 @@ WebstorePrivateLaunchEphemeralAppFunction:: ExtensionFunction::ResponseAction WebstorePrivateLaunchEphemeralAppFunction::Run() { - // Check whether the browser window still exists. - content::WebContents* web_contents = - chrome_details_.GetAssociatedWebContents(); - if (!web_contents) - return RespondNow(Error("aborted")); - - if (!user_gesture()) { - return RespondNow(BuildResponse( - api::webstore_private::RESULT_USER_GESTURE_REQUIRED, - "User gesture is required")); - } - - scoped_ptr<LaunchEphemeralApp::Params> params( - LaunchEphemeralApp::Params::Create(*args_)); - EXTENSION_FUNCTION_VALIDATE(params); - - AddRef(); // Balanced in OnLaunchComplete() - - scoped_refptr<EphemeralAppLauncher> launcher = - EphemeralAppLauncher::CreateForWebContents( - params->id, - web_contents, - base::Bind( - &WebstorePrivateLaunchEphemeralAppFunction::OnLaunchComplete, - base::Unretained(this))); - launcher->Start(); - - return RespondLater(); -} - -void WebstorePrivateLaunchEphemeralAppFunction::OnLaunchComplete( - webstore_install::Result result, const std::string& error) { - Respond(BuildResponse(WebstoreInstallResultToApiResult(result), error)); - Release(); // Matches AddRef() in Run() -} - -ExtensionFunction::ResponseValue -WebstorePrivateLaunchEphemeralAppFunction::BuildResponse( - api::webstore_private::Result result, const std::string& error) { - if (result != api::webstore_private::RESULT_SUCCESS) { - std::string error_message; - if (error.empty()) { - error_message = base::StringPrintf( - "[%s]", api::webstore_private::ToString(result).c_str()); - } else { - error_message = base::StringPrintf( - "[%s]: %s", - api::webstore_private::ToString(result).c_str(), - error.c_str()); - } - return ErrorWithArguments(LaunchEphemeralApp::Results::Create(result), - error_message); - } - return ArgumentList(LaunchEphemeralApp::Results::Create(result)); + // Just fail as this is no longer supported. + return RespondNow(Error(kEphemeralAppLaunchingNotSupported)); } WebstorePrivateGetEphemeralAppsEnabledFunction:: @@ -811,7 +720,7 @@ WebstorePrivateGetEphemeralAppsEnabledFunction:: ExtensionFunction::ResponseAction WebstorePrivateGetEphemeralAppsEnabledFunction::Run() { return RespondNow(ArgumentList(GetEphemeralAppsEnabled::Results::Create( - EphemeralAppLauncher::IsFeatureEnabled()))); + false))); } } // namespace extensions diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc index 6d63a6a..656b7d3 100644 --- a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc @@ -32,7 +32,6 @@ #include "gpu/config/gpu_feature_type.h" #include "gpu/config/gpu_info.h" #include "net/dns/mock_host_resolver.h" -#include "ui/app_list/app_list_switches.h" #include "ui/gl/gl_switches.h" using gpu::GpuFeatureType; @@ -398,45 +397,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebstoreGetWebGLStatusTest, Blocked) { RunTest(webgl_allowed); } -class EphemeralAppWebstorePrivateApiTest - : public ExtensionWebstorePrivateApiTest { - public: - void SetUpInProcessBrowserTestFixture() override { - ExtensionWebstorePrivateApiTest::SetUpInProcessBrowserTestFixture(); - - net::HostPortPair host_port = test_server()->host_port_pair(); - std::string test_gallery_url = base::StringPrintf( - "http://www.example.com:%d/files/extensions/platform_apps/" - "ephemeral_launcher", - host_port.port()); - base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( - switches::kAppsGalleryURL, test_gallery_url); - } - - GURL GetTestServerURL(const std::string& path) override { - return DoGetTestServerURL( - std::string("files/extensions/platform_apps/ephemeral_launcher/") + - path); - } -}; - -// Run tests when the --enable-ephemeral-apps switch is not enabled. -IN_PROC_BROWSER_TEST_F(EphemeralAppWebstorePrivateApiTest, - EphemeralAppsFeatureDisabled) { - base::CommandLine::ForCurrentProcess()->AppendSwitch( - app_list::switches::kDisableExperimentalAppList); - ASSERT_TRUE(RunInstallTest("webstore_launch_disabled.html", "app.crx")); -} - -// Run tests when the --enable-ephemeral-apps switch is enabled. -IN_PROC_BROWSER_TEST_F(EphemeralAppWebstorePrivateApiTest, LaunchEphemeralApp) { - base::CommandLine::ForCurrentProcess()->AppendSwitch( - switches::kEnableEphemeralAppsInWebstore); - base::CommandLine::ForCurrentProcess()->AppendSwitch( - app_list::switches::kEnableExperimentalAppList); - ASSERT_TRUE(RunInstallTest("webstore_launch_app.html", "app.crx")); -} - class BundleWebstorePrivateApiTest : public ExtensionWebstorePrivateApiTest { public: diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index bcfd265..898c814 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc @@ -157,7 +157,6 @@ CrxInstaller::CrxInstaller(base::WeakPtr<ExtensionService> service_weak, minimum_version_ = base::Version(*approval->minimum_version); show_dialog_callback_ = approval->show_dialog_callback; - set_is_ephemeral(approval->is_ephemeral); } CrxInstaller::~CrxInstaller() { diff --git a/chrome/browser/extensions/install_observer.cc b/chrome/browser/extensions/install_observer.cc index 37c7565..1145951 100644 --- a/chrome/browser/extensions/install_observer.cc +++ b/chrome/browser/extensions/install_observer.cc @@ -16,7 +16,6 @@ InstallObserver::ExtensionInstallParams::ExtensionInstallParams( extension_name(extension_name), installing_icon(installing_icon), is_app(is_app), - is_platform_app(is_platform_app), - is_ephemeral(false) {} + is_platform_app(is_platform_app) {} } // namespace extensions diff --git a/chrome/browser/extensions/install_observer.h b/chrome/browser/extensions/install_observer.h index faecf14..0185dd3 100644 --- a/chrome/browser/extensions/install_observer.h +++ b/chrome/browser/extensions/install_observer.h @@ -28,7 +28,6 @@ class InstallObserver { gfx::ImageSkia installing_icon; bool is_app; bool is_platform_app; - bool is_ephemeral; }; // Called at the beginning of the complete installation process, i.e., this diff --git a/chrome/browser/extensions/install_tracker.cc b/chrome/browser/extensions/install_tracker.cc index 29758b2..67e0cbb 100644 --- a/chrome/browser/extensions/install_tracker.cc +++ b/chrome/browser/extensions/install_tracker.cc @@ -79,7 +79,6 @@ void InstallTracker::OnBeginExtensionInstall( active_installs_.find(params.extension_id); if (install_data == active_installs_.end()) { ActiveInstallData install_data(params.extension_id); - install_data.is_ephemeral = params.is_ephemeral; active_installs_.insert(std::make_pair(params.extension_id, install_data)); } diff --git a/chrome/browser/extensions/install_tracker_unittest.cc b/chrome/browser/extensions/install_tracker_unittest.cc index e02400f..84572cd 100644 --- a/chrome/browser/extensions/install_tracker_unittest.cc +++ b/chrome/browser/extensions/install_tracker_unittest.cc @@ -61,7 +61,6 @@ class InstallTrackerTest : public testing::Test { void VerifyInstallData(const ActiveInstallData& original, const ActiveInstallData& retrieved) { EXPECT_EQ(original.extension_id, retrieved.extension_id); - EXPECT_EQ(original.is_ephemeral, retrieved.is_ephemeral); EXPECT_EQ(original.percent_downloaded, retrieved.percent_downloaded); } @@ -75,7 +74,6 @@ TEST_F(InstallTrackerTest, AddAndRemoveActiveInstalls) { ActiveInstallData install_data1(kExtensionId1); install_data1.percent_downloaded = 76; ActiveInstallData install_data2(kExtensionId2); - install_data2.is_ephemeral = true; tracker_->AddActiveInstall(install_data1); tracker_->AddActiveInstall(install_data2); @@ -174,7 +172,6 @@ TEST_F(InstallTrackerTest, DownloadProgressUpdated) { TEST_F(InstallTrackerTest, ExtensionInstallFailure) { InstallObserver::ExtensionInstallParams install_params( kExtensionId1, std::string(), gfx::ImageSkia(), false, false); - install_params.is_ephemeral = true; tracker_->OnBeginExtensionInstall(install_params); const ActiveInstallData* retrieved_data = @@ -182,7 +179,6 @@ TEST_F(InstallTrackerTest, ExtensionInstallFailure) { ASSERT_TRUE(retrieved_data); EXPECT_EQ(0, retrieved_data->percent_downloaded); EXPECT_EQ(install_params.extension_id, retrieved_data->extension_id); - EXPECT_EQ(install_params.is_ephemeral, retrieved_data->is_ephemeral); retrieved_data = NULL; tracker_->OnInstallFailure(kExtensionId1); @@ -200,7 +196,6 @@ TEST_F(InstallTrackerTest, ExtensionInstalledEvent) { ASSERT_TRUE(retrieved_data); EXPECT_EQ(0, retrieved_data->percent_downloaded); EXPECT_EQ(install_params.extension_id, retrieved_data->extension_id); - EXPECT_EQ(install_params.is_ephemeral, retrieved_data->is_ephemeral); retrieved_data = NULL; // Simulate an extension install. diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc index d85cfad..f824dd6 100644 --- a/chrome/browser/extensions/webstore_installer.cc +++ b/chrome/browser/extensions/webstore_installer.cc @@ -241,8 +241,7 @@ WebstoreInstaller::Approval::Approval() skip_post_install_ui(false), skip_install_dialog(false), enable_launcher(false), - manifest_check_level(MANIFEST_CHECK_LEVEL_STRICT), - is_ephemeral(false) { + manifest_check_level(MANIFEST_CHECK_LEVEL_STRICT) { } scoped_ptr<WebstoreInstaller::Approval> @@ -358,7 +357,6 @@ void WebstoreInstaller::Start() { approval_->installing_icon, approval_->manifest->is_app(), approval_->manifest->is_platform_app()); - params.is_ephemeral = approval_->is_ephemeral; tracker->OnBeginExtensionInstall(params); tracker->OnBeginExtensionDownload(id_); diff --git a/chrome/browser/extensions/webstore_installer.h b/chrome/browser/extensions/webstore_installer.h index 21f71a7..e02cbc6 100644 --- a/chrome/browser/extensions/webstore_installer.h +++ b/chrome/browser/extensions/webstore_installer.h @@ -161,9 +161,6 @@ class WebstoreInstaller : public content::NotificationObserver, // Required minimum version. scoped_ptr<Version> minimum_version; - // Ephemeral apps are transiently installed. - bool is_ephemeral; - // The authuser index required to download the item being installed. May be // the empty string, in which case no authuser parameter is used. std::string authuser; diff --git a/chrome/browser/extensions/webstore_standalone_installer.cc b/chrome/browser/extensions/webstore_standalone_installer.cc index 5b3ad15..760cb00 100644 --- a/chrome/browser/extensions/webstore_standalone_installer.cc +++ b/chrome/browser/extensions/webstore_standalone_installer.cc @@ -35,7 +35,6 @@ const char kInvalidManifestError[] = "Invalid manifest"; const char kUserCancelledError[] = "User cancelled install"; const char kExtensionIsBlacklisted[] = "Extension is blacklisted"; const char kInstallInProgressError[] = "An install is already in progress"; -const char kLaunchInProgressError[] = "A launch is already in progress"; WebstoreStandaloneInstaller::WebstoreStandaloneInstaller( const std::string& webstore_item_id, @@ -111,13 +110,8 @@ bool WebstoreStandaloneInstaller::EnsureUniqueInstall( const ActiveInstallData* existing_install_data = tracker->GetActiveInstall(id_); if (existing_install_data) { - if (existing_install_data->is_ephemeral) { - *reason = webstore_install::LAUNCH_IN_PROGRESS; - *error = kLaunchInProgressError; - } else { - *reason = webstore_install::INSTALL_IN_PROGRESS; - *error = kInstallInProgressError; - } + *reason = webstore_install::INSTALL_IN_PROGRESS; + *error = kInstallInProgressError; return false; } @@ -215,8 +209,7 @@ void WebstoreStandaloneInstaller::InstallUIProceed() { // Don't install a blacklisted extension. install_result = webstore_install::BLACKLISTED; install_message = kExtensionIsBlacklisted; - } else if (util::IsEphemeralApp(installed_extension->id(), profile_) && - !approval->is_ephemeral) { + } else if (util::IsEphemeralApp(installed_extension->id(), profile_)) { // If the target extension has already been installed ephemerally and is // up to date, it can be promoted to a regular installed extension and // downloading from the Web Store is not necessary. |