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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 #include "content/public/browser/notification_service.h" | 91 #include "content/public/browser/notification_service.h" |
92 #include "content/public/browser/notification_types.h" | 92 #include "content/public/browser/notification_types.h" |
93 #include "content/public/browser/render_process_host.h" | 93 #include "content/public/browser/render_process_host.h" |
94 #include "content/public/browser/site_instance.h" | 94 #include "content/public/browser/site_instance.h" |
95 #include "content/public/browser/storage_partition.h" | 95 #include "content/public/browser/storage_partition.h" |
96 #include "content/public/browser/url_data_source.h" | 96 #include "content/public/browser/url_data_source.h" |
97 #include "extensions/common/constants.h" | 97 #include "extensions/common/constants.h" |
98 #include "extensions/common/error_utils.h" | 98 #include "extensions/common/error_utils.h" |
99 #include "extensions/common/manifest.h" | 99 #include "extensions/common/manifest.h" |
100 #include "extensions/common/manifest_constants.h" | 100 #include "extensions/common/manifest_constants.h" |
| 101 #include "extensions/common/permissions/permission_message_provider.h" |
101 #include "grit/generated_resources.h" | 102 #include "grit/generated_resources.h" |
102 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 103 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
103 #include "sync/api/sync_change.h" | 104 #include "sync/api/sync_change.h" |
104 #include "sync/api/sync_error_factory.h" | 105 #include "sync/api/sync_error_factory.h" |
105 #include "ui/webui/web_ui_util.h" | 106 #include "ui/webui/web_ui_util.h" |
106 #include "url/gurl.h" | 107 #include "url/gurl.h" |
107 #include "webkit/browser/database/database_tracker.h" | 108 #include "webkit/browser/database/database_tracker.h" |
108 #include "webkit/browser/database/database_util.h" | 109 #include "webkit/browser/database/database_util.h" |
109 | 110 |
110 #if defined(OS_CHROMEOS) | 111 #if defined(OS_CHROMEOS) |
(...skipping 2197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2308 // Add all the recognized permissions if the granted permissions list | 2309 // Add all the recognized permissions if the granted permissions list |
2309 // hasn't been initialized yet. | 2310 // hasn't been initialized yet. |
2310 scoped_refptr<PermissionSet> granted_permissions = | 2311 scoped_refptr<PermissionSet> granted_permissions = |
2311 extension_prefs_->GetGrantedPermissions(extension->id()); | 2312 extension_prefs_->GetGrantedPermissions(extension->id()); |
2312 CHECK(granted_permissions.get()); | 2313 CHECK(granted_permissions.get()); |
2313 | 2314 |
2314 // Here, we check if an extension's privileges have increased in a manner | 2315 // Here, we check if an extension's privileges have increased in a manner |
2315 // that requires the user's approval. This could occur because the browser | 2316 // that requires the user's approval. This could occur because the browser |
2316 // upgraded and recognized additional privileges, or an extension upgrades | 2317 // upgraded and recognized additional privileges, or an extension upgrades |
2317 // to a version that requires additional privileges. | 2318 // to a version that requires additional privileges. |
2318 is_privilege_increase = granted_permissions->HasLessPrivilegesThan( | 2319 is_privilege_increase = |
2319 extension->GetActivePermissions().get(), extension->GetType()); | 2320 extensions::PermissionMessageProvider::Get()->IsPrivilegeIncrease( |
| 2321 granted_permissions, |
| 2322 extension->GetActivePermissions().get(), |
| 2323 extension->GetType()); |
2320 } | 2324 } |
2321 | 2325 |
2322 if (is_extension_installed) { | 2326 if (is_extension_installed) { |
2323 // If the extension was already disabled, suppress any alerts for becoming | 2327 // If the extension was already disabled, suppress any alerts for becoming |
2324 // disabled on permissions increase. | 2328 // disabled on permissions increase. |
2325 bool previously_disabled = | 2329 bool previously_disabled = |
2326 extension_prefs_->IsExtensionDisabled(extension->id()); | 2330 extension_prefs_->IsExtensionDisabled(extension->id()); |
2327 // Legacy disabled extensions do not have a disable reason. Infer that if | 2331 // Legacy disabled extensions do not have a disable reason. Infer that if |
2328 // there was no permission increase, it was likely disabled by the user. | 2332 // there was no permission increase, it was likely disabled by the user. |
2329 if (previously_disabled && disable_reasons == Extension::DISABLE_NONE && | 2333 if (previously_disabled && disable_reasons == Extension::DISABLE_NONE && |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3214 } | 3218 } |
3215 | 3219 |
3216 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { | 3220 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { |
3217 update_observers_.AddObserver(observer); | 3221 update_observers_.AddObserver(observer); |
3218 } | 3222 } |
3219 | 3223 |
3220 void ExtensionService::RemoveUpdateObserver( | 3224 void ExtensionService::RemoveUpdateObserver( |
3221 extensions::UpdateObserver* observer) { | 3225 extensions::UpdateObserver* observer) { |
3222 update_observers_.RemoveObserver(observer); | 3226 update_observers_.RemoveObserver(observer); |
3223 } | 3227 } |
OLD | NEW |