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

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: Rebase, add comment regarding policy check on startup. 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
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 #include "chrome/common/extensions/extension_messages.h" 85 #include "chrome/common/extensions/extension_messages.h"
86 #include "chrome/common/extensions/extension_resource.h" 86 #include "chrome/common/extensions/extension_resource.h"
87 #include "chrome/common/pref_names.h" 87 #include "chrome/common/pref_names.h"
88 #include "chrome/common/url_constants.h" 88 #include "chrome/common/url_constants.h"
89 #include "content/browser/browser_thread.h" 89 #include "content/browser/browser_thread.h"
90 #include "content/browser/debugger/devtools_manager.h" 90 #include "content/browser/debugger/devtools_manager.h"
91 #include "content/browser/plugin_process_host.h" 91 #include "content/browser/plugin_process_host.h"
92 #include "content/browser/plugin_service.h" 92 #include "content/browser/plugin_service.h"
93 #include "content/browser/renderer_host/render_process_host.h" 93 #include "content/browser/renderer_host/render_process_host.h"
94 #include "content/browser/user_metrics.h" 94 #include "content/browser/user_metrics.h"
95 #include "content/common/pepper_plugin_registry.h"
95 #include "content/public/browser/notification_service.h" 96 #include "content/public/browser/notification_service.h"
96 #include "content/common/pepper_plugin_registry.h"
97 #include "content/public/browser/notification_types.h" 97 #include "content/public/browser/notification_types.h"
98 #include "googleurl/src/gurl.h" 98 #include "googleurl/src/gurl.h"
99 #include "net/base/registry_controlled_domain.h" 99 #include "net/base/registry_controlled_domain.h"
100 #include "webkit/database/database_tracker.h" 100 #include "webkit/database/database_tracker.h"
101 #include "webkit/database/database_util.h" 101 #include "webkit/database/database_util.h"
102 #include "webkit/plugins/npapi/plugin_list.h" 102 #include "webkit/plugins/npapi/plugin_list.h"
103 103
104 #if defined(OS_CHROMEOS) 104 #if defined(OS_CHROMEOS)
105 #include "chrome/browser/chromeos/cros/cros_library.h" 105 #include "chrome/browser/chromeos/cros/cros_library.h"
106 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h" 106 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h"
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 for (ExtensionPermissionMessages::iterator it = permissions.begin(); 1390 for (ExtensionPermissionMessages::iterator it = permissions.begin();
1391 it != permissions.end(); ++it) 1391 it != permissions.end(); ++it)
1392 counter->Add(it->id()); 1392 counter->Add(it->id());
1393 } 1393 }
1394 } 1394 }
1395 1395
1396 void ExtensionService::LoadInstalledExtension(const ExtensionInfo& info, 1396 void ExtensionService::LoadInstalledExtension(const ExtensionInfo& info,
1397 bool write_to_prefs) { 1397 bool write_to_prefs) {
1398 std::string error; 1398 std::string error;
1399 scoped_refptr<const Extension> extension(NULL); 1399 scoped_refptr<const Extension> extension(NULL);
1400 if (!extension_prefs_->IsExtensionAllowedByPolicy(info.extension_id)) { 1400
1401 // An explicit check against policy is required to behave correctly during
1402 // startup. This is because extensions that were previously OK might have
1403 // been blacklisted in policy while Chrome was not running.
1404 if (!extension_prefs_->IsExtensionAllowedByPolicy(info.extension_id,
1405 info.extension_location)) {
1401 error = errors::kDisabledByPolicy; 1406 error = errors::kDisabledByPolicy;
1402 } else if (info.extension_manifest.get()) { 1407 } else if (info.extension_manifest.get()) {
1403 extension = Extension::Create( 1408 extension = Extension::Create(
1404 info.extension_path, 1409 info.extension_path,
1405 info.extension_location, 1410 info.extension_location,
1406 *info.extension_manifest, 1411 *info.extension_manifest,
1407 GetExtensionCreateFlagsForInstalledExtension(&info), 1412 GetExtensionCreateFlagsForInstalledExtension(&info),
1408 &error); 1413 &error);
1409 } else { 1414 } else {
1410 error = errors::kManifestUnreadable; 1415 error = errors::kManifestUnreadable;
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 ExtensionUpdater* ExtensionService::updater() { 1689 ExtensionUpdater* ExtensionService::updater() {
1685 return updater_.get(); 1690 return updater_.get();
1686 } 1691 }
1687 1692
1688 void ExtensionService::CheckAdminBlacklist() { 1693 void ExtensionService::CheckAdminBlacklist() {
1689 std::vector<std::string> to_be_removed; 1694 std::vector<std::string> to_be_removed;
1690 // Loop through extensions list, unload installed extensions. 1695 // Loop through extensions list, unload installed extensions.
1691 for (ExtensionList::const_iterator iter = extensions_.begin(); 1696 for (ExtensionList::const_iterator iter = extensions_.begin();
1692 iter != extensions_.end(); ++iter) { 1697 iter != extensions_.end(); ++iter) {
1693 const Extension* extension = (*iter); 1698 const Extension* extension = (*iter);
1694 if (!extension_prefs_->IsExtensionAllowedByPolicy(extension->id())) 1699 if (!extension_prefs_->IsExtensionAllowedByPolicy(extension->id(),
1700 extension->location())) {
1695 to_be_removed.push_back(extension->id()); 1701 to_be_removed.push_back(extension->id());
1702 }
1696 } 1703 }
1697 1704
1698 // UnloadExtension will change the extensions_ list. So, we should 1705 // UnloadExtension will change the extensions_ list. So, we should
1699 // call it outside the iterator loop. 1706 // call it outside the iterator loop.
1700 for (unsigned int i = 0; i < to_be_removed.size(); ++i) 1707 for (unsigned int i = 0; i < to_be_removed.size(); ++i)
1701 UnloadExtension(to_be_removed[i], extension_misc::UNLOAD_REASON_DISABLE); 1708 UnloadExtension(to_be_removed[i], extension_misc::UNLOAD_REASON_DISABLE);
1702 } 1709 }
1703 1710
1704 void ExtensionService::CheckForUpdatesSoon() { 1711 void ExtensionService::CheckForUpdatesSoon() {
1705 if (updater()) { 1712 if (updater()) {
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after
3014 3021
3015 ExtensionService::NaClModuleInfoList::iterator 3022 ExtensionService::NaClModuleInfoList::iterator
3016 ExtensionService::FindNaClModule(const GURL& url) { 3023 ExtensionService::FindNaClModule(const GURL& url) {
3017 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 3024 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
3018 iter != nacl_module_list_.end(); ++iter) { 3025 iter != nacl_module_list_.end(); ++iter) {
3019 if (iter->url == url) 3026 if (iter->url == url)
3020 return iter; 3027 return iter;
3021 } 3028 }
3022 return nacl_module_list_.end(); 3029 return nacl_module_list_.end();
3023 } 3030 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_prefs.cc ('k') | chrome/browser/extensions/extension_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698