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

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 264763002: Support remote installation of extensions and apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add a first test, fix a bug Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <set> 9 #include <set>
10 10
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 if (pending_extension_info && !pending_extension_info->install_silently()) 537 if (pending_extension_info && !pending_extension_info->install_silently())
538 client.reset(ExtensionInstallUI::CreateInstallPromptWithProfile(profile_)); 538 client.reset(ExtensionInstallUI::CreateInstallPromptWithProfile(profile_));
539 539
540 scoped_refptr<CrxInstaller> installer( 540 scoped_refptr<CrxInstaller> installer(
541 CrxInstaller::Create(this, client.Pass())); 541 CrxInstaller::Create(this, client.Pass()));
542 installer->set_expected_id(id); 542 installer->set_expected_id(id);
543 int creation_flags = Extension::NO_FLAGS; 543 int creation_flags = Extension::NO_FLAGS;
544 if (pending_extension_info) { 544 if (pending_extension_info) {
545 installer->set_install_source(pending_extension_info->install_source()); 545 installer->set_install_source(pending_extension_info->install_source());
546 if (pending_extension_info->install_silently()) 546 if (pending_extension_info->install_silently())
547 installer->set_allow_silent_install(true); 547 installer->set_allow_silent_install(
548 pending_extension_info->remote_install()
549 ? CrxInstaller::SILENTLY_DONT_GRANT
550 : CrxInstaller::GRANT_SILENTLY);
548 creation_flags = pending_extension_info->creation_flags(); 551 creation_flags = pending_extension_info->creation_flags();
549 if (pending_extension_info->mark_acknowledged()) 552 if (pending_extension_info->mark_acknowledged())
550 AcknowledgeExternalExtension(id); 553 AcknowledgeExternalExtension(id);
551 } else if (extension) { 554 } else if (extension) {
552 installer->set_install_source(extension->location()); 555 installer->set_install_source(extension->location());
553 } 556 }
554 // If the extension was installed from or has migrated to the webstore, or 557 // If the extension was installed from or has migrated to the webstore, or
555 // its auto-update URL is from the webstore, treat it as a webstore install. 558 // its auto-update URL is from the webstore, treat it as a webstore install.
556 // Note that we ignore some older extensions with blank auto-update URLs 559 // Note that we ignore some older extensions with blank auto-update URLs
557 // because we are mostly concerned with restrictions on NaCl extensions, 560 // because we are mostly concerned with restrictions on NaCl extensions,
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 extension_prefs_->IsExtensionDisabled(extension->id())) { 1491 extension_prefs_->IsExtensionDisabled(extension->id())) {
1489 registry_->AddDisabled(extension); 1492 registry_->AddDisabled(extension);
1490 if (extension_sync_service_) 1493 if (extension_sync_service_)
1491 extension_sync_service_->SyncExtensionChangeIfNeeded(*extension); 1494 extension_sync_service_->SyncExtensionChangeIfNeeded(*extension);
1492 content::NotificationService::current()->Notify( 1495 content::NotificationService::current()->Notify(
1493 chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, 1496 chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED,
1494 content::Source<Profile>(profile_), 1497 content::Source<Profile>(profile_),
1495 content::Details<const Extension>(extension)); 1498 content::Details<const Extension>(extension));
1496 1499
1497 // Show the extension disabled error if a permissions increase was the 1500 // Show the extension disabled error if a permissions increase was the
1498 // only reason it was disabled. 1501 // only reason it was disabled, or if the extensions was remotely installed.
1499 if (extension_prefs_->GetDisableReasons(extension->id()) == 1502 int reasons = extension_prefs_->GetDisableReasons(extension->id());
1500 Extension::DISABLE_PERMISSIONS_INCREASE) { 1503 if (reasons == Extension::DISABLE_PERMISSIONS_INCREASE ||
1501 extensions::AddExtensionDisabledError(this, extension); 1504 reasons & Extension::DISABLE_REMOTE_INSTALL) {
1505 extensions::AddExtensionDisabledError(this, extension, reasons);
1502 } 1506 }
1503 } else if (reloading) { 1507 } else if (reloading) {
1504 // Replace the old extension with the new version. 1508 // Replace the old extension with the new version.
1505 CHECK(!registry_->AddDisabled(extension)); 1509 CHECK(!registry_->AddDisabled(extension));
1506 EnableExtension(extension->id()); 1510 EnableExtension(extension->id());
1507 } else { 1511 } else {
1508 // All apps that are displayed in the launcher are ordered by their ordinals 1512 // All apps that are displayed in the launcher are ordered by their ordinals
1509 // so we must ensure they have valid ordinals. 1513 // so we must ensure they have valid ordinals.
1510 if (extension->RequiresSortOrdinal()) { 1514 if (extension->RequiresSortOrdinal()) {
1511 if (!extension->ShouldDisplayInNewTabPage()) { 1515 if (!extension->ShouldDisplayInNewTabPage()) {
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
2426 void ExtensionService::UnloadAllExtensionsInternal() { 2430 void ExtensionService::UnloadAllExtensionsInternal() {
2427 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); 2431 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions();
2428 2432
2429 registry_->ClearAll(); 2433 registry_->ClearAll();
2430 system_->runtime_data()->ClearAll(); 2434 system_->runtime_data()->ClearAll();
2431 2435
2432 // TODO(erikkay) should there be a notification for this? We can't use 2436 // TODO(erikkay) should there be a notification for this? We can't use
2433 // EXTENSION_UNLOADED since that implies that the extension has been disabled 2437 // EXTENSION_UNLOADED since that implies that the extension has been disabled
2434 // or uninstalled. 2438 // or uninstalled.
2435 } 2439 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698