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

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

Issue 27446002: Move permission warning message handling from PermissionSet to PermissionMessageProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/extension_install_prompt.cc ('k') | chrome/chrome_common.gypi » ('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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 #include "content/public/browser/notification_service.h" 92 #include "content/public/browser/notification_service.h"
93 #include "content/public/browser/notification_types.h" 93 #include "content/public/browser/notification_types.h"
94 #include "content/public/browser/render_process_host.h" 94 #include "content/public/browser/render_process_host.h"
95 #include "content/public/browser/site_instance.h" 95 #include "content/public/browser/site_instance.h"
96 #include "content/public/browser/storage_partition.h" 96 #include "content/public/browser/storage_partition.h"
97 #include "content/public/browser/url_data_source.h" 97 #include "content/public/browser/url_data_source.h"
98 #include "extensions/common/constants.h" 98 #include "extensions/common/constants.h"
99 #include "extensions/common/error_utils.h" 99 #include "extensions/common/error_utils.h"
100 #include "extensions/common/manifest.h" 100 #include "extensions/common/manifest.h"
101 #include "extensions/common/manifest_constants.h" 101 #include "extensions/common/manifest_constants.h"
102 #include "extensions/common/permissions/permission_message_provider.h"
102 #include "grit/generated_resources.h" 103 #include "grit/generated_resources.h"
103 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 104 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
104 #include "sync/api/sync_change.h" 105 #include "sync/api/sync_change.h"
105 #include "sync/api/sync_error_factory.h" 106 #include "sync/api/sync_error_factory.h"
106 #include "ui/base/webui/web_ui_util.h" 107 #include "ui/base/webui/web_ui_util.h"
107 #include "url/gurl.h" 108 #include "url/gurl.h"
108 #include "webkit/browser/database/database_tracker.h" 109 #include "webkit/browser/database/database_tracker.h"
109 #include "webkit/browser/database/database_util.h" 110 #include "webkit/browser/database/database_util.h"
110 111
111 #if defined(OS_CHROMEOS) 112 #if defined(OS_CHROMEOS)
(...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after
2207 // Add all the recognized permissions if the granted permissions list 2208 // Add all the recognized permissions if the granted permissions list
2208 // hasn't been initialized yet. 2209 // hasn't been initialized yet.
2209 scoped_refptr<PermissionSet> granted_permissions = 2210 scoped_refptr<PermissionSet> granted_permissions =
2210 extension_prefs_->GetGrantedPermissions(extension->id()); 2211 extension_prefs_->GetGrantedPermissions(extension->id());
2211 CHECK(granted_permissions.get()); 2212 CHECK(granted_permissions.get());
2212 2213
2213 // Here, we check if an extension's privileges have increased in a manner 2214 // Here, we check if an extension's privileges have increased in a manner
2214 // that requires the user's approval. This could occur because the browser 2215 // that requires the user's approval. This could occur because the browser
2215 // upgraded and recognized additional privileges, or an extension upgrades 2216 // upgraded and recognized additional privileges, or an extension upgrades
2216 // to a version that requires additional privileges. 2217 // to a version that requires additional privileges.
2217 is_privilege_increase = granted_permissions->HasLessPrivilegesThan( 2218 is_privilege_increase =
2218 extension->GetActivePermissions().get(), extension->GetType()); 2219 extensions::PermissionMessageProvider::Get()->IsPrivilegeIncrease(
2220 granted_permissions,
2221 extension->GetActivePermissions().get(),
2222 extension->GetType());
2219 } 2223 }
2220 2224
2221 if (is_extension_installed) { 2225 if (is_extension_installed) {
2222 // If the extension was already disabled, suppress any alerts for becoming 2226 // If the extension was already disabled, suppress any alerts for becoming
2223 // disabled on permissions increase. 2227 // disabled on permissions increase.
2224 bool previously_disabled = 2228 bool previously_disabled =
2225 extension_prefs_->IsExtensionDisabled(extension->id()); 2229 extension_prefs_->IsExtensionDisabled(extension->id());
2226 // Legacy disabled extensions do not have a disable reason. Infer that if 2230 // Legacy disabled extensions do not have a disable reason. Infer that if
2227 // there was no permission increase, it was likely disabled by the user. 2231 // there was no permission increase, it was likely disabled by the user.
2228 if (previously_disabled && disable_reasons == Extension::DISABLE_NONE && 2232 if (previously_disabled && disable_reasons == Extension::DISABLE_NONE &&
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
3125 } 3129 }
3126 3130
3127 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { 3131 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) {
3128 update_observers_.AddObserver(observer); 3132 update_observers_.AddObserver(observer);
3129 } 3133 }
3130 3134
3131 void ExtensionService::RemoveUpdateObserver( 3135 void ExtensionService::RemoveUpdateObserver(
3132 extensions::UpdateObserver* observer) { 3136 extensions::UpdateObserver* observer) {
3133 update_observers_.RemoveObserver(observer); 3137 update_observers_.RemoveObserver(observer);
3134 } 3138 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_install_prompt.cc ('k') | chrome/chrome_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698