OLD | NEW |
---|---|
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 Loading... | |
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 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1487 } else if (!reloading && | 1490 } else if (!reloading && |
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 or a remote |
1498 // only reason it was disabled. | 1501 // installation is the reason it was disabled, and no other reasons exist. |
Yoyo Zhou
2014/05/01 22:53:44
It shouldn't be possible to have PERMISSIONS_INCRE
Marijn Kruisselbrink
2014/05/05 20:45:36
Currently any remotely installed extension with no
Yoyo Zhou
2014/05/05 22:35:17
It's too bad we don't have a good notifications ar
not at google - send to devlin
2014/05/09 14:58:52
Good question. Let's go with "whatever is easiest"
Marijn Kruisselbrink
2014/05/14 23:30:02
Since the conclusion seems to have been that we sh
| |
1499 if (extension_prefs_->GetDisableReasons(extension->id()) == | 1502 int reasons = extension_prefs_->GetDisableReasons(extension->id()); |
1500 Extension::DISABLE_PERMISSIONS_INCREASE) { | 1503 const int kReasonMask = Extension::DISABLE_PERMISSIONS_INCREASE | |
1501 extensions::AddExtensionDisabledError(this, extension); | 1504 Extension::DISABLE_REMOTE_INSTALL; |
1505 if (reasons & kReasonMask && !(reasons & ~kReasonMask)) { | |
1506 extensions::AddExtensionDisabledError(this, extension, reasons); | |
1502 } | 1507 } |
1503 } else if (reloading) { | 1508 } else if (reloading) { |
1504 // Replace the old extension with the new version. | 1509 // Replace the old extension with the new version. |
1505 CHECK(!registry_->AddDisabled(extension)); | 1510 CHECK(!registry_->AddDisabled(extension)); |
1506 EnableExtension(extension->id()); | 1511 EnableExtension(extension->id()); |
1507 } else { | 1512 } else { |
1508 // All apps that are displayed in the launcher are ordered by their ordinals | 1513 // All apps that are displayed in the launcher are ordered by their ordinals |
1509 // so we must ensure they have valid ordinals. | 1514 // so we must ensure they have valid ordinals. |
1510 if (extension->RequiresSortOrdinal()) { | 1515 if (extension->RequiresSortOrdinal()) { |
1511 if (!extension->ShouldDisplayInNewTabPage()) { | 1516 if (!extension->ShouldDisplayInNewTabPage()) { |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2426 void ExtensionService::UnloadAllExtensionsInternal() { | 2431 void ExtensionService::UnloadAllExtensionsInternal() { |
2427 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); | 2432 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); |
2428 | 2433 |
2429 registry_->ClearAll(); | 2434 registry_->ClearAll(); |
2430 system_->runtime_data()->ClearAll(); | 2435 system_->runtime_data()->ClearAll(); |
2431 | 2436 |
2432 // TODO(erikkay) should there be a notification for this? We can't use | 2437 // 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 | 2438 // EXTENSION_UNLOADED since that implies that the extension has been disabled |
2434 // or uninstalled. | 2439 // or uninstalled. |
2435 } | 2440 } |
OLD | NEW |