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

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: rebase 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 client.reset(ExtensionInstallUI::CreateInstallPromptWithProfile(profile_)); 537 client.reset(ExtensionInstallUI::CreateInstallPromptWithProfile(profile_));
538 538
539 scoped_refptr<CrxInstaller> installer( 539 scoped_refptr<CrxInstaller> installer(
540 CrxInstaller::Create(this, client.Pass())); 540 CrxInstaller::Create(this, client.Pass()));
541 installer->set_expected_id(id); 541 installer->set_expected_id(id);
542 int creation_flags = Extension::NO_FLAGS; 542 int creation_flags = Extension::NO_FLAGS;
543 if (pending_extension_info) { 543 if (pending_extension_info) {
544 installer->set_install_source(pending_extension_info->install_source()); 544 installer->set_install_source(pending_extension_info->install_source());
545 if (pending_extension_info->install_silently()) 545 if (pending_extension_info->install_silently())
546 installer->set_allow_silent_install(true); 546 installer->set_allow_silent_install(true);
547 if (pending_extension_info->remote_install())
548 installer->set_grant_permissions(false);
547 creation_flags = pending_extension_info->creation_flags(); 549 creation_flags = pending_extension_info->creation_flags();
548 if (pending_extension_info->mark_acknowledged()) 550 if (pending_extension_info->mark_acknowledged())
549 AcknowledgeExternalExtension(id); 551 AcknowledgeExternalExtension(id);
550 } else if (extension) { 552 } else if (extension) {
551 installer->set_install_source(extension->location()); 553 installer->set_install_source(extension->location());
552 } 554 }
553 // If the extension was installed from or has migrated to the webstore, or 555 // If the extension was installed from or has migrated to the webstore, or
554 // its auto-update URL is from the webstore, treat it as a webstore install. 556 // its auto-update URL is from the webstore, treat it as a webstore install.
555 // Note that we ignore some older extensions with blank auto-update URLs 557 // Note that we ignore some older extensions with blank auto-update URLs
556 // because we are mostly concerned with restrictions on NaCl extensions, 558 // because we are mostly concerned with restrictions on NaCl extensions,
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 } else if (!reloading && 1487 } else if (!reloading &&
1486 extension_prefs_->IsExtensionDisabled(extension->id())) { 1488 extension_prefs_->IsExtensionDisabled(extension->id())) {
1487 registry_->AddDisabled(extension); 1489 registry_->AddDisabled(extension);
1488 if (extension_sync_service_) 1490 if (extension_sync_service_)
1489 extension_sync_service_->SyncExtensionChangeIfNeeded(*extension); 1491 extension_sync_service_->SyncExtensionChangeIfNeeded(*extension);
1490 content::NotificationService::current()->Notify( 1492 content::NotificationService::current()->Notify(
1491 chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, 1493 chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED,
1492 content::Source<Profile>(profile_), 1494 content::Source<Profile>(profile_),
1493 content::Details<const Extension>(extension)); 1495 content::Details<const Extension>(extension));
1494 1496
1495 // Show the extension disabled error if a permissions increase was the 1497 // Show the extension disabled error if a permissions increase or a remote
1496 // only reason it was disabled. 1498 // installation is the reason it was disabled, and no other reasons exist.
1497 if (extension_prefs_->GetDisableReasons(extension->id()) == 1499 int reasons = extension_prefs_->GetDisableReasons(extension->id());
1498 Extension::DISABLE_PERMISSIONS_INCREASE) { 1500 const int kReasonMask = Extension::DISABLE_PERMISSIONS_INCREASE |
1499 extensions::AddExtensionDisabledError(this, extension); 1501 Extension::DISABLE_REMOTE_INSTALL;
1502 if (reasons & kReasonMask && !(reasons & ~kReasonMask)) {
1503 extensions::AddExtensionDisabledError(
1504 this,
1505 extension,
1506 extension_prefs_->HasDisableReason(
1507 extension->id(), Extension::DISABLE_REMOTE_INSTALL));
1500 } 1508 }
1501 } else if (reloading) { 1509 } else if (reloading) {
1502 // Replace the old extension with the new version. 1510 // Replace the old extension with the new version.
1503 CHECK(!registry_->AddDisabled(extension)); 1511 CHECK(!registry_->AddDisabled(extension));
1504 EnableExtension(extension->id()); 1512 EnableExtension(extension->id());
1505 } else { 1513 } else {
1506 // All apps that are displayed in the launcher are ordered by their ordinals 1514 // All apps that are displayed in the launcher are ordered by their ordinals
1507 // so we must ensure they have valid ordinals. 1515 // so we must ensure they have valid ordinals.
1508 if (extension->RequiresSortOrdinal()) { 1516 if (extension->RequiresSortOrdinal()) {
1509 if (!extension->ShouldDisplayInNewTabPage()) { 1517 if (!extension->ShouldDisplayInNewTabPage()) {
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
2408 void ExtensionService::UnloadAllExtensionsInternal() { 2416 void ExtensionService::UnloadAllExtensionsInternal() {
2409 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); 2417 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions();
2410 2418
2411 registry_->ClearAll(); 2419 registry_->ClearAll();
2412 system_->runtime_data()->ClearAll(); 2420 system_->runtime_data()->ClearAll();
2413 2421
2414 // TODO(erikkay) should there be a notification for this? We can't use 2422 // TODO(erikkay) should there be a notification for this? We can't use
2415 // EXTENSION_UNLOADED since that implies that the extension has been disabled 2423 // EXTENSION_UNLOADED since that implies that the extension has been disabled
2416 // or uninstalled. 2424 // or uninstalled.
2417 } 2425 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698