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

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

Issue 971733003: Supervised users: When an extension requires new permissions, send request to custodian (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@test_ext_install_disable
Patch Set: using Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 #include "extensions/common/extension_urls.h" 77 #include "extensions/common/extension_urls.h"
78 #include "extensions/common/feature_switch.h" 78 #include "extensions/common/feature_switch.h"
79 #include "extensions/common/file_util.h" 79 #include "extensions/common/file_util.h"
80 #include "extensions/common/manifest_constants.h" 80 #include "extensions/common/manifest_constants.h"
81 #include "extensions/common/manifest_handlers/background_info.h" 81 #include "extensions/common/manifest_handlers/background_info.h"
82 #include "extensions/common/manifest_url_handlers.h" 82 #include "extensions/common/manifest_url_handlers.h"
83 #include "extensions/common/one_shot_event.h" 83 #include "extensions/common/one_shot_event.h"
84 #include "extensions/common/permissions/permission_message_provider.h" 84 #include "extensions/common/permissions/permission_message_provider.h"
85 #include "extensions/common/permissions/permissions_data.h" 85 #include "extensions/common/permissions/permissions_data.h"
86 86
87 #if defined(ENABLE_SUPERVISED_USERS)
88 #include "chrome/browser/supervised_user/supervised_user_service.h"
89 #include "chrome/browser/supervised_user/supervised_user_service_factory.h"
90 #endif
91
87 #if defined(OS_CHROMEOS) 92 #if defined(OS_CHROMEOS)
88 #include "chrome/browser/chromeos/extensions/install_limiter.h" 93 #include "chrome/browser/chromeos/extensions/install_limiter.h"
89 #include "storage/browser/fileapi/file_system_backend.h" 94 #include "storage/browser/fileapi/file_system_backend.h"
90 #include "storage/browser/fileapi/file_system_context.h" 95 #include "storage/browser/fileapi/file_system_context.h"
91 #endif 96 #endif
92 97
93 using content::BrowserContext; 98 using content::BrowserContext;
94 using content::BrowserThread; 99 using content::BrowserThread;
95 using content::DevToolsAgentHost; 100 using content::DevToolsAgentHost;
96 using extensions::CrxInstaller; 101 using extensions::CrxInstaller;
97 using extensions::Extension; 102 using extensions::Extension;
98 using extensions::ExtensionIdSet; 103 using extensions::ExtensionIdSet;
99 using extensions::ExtensionInfo; 104 using extensions::ExtensionInfo;
100 using extensions::ExtensionRegistry; 105 using extensions::ExtensionRegistry;
101 using extensions::ExtensionSet; 106 using extensions::ExtensionSet;
102 using extensions::FeatureSwitch; 107 using extensions::FeatureSwitch;
103 using extensions::InstallVerifier; 108 using extensions::InstallVerifier;
104 using extensions::ManagementPolicy; 109 using extensions::ManagementPolicy;
105 using extensions::Manifest; 110 using extensions::Manifest;
106 using extensions::PermissionMessage; 111 using extensions::PermissionMessage;
107 using extensions::PermissionMessages; 112 using extensions::PermissionMessages;
108 using extensions::PermissionSet; 113 using extensions::PermissionSet;
109 using extensions::SharedModuleInfo; 114 using extensions::SharedModuleInfo;
110 using extensions::SharedModuleService; 115 using extensions::SharedModuleService;
111 using extensions::UnloadedExtensionInfo; 116 using extensions::UnloadedExtensionInfo;
112 117
113 namespace errors = extensions::manifest_errors;
114
115 namespace { 118 namespace {
116 119
117 // Wait this many seconds after an extensions becomes idle before updating it. 120 // Wait this many seconds after an extensions becomes idle before updating it.
118 const int kUpdateIdleDelay = 5; 121 const int kUpdateIdleDelay = 5;
119 122
123 #if defined(ENABLE_SUPERVISED_USERS)
124 // Callback for SupervisedUserService::AddExtensionUpdateRequest.
125 void ExtensionUpdateRequestSent(const std::string& id, bool success) {
126 LOG_IF(WARNING, !success) << "Failed sending update request for " << id;
127 }
128 #endif
129
120 } // namespace 130 } // namespace
121 131
122 // ExtensionService. 132 // ExtensionService.
123 133
124 void ExtensionService::CheckExternalUninstall(const std::string& id) { 134 void ExtensionService::CheckExternalUninstall(const std::string& id) {
125 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 135 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
126 136
127 // Check if the providers know about this extension. 137 // Check if the providers know about this extension.
128 extensions::ProviderCollection::const_iterator i; 138 extensions::ProviderCollection::const_iterator i;
129 for (i = external_extension_providers_.begin(); 139 for (i = external_extension_providers_.begin();
(...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 if (disable_reasons == Extension::DISABLE_REMOTE_INSTALL) { 1663 if (disable_reasons == Extension::DISABLE_REMOTE_INSTALL) {
1654 extension_prefs_->SetDidExtensionEscalatePermissions(extension, true); 1664 extension_prefs_->SetDidExtensionEscalatePermissions(extension, true);
1655 } else if (is_privilege_increase) { 1665 } else if (is_privilege_increase) {
1656 disable_reasons |= Extension::DISABLE_PERMISSIONS_INCREASE; 1666 disable_reasons |= Extension::DISABLE_PERMISSIONS_INCREASE;
1657 if (!extension_prefs_->DidExtensionEscalatePermissions(extension->id())) { 1667 if (!extension_prefs_->DidExtensionEscalatePermissions(extension->id())) {
1658 RecordPermissionMessagesHistogram(extension, 1668 RecordPermissionMessagesHistogram(extension,
1659 "Extensions.Permissions_AutoDisable2"); 1669 "Extensions.Permissions_AutoDisable2");
1660 } 1670 }
1661 extension_prefs_->SetExtensionState(extension->id(), Extension::DISABLED); 1671 extension_prefs_->SetExtensionState(extension->id(), Extension::DISABLED);
1662 extension_prefs_->SetDidExtensionEscalatePermissions(extension, true); 1672 extension_prefs_->SetDidExtensionEscalatePermissions(extension, true);
1673
1674 #if defined(ENABLE_SUPERVISED_USERS)
not at google - send to devlin 2015/03/03 17:51:15 What is stopping the existing logic - wherever tha
Marc Treib 2015/03/04 11:15:38 I assume you meant the re-enable dialog? All the U
not at google - send to devlin 2015/03/04 17:43:36 Yeah sorry, I meant the re-enable. It would be so
1675 // If a custodian-installed extension is disabled for a supervised user due
1676 // to a permissions increase, send a request to the custodian, since the
1677 // supervised user itself can't re-enable the extension.
1678 if (extensions::util::IsExtensionSupervised(extension, profile_)) {
1679 SupervisedUserService* supervised_user_service =
1680 SupervisedUserServiceFactory::GetForProfile(profile_);
1681 supervised_user_service->AddExtensionUpdateRequest(
1682 extension->id(),
1683 base::Bind(ExtensionUpdateRequestSent, extension->id()));
1684 }
1685 #endif
1663 } 1686 }
1664 if (disable_reasons != Extension::DISABLE_NONE) { 1687 if (disable_reasons != Extension::DISABLE_NONE) {
1665 extension_prefs_->AddDisableReason( 1688 extension_prefs_->AddDisableReason(
1666 extension->id(), 1689 extension->id(),
1667 static_cast<Extension::DisableReason>(disable_reasons)); 1690 static_cast<Extension::DisableReason>(disable_reasons));
1668 } 1691 }
1669 } 1692 }
1670 1693
1671 void ExtensionService::UpdateActiveExtensionsInCrashReporter() { 1694 void ExtensionService::UpdateActiveExtensionsInCrashReporter() {
1672 std::set<std::string> extension_ids; 1695 std::set<std::string> extension_ids;
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
2556 } 2579 }
2557 2580
2558 void ExtensionService::OnProfileDestructionStarted() { 2581 void ExtensionService::OnProfileDestructionStarted() {
2559 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2582 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2560 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2583 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2561 it != ids_to_unload.end(); 2584 it != ids_to_unload.end();
2562 ++it) { 2585 ++it) {
2563 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); 2586 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2564 } 2587 }
2565 } 2588 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698