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

Side by Side Diff: extensions/common/permissions/permissions_data.cc

Issue 2821123002: Differentiate new permissions from old in extension permission update bubble (Closed)
Patch Set: Created 3 years, 8 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
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 "extensions/common/permissions/permissions_data.h" 5 #include "extensions/common/permissions/permissions_data.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 return active_permissions_unsafe_->HasEffectiveAccessToAllHosts(); 216 return active_permissions_unsafe_->HasEffectiveAccessToAllHosts();
217 } 217 }
218 218
219 PermissionMessages PermissionsData::GetPermissionMessages() const { 219 PermissionMessages PermissionsData::GetPermissionMessages() const {
220 base::AutoLock auto_lock(runtime_lock_); 220 base::AutoLock auto_lock(runtime_lock_);
221 return PermissionMessageProvider::Get()->GetPermissionMessages( 221 return PermissionMessageProvider::Get()->GetPermissionMessages(
222 PermissionMessageProvider::Get()->GetAllPermissionIDs( 222 PermissionMessageProvider::Get()->GetAllPermissionIDs(
223 *active_permissions_unsafe_, manifest_type_)); 223 *active_permissions_unsafe_, manifest_type_));
224 } 224 }
225 225
226 PermissionMessages PermissionsData::GetNewPermissionMessages(
227 const PermissionSet& granted_permissions) const {
228 base::AutoLock auto_lock(runtime_lock_);
229
230 std::unique_ptr<const PermissionSet> new_permissions =
231 PermissionSet::CreateDifference(*active_permissions_unsafe_,
232 granted_permissions);
233
234 return PermissionMessageProvider::Get()->GetPermissionMessages(
235 PermissionMessageProvider::Get()->GetAllPermissionIDs(*new_permissions,
236 manifest_type_));
237 }
238
226 bool PermissionsData::HasWithheldImpliedAllHosts() const { 239 bool PermissionsData::HasWithheldImpliedAllHosts() const {
227 base::AutoLock auto_lock(runtime_lock_); 240 base::AutoLock auto_lock(runtime_lock_);
228 // Since we currently only withhold all_hosts, it's sufficient to check 241 // Since we currently only withhold all_hosts, it's sufficient to check
229 // that either set is not empty. 242 // that either set is not empty.
230 return !withheld_permissions_unsafe_->explicit_hosts().is_empty() || 243 return !withheld_permissions_unsafe_->explicit_hosts().is_empty() ||
231 !withheld_permissions_unsafe_->scriptable_hosts().is_empty(); 244 !withheld_permissions_unsafe_->scriptable_hosts().is_empty();
232 } 245 }
233 246
234 bool PermissionsData::CanAccessPage(const Extension* extension, 247 bool PermissionsData::CanAccessPage(const Extension* extension,
235 const GURL& document_url, 248 const GURL& document_url,
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 manifest_errors::kCannotAccessPageWithUrl, document_url.spec()); 373 manifest_errors::kCannotAccessPageWithUrl, document_url.spec());
361 } else { 374 } else {
362 *error = manifest_errors::kCannotAccessPage; 375 *error = manifest_errors::kCannotAccessPage;
363 } 376 }
364 } 377 }
365 378
366 return ACCESS_DENIED; 379 return ACCESS_DENIED;
367 } 380 }
368 381
369 } // namespace extensions 382 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698