Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6093)

Unified Diff: chrome/browser/extensions/extension_webstore_private_api.cc

Issue 9959079: Remove chrome.webstorePrivate.silentlyInstall. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_webstore_private_api.cc
diff --git a/chrome/browser/extensions/extension_webstore_private_api.cc b/chrome/browser/extensions/extension_webstore_private_api.cc
index 33c76d09302f7bb3a249d0fb1c208b0a727c1b61..db4635aef0810524ded74f0fbdc275173654cbe5 100644
--- a/chrome/browser/extensions/extension_webstore_private_api.cc
+++ b/chrome/browser/extensions/extension_webstore_private_api.cc
@@ -71,33 +71,6 @@ ProfileSyncService* GetSyncService(Profile* profile) {
return ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile);
}
-// Whitelists extension IDs for use by webstorePrivate.silentlyInstall.
-bool trust_test_ids = false;
-
-bool IsTrustedForSilentInstall(const std::string& id) {
- // Trust the extensions in api_test/webstore_private/bundle when the flag
- // is set.
- if (trust_test_ids &&
- (id == "begfmnajjkbjdgmffnjaojchoncnmngg" ||
- id == "bmfoocgfinpmkmlbjhcbofejhkhlbchk" ||
- id == "mpneghmdnmaolkljkipbhaienajcflfe"))
- return true;
-
- return
- id == "jgoepmocgafhnchmokaimcmlojpnlkhp" || // +1 Extension
- id == "cpembckmhnjipbgbnfiocbgnkpjdokdd" || // +1 Extension - dev
- id == "boemmnepglcoinjcdlfcpcbmhiecichi" || // Notifications
- id == "flibmgiapaohcbondaoopaalfejliklp" || // Notifications - dev
- id == "nckgahadagoaajjgafhacjanaoiihapd" || // Talk
- id == "eggnbpckecmjlblplehfpjjdhhidfdoj" || // Talk Beta
- id == "dlppkpafhbajpcmmoheippocdidnckmm" || // Remaining are placeholders
- id == "hmglfmpefabcafaimbpldpambdfomanl" ||
- id == "idfijlieiecpfcjckpkliefekpokhhnd" ||
- id == "jaokjbijaokooelpahnlmbciccldmfla" ||
- id == "kdjeommiakphmeionoojjljlecmpaldd" ||
- id == "lpdeojkfhenboeibhkjhiancceeboknd";
-}
-
// Helper to create a dictionary with login and token properties set from
// the appropriate values in the passed-in |profile|.
DictionaryValue* CreateLoginResult(Profile* profile) {
@@ -134,11 +107,6 @@ void WebstorePrivateApi::SetWebstoreInstallerDelegateForTesting(
test_webstore_installer_delegate = delegate;
}
-// static
-void WebstorePrivateApi::SetTrustTestIDsForTesting(bool allow) {
- trust_test_ids = allow;
-}
-
InstallBundleFunction::InstallBundleFunction() {}
InstallBundleFunction::~InstallBundleFunction() {}
@@ -428,84 +396,6 @@ bool CompleteInstallFunction::RunImpl() {
return true;
}
-SilentlyInstallFunction::SilentlyInstallFunction() {}
-SilentlyInstallFunction::~SilentlyInstallFunction() {}
-
-bool SilentlyInstallFunction::RunImpl() {
- DictionaryValue* details = NULL;
- EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &details));
- CHECK(details);
-
- EXTENSION_FUNCTION_VALIDATE(details->GetString(kIdKey, &id_));
- if (!IsTrustedForSilentInstall(id_)) {
- error_ = kInvalidIdError;
- return false;
- }
-
- EXTENSION_FUNCTION_VALIDATE(details->GetString(kManifestKey, &manifest_));
-
- // Matched in OnWebstoreParseFailure, OnExtensionInstall{Success,Failure}.
- AddRef();
-
- scoped_refptr<WebstoreInstallHelper> helper = new WebstoreInstallHelper(
- this, id_, manifest_, std::string(), GURL(), NULL);
- helper->Start();
-
- return true;
-}
-
-void SilentlyInstallFunction::OnWebstoreParseSuccess(
- const std::string& id,
- const SkBitmap& icon,
- base::DictionaryValue* parsed_manifest) {
- CHECK_EQ(id_, id);
-
- // This lets CrxInstaller bypass the permission confirmation UI for the
- // extension. The whitelist entry gets cleared in
- // CrxInstaller::ConfirmInstall.
- CrxInstaller::WhitelistEntry* entry = new CrxInstaller::WhitelistEntry;
- entry->parsed_manifest.reset(parsed_manifest);
- entry->use_app_installed_bubble = false;
- entry->skip_post_install_ui = true;
- CrxInstaller::SetWhitelistEntry(id_, entry);
-
- scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller(
- profile(), this,
- &(dispatcher()->delegate()->GetAssociatedWebContents()->GetController()),
- id_, WebstoreInstaller::FLAG_NONE);
- installer->Start();
-}
-
-void SilentlyInstallFunction::OnWebstoreParseFailure(
- const std::string& id,
- InstallHelperResultCode result_code,
- const std::string& error_message) {
- CHECK_EQ(id_, id);
-
- error_ = error_message;
- SendResponse(false);
-
- Release(); // Matches the AddRef() in RunImpl().
-}
-
-void SilentlyInstallFunction::OnExtensionInstallSuccess(const std::string& id) {
- CHECK_EQ(id_, id);
-
- SendResponse(true);
-
- Release(); // Matches the AddRef() in RunImpl().
-}
-
-void SilentlyInstallFunction::OnExtensionInstallFailure(
- const std::string& id, const std::string& error) {
- CHECK_EQ(id_, id);
-
- error_ = error;
- SendResponse(false);
-
- Release(); // Matches the AddRef() in RunImpl().
-}
-
bool GetBrowserLoginFunction::RunImpl() {
result_.reset(CreateLoginResult(profile_->GetOriginalProfile()));
return true;

Powered by Google App Engine
This is Rietveld 408576698