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 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 | 2002 |
2003 void ExtensionService::SetReadyAndNotifyListeners() { | 2003 void ExtensionService::SetReadyAndNotifyListeners() { |
2004 ready_ = true; | 2004 ready_ = true; |
2005 content::NotificationService::current()->Notify( | 2005 content::NotificationService::current()->Notify( |
2006 chrome::NOTIFICATION_EXTENSIONS_READY, | 2006 chrome::NOTIFICATION_EXTENSIONS_READY, |
2007 content::Source<Profile>(profile_), | 2007 content::Source<Profile>(profile_), |
2008 content::NotificationService::NoDetails()); | 2008 content::NotificationService::NoDetails()); |
2009 } | 2009 } |
2010 | 2010 |
2011 void ExtensionService::OnLoadedInstalledExtensions() { | 2011 void ExtensionService::OnLoadedInstalledExtensions() { |
2012 if (updater_.get()) | 2012 if (updater_) |
2013 updater_->Start(); | 2013 updater_->Start(); |
2014 | 2014 |
2015 OnBlacklistUpdated(); | 2015 OnBlacklistUpdated(); |
2016 | 2016 |
2017 SetReadyAndNotifyListeners(); | 2017 SetReadyAndNotifyListeners(); |
2018 } | 2018 } |
2019 | 2019 |
2020 void ExtensionService::AddExtension(const Extension* extension) { | 2020 void ExtensionService::AddExtension(const Extension* extension) { |
2021 // TODO(jstritar): We may be able to get rid of this branch by overriding the | 2021 // TODO(jstritar): We may be able to get rid of this branch by overriding the |
2022 // default extension state to DISABLED when the --disable-extensions flag | 2022 // default extension state to DISABLED when the --disable-extensions flag |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2101 AddExtension(extension); | 2101 AddExtension(extension); |
2102 } | 2102 } |
2103 | 2103 |
2104 void ExtensionService::InitializePermissions(const Extension* extension) { | 2104 void ExtensionService::InitializePermissions(const Extension* extension) { |
2105 // If the extension has used the optional permissions API, it will have a | 2105 // If the extension has used the optional permissions API, it will have a |
2106 // custom set of active permissions defined in the extension prefs. Here, | 2106 // custom set of active permissions defined in the extension prefs. Here, |
2107 // we update the extension's active permissions based on the prefs. | 2107 // we update the extension's active permissions based on the prefs. |
2108 scoped_refptr<PermissionSet> active_permissions = | 2108 scoped_refptr<PermissionSet> active_permissions = |
2109 extension_prefs()->GetActivePermissions(extension->id()); | 2109 extension_prefs()->GetActivePermissions(extension->id()); |
2110 | 2110 |
2111 if (active_permissions.get()) { | 2111 if (active_permissions) { |
2112 // We restrict the active permissions to be within the bounds defined in the | 2112 // We restrict the active permissions to be within the bounds defined in the |
2113 // extension's manifest. | 2113 // extension's manifest. |
2114 // a) active permissions must be a subset of optional + default permissions | 2114 // a) active permissions must be a subset of optional + default permissions |
2115 // b) active permissions must contains all default permissions | 2115 // b) active permissions must contains all default permissions |
2116 scoped_refptr<PermissionSet> total_permissions = | 2116 scoped_refptr<PermissionSet> total_permissions = |
2117 PermissionSet::CreateUnion( | 2117 PermissionSet::CreateUnion( |
2118 extension->required_permission_set(), | 2118 extension->required_permission_set(), |
2119 extension->optional_permission_set()); | 2119 extension->optional_permission_set()); |
2120 | 2120 |
2121 // Make sure the active permissions contain no more than optional + default. | 2121 // Make sure the active permissions contain no more than optional + default. |
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3084 } | 3084 } |
3085 | 3085 |
3086 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { | 3086 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { |
3087 update_observers_.AddObserver(observer); | 3087 update_observers_.AddObserver(observer); |
3088 } | 3088 } |
3089 | 3089 |
3090 void ExtensionService::RemoveUpdateObserver( | 3090 void ExtensionService::RemoveUpdateObserver( |
3091 extensions::UpdateObserver* observer) { | 3091 extensions::UpdateObserver* observer) { |
3092 update_observers_.RemoveObserver(observer); | 3092 update_observers_.RemoveObserver(observer); |
3093 } | 3093 } |
OLD | NEW |