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 "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 Loading... |
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->ShouldDisplayInExtensionSettings() && |
| 570 !Manifest::IsPolicyLocation(extension->location()) && |
| 571 !Manifest::IsComponentLocation(extension->location()) && |
| 572 HasEffectiveAccessToAllHosts(extension); |
569 } | 573 } |
570 | 574 |
571 bool PermissionsData::ParsePermissions(Extension* extension, | 575 bool PermissionsData::ParsePermissions(Extension* extension, |
572 base::string16* error) { | 576 base::string16* error) { |
573 initial_required_permissions_.reset(new InitialPermissions); | 577 initial_required_permissions_.reset(new InitialPermissions); |
574 if (!ParseHelper(extension, | 578 if (!ParseHelper(extension, |
575 keys::kPermissions, | 579 keys::kPermissions, |
576 &initial_required_permissions_->api_permissions, | 580 &initial_required_permissions_->api_permissions, |
577 &initial_required_permissions_->host_permissions, | 581 &initial_required_permissions_->host_permissions, |
578 error)) { | 582 error)) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 initial_optional_permissions_->api_permissions, | 617 initial_optional_permissions_->api_permissions, |
614 initial_optional_permissions_->manifest_permissions, | 618 initial_optional_permissions_->manifest_permissions, |
615 initial_optional_permissions_->host_permissions, | 619 initial_optional_permissions_->host_permissions, |
616 URLPatternSet()); | 620 URLPatternSet()); |
617 | 621 |
618 initial_required_permissions_.reset(); | 622 initial_required_permissions_.reset(); |
619 initial_optional_permissions_.reset(); | 623 initial_optional_permissions_.reset(); |
620 } | 624 } |
621 | 625 |
622 } // namespace extensions | 626 } // namespace extensions |
OLD | NEW |