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

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

Issue 8380006: Exempt component and policy-installed extensions from policy blacklist check. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/extensions/extension_prefs.cc ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <set> 8 #include <set>
9 9
10 #include "base/basictypes.h"
10 #include "base/bind.h" 11 #include "base/bind.h"
11 #include "base/basictypes.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/file_util.h" 14 #include "base/file_util.h"
15 #include "base/json/json_value_serializer.h" 15 #include "base/json/json_value_serializer.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/metrics/field_trial.h" 17 #include "base/metrics/field_trial.h"
18 #include "base/metrics/histogram.h" 18 #include "base/metrics/histogram.h"
19 #include "base/path_service.h" 19 #include "base/path_service.h"
20 #include "base/stl_util.h" 20 #include "base/stl_util.h"
21 #include "base/string16.h" 21 #include "base/string16.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 #include "chrome/common/extensions/extension_messages.h" 84 #include "chrome/common/extensions/extension_messages.h"
85 #include "chrome/common/extensions/extension_resource.h" 85 #include "chrome/common/extensions/extension_resource.h"
86 #include "chrome/common/pref_names.h" 86 #include "chrome/common/pref_names.h"
87 #include "chrome/common/url_constants.h" 87 #include "chrome/common/url_constants.h"
88 #include "content/browser/browser_thread.h" 88 #include "content/browser/browser_thread.h"
89 #include "content/browser/debugger/devtools_manager.h" 89 #include "content/browser/debugger/devtools_manager.h"
90 #include "content/browser/plugin_process_host.h" 90 #include "content/browser/plugin_process_host.h"
91 #include "content/browser/plugin_service.h" 91 #include "content/browser/plugin_service.h"
92 #include "content/browser/renderer_host/render_process_host.h" 92 #include "content/browser/renderer_host/render_process_host.h"
93 #include "content/browser/user_metrics.h" 93 #include "content/browser/user_metrics.h"
94 #include "content/common/pepper_plugin_registry.h"
94 #include "content/public/browser/notification_service.h" 95 #include "content/public/browser/notification_service.h"
95 #include "content/common/pepper_plugin_registry.h"
96 #include "content/public/browser/notification_types.h" 96 #include "content/public/browser/notification_types.h"
97 #include "googleurl/src/gurl.h" 97 #include "googleurl/src/gurl.h"
98 #include "net/base/registry_controlled_domain.h" 98 #include "net/base/registry_controlled_domain.h"
99 #include "webkit/database/database_tracker.h" 99 #include "webkit/database/database_tracker.h"
100 #include "webkit/database/database_util.h" 100 #include "webkit/database/database_util.h"
101 #include "webkit/plugins/npapi/plugin_list.h" 101 #include "webkit/plugins/npapi/plugin_list.h"
102 102
103 #if defined(OS_CHROMEOS) 103 #if defined(OS_CHROMEOS)
104 #include "chrome/browser/chromeos/cros/cros_library.h" 104 #include "chrome/browser/chromeos/cros/cros_library.h"
105 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h" 105 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h"
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 for (ExtensionPermissionMessages::iterator it = permissions.begin(); 1403 for (ExtensionPermissionMessages::iterator it = permissions.begin();
1404 it != permissions.end(); ++it) 1404 it != permissions.end(); ++it)
1405 counter->Add(it->id()); 1405 counter->Add(it->id());
1406 } 1406 }
1407 } 1407 }
1408 1408
1409 void ExtensionService::LoadInstalledExtension(const ExtensionInfo& info, 1409 void ExtensionService::LoadInstalledExtension(const ExtensionInfo& info,
1410 bool write_to_prefs) { 1410 bool write_to_prefs) {
1411 std::string error; 1411 std::string error;
1412 scoped_refptr<const Extension> extension(NULL); 1412 scoped_refptr<const Extension> extension(NULL);
1413 if (!extension_prefs_->IsExtensionAllowedByPolicy(info.extension_id)) { 1413 if (!extension_prefs_->IsExtensionAllowedByPolicy(info.extension_id,
1414 info.extension_location)) {
1414 error = errors::kDisabledByPolicy; 1415 error = errors::kDisabledByPolicy;
1415 } else if (info.extension_manifest.get()) { 1416 } else if (info.extension_manifest.get()) {
1416 extension = Extension::Create( 1417 extension = Extension::Create(
1417 info.extension_path, 1418 info.extension_path,
1418 info.extension_location, 1419 info.extension_location,
1419 *info.extension_manifest, 1420 *info.extension_manifest,
1420 GetExtensionCreateFlagsForInstalledExtension(&info), 1421 GetExtensionCreateFlagsForInstalledExtension(&info),
1421 &error); 1422 &error);
1422 } else { 1423 } else {
1423 error = errors::kManifestUnreadable; 1424 error = errors::kManifestUnreadable;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 ExtensionUpdater* ExtensionService::updater() { 1693 ExtensionUpdater* ExtensionService::updater() {
1693 return updater_.get(); 1694 return updater_.get();
1694 } 1695 }
1695 1696
1696 void ExtensionService::CheckAdminBlacklist() { 1697 void ExtensionService::CheckAdminBlacklist() {
1697 std::vector<std::string> to_be_removed; 1698 std::vector<std::string> to_be_removed;
1698 // Loop through extensions list, unload installed extensions. 1699 // Loop through extensions list, unload installed extensions.
1699 for (ExtensionList::const_iterator iter = extensions_.begin(); 1700 for (ExtensionList::const_iterator iter = extensions_.begin();
1700 iter != extensions_.end(); ++iter) { 1701 iter != extensions_.end(); ++iter) {
1701 const Extension* extension = (*iter); 1702 const Extension* extension = (*iter);
1702 if (!extension_prefs_->IsExtensionAllowedByPolicy(extension->id())) 1703 if (!extension_prefs_->IsExtensionAllowedByPolicy(extension->id(),
1704 extension->location())) {
1703 to_be_removed.push_back(extension->id()); 1705 to_be_removed.push_back(extension->id());
1706 }
1704 } 1707 }
1705 1708
1706 // UnloadExtension will change the extensions_ list. So, we should 1709 // UnloadExtension will change the extensions_ list. So, we should
1707 // call it outside the iterator loop. 1710 // call it outside the iterator loop.
1708 for (unsigned int i = 0; i < to_be_removed.size(); ++i) 1711 for (unsigned int i = 0; i < to_be_removed.size(); ++i)
1709 UnloadExtension(to_be_removed[i], extension_misc::UNLOAD_REASON_DISABLE); 1712 UnloadExtension(to_be_removed[i], extension_misc::UNLOAD_REASON_DISABLE);
1710 } 1713 }
1711 1714
1712 void ExtensionService::CheckForUpdatesSoon() { 1715 void ExtensionService::CheckForUpdatesSoon() {
1713 if (updater()) { 1716 if (updater()) {
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
2407 } 2410 }
2408 2411
2409 extensions_.push_back(scoped_extension); 2412 extensions_.push_back(scoped_extension);
2410 SyncExtensionChangeIfNeeded(*extension); 2413 SyncExtensionChangeIfNeeded(*extension);
2411 NotifyExtensionLoaded(extension); 2414 NotifyExtensionLoaded(extension);
2412 IdentifyAlertableExtensions(); 2415 IdentifyAlertableExtensions();
2413 } 2416 }
2414 2417
2415 void ExtensionService::InitializePermissions(const Extension* extension) { 2418 void ExtensionService::InitializePermissions(const Extension* extension) {
2416 // If the extension has used the optional permissions API, it will have a 2419 // If the extension has used the optional permissions API, it will have a
2420
Finnur 2011/10/24 15:08:13 I am repulsed by this particular change. The effec
Mattias Nissler (ping if slow) 2011/10/24 15:28:14 lol :) Done.
2417 // custom set of active permissions defined in the extension prefs. Here, 2421 // custom set of active permissions defined in the extension prefs. Here,
2418 // we update the extension's active permissions based on the prefs. 2422 // we update the extension's active permissions based on the prefs.
2419 scoped_refptr<ExtensionPermissionSet> active_permissions = 2423 scoped_refptr<ExtensionPermissionSet> active_permissions =
2420 extension_prefs()->GetActivePermissions(extension->id()); 2424 extension_prefs()->GetActivePermissions(extension->id());
2421 2425
2422 if (active_permissions.get()) { 2426 if (active_permissions.get()) {
2423 // We restrict the active permissions to be within the bounds defined in the 2427 // We restrict the active permissions to be within the bounds defined in the
2424 // extension's manifest. 2428 // extension's manifest.
2425 // a) active permissions must be a subset of optional + default permissions 2429 // a) active permissions must be a subset of optional + default permissions
2426 // b) active permissions must contains all default permissions 2430 // b) active permissions must contains all default permissions
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
3024 3028
3025 ExtensionService::NaClModuleInfoList::iterator 3029 ExtensionService::NaClModuleInfoList::iterator
3026 ExtensionService::FindNaClModule(const GURL& url) { 3030 ExtensionService::FindNaClModule(const GURL& url) {
3027 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 3031 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
3028 iter != nacl_module_list_.end(); ++iter) { 3032 iter != nacl_module_list_.end(); ++iter) {
3029 if (iter->url == url) 3033 if (iter->url == url)
3030 return iter; 3034 return iter;
3031 } 3035 }
3032 return nacl_module_list_.end(); 3036 return nacl_module_list_.end();
3033 } 3037 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_prefs.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698