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

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

Issue 288453002: Don't require user action for active scripts for component or policy exts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « no previous file | no next file » | 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 "extensions/common/permissions/permissions_data.h" 5 #include "extensions/common/permissions/permissions_data.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 557
558 if (error) 558 if (error)
559 *error = errors::kAllURLOrActiveTabNeeded; 559 *error = errors::kAllURLOrActiveTabNeeded;
560 return false; 560 return false;
561 } 561 }
562 562
563 // static 563 // static
564 bool PermissionsData::RequiresActionForScriptExecution( 564 bool PermissionsData::RequiresActionForScriptExecution(
565 const Extension* extension) { 565 const Extension* extension) {
566 // For now, the user should be notified when an extension with all hosts 566 // For now, the user should be notified when an extension with all hosts
567 // permission tries to execute a script on a page. 567 // permission tries to execute a script on a page. Exceptions for policy-
568 return HasEffectiveAccessToAllHosts(extension); 568 // enabled and component extensions.
569 return extension->location() != Manifest::EXTERNAL_POLICY_DOWNLOAD &&
Devlin 2014/05/12 23:05:09 Should we also do Manifest::IsUnpackedLocation() h
not at google - send to devlin 2014/05/13 00:00:16 I was wondering the same thing before -- and I thi
570 extension->location() != Manifest::EXTERNAL_POLICY &&
571 extension->location() != Manifest::COMPONENT &&
572 extension->location() != Manifest::EXTERNAL_COMPONENT &&
not at google - send to devlin 2014/05/13 00:00:16 At a higher level this: - shouldn't include extens
Devlin 2014/05/13 17:03:03 Are there any policy ones, other than EXTERNAL_POL
573 HasEffectiveAccessToAllHosts(extension);
569 } 574 }
570 575
571 bool PermissionsData::ParsePermissions(Extension* extension, 576 bool PermissionsData::ParsePermissions(Extension* extension,
572 base::string16* error) { 577 base::string16* error) {
573 initial_required_permissions_.reset(new InitialPermissions); 578 initial_required_permissions_.reset(new InitialPermissions);
574 if (!ParseHelper(extension, 579 if (!ParseHelper(extension,
575 keys::kPermissions, 580 keys::kPermissions,
576 &initial_required_permissions_->api_permissions, 581 &initial_required_permissions_->api_permissions,
577 &initial_required_permissions_->host_permissions, 582 &initial_required_permissions_->host_permissions,
578 error)) { 583 error)) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 initial_optional_permissions_->api_permissions, 618 initial_optional_permissions_->api_permissions,
614 initial_optional_permissions_->manifest_permissions, 619 initial_optional_permissions_->manifest_permissions,
615 initial_optional_permissions_->host_permissions, 620 initial_optional_permissions_->host_permissions,
616 URLPatternSet()); 621 URLPatternSet());
617 622
618 initial_required_permissions_.reset(); 623 initial_required_permissions_.reset();
619 initial_optional_permissions_.reset(); 624 initial_optional_permissions_.reset();
620 } 625 }
621 626
622 } // namespace extensions 627 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698