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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. Exceptions for policy- | 567 // permission tries to execute a script on a page. Exceptions for policy- |
568 // enabled and component extensions. | 568 // enabled and component extensions, and extensions which are whitelisted to |
| 569 // execute scripts everywhere. |
569 return extension->ShouldDisplayInExtensionSettings() && | 570 return extension->ShouldDisplayInExtensionSettings() && |
570 !Manifest::IsPolicyLocation(extension->location()) && | 571 !Manifest::IsPolicyLocation(extension->location()) && |
571 !Manifest::IsComponentLocation(extension->location()) && | 572 !Manifest::IsComponentLocation(extension->location()) && |
| 573 !CanExecuteScriptEverywhere(extension) && |
572 HasEffectiveAccessToAllHosts(extension); | 574 HasEffectiveAccessToAllHosts(extension); |
573 } | 575 } |
574 | 576 |
575 bool PermissionsData::ParsePermissions(Extension* extension, | 577 bool PermissionsData::ParsePermissions(Extension* extension, |
576 base::string16* error) { | 578 base::string16* error) { |
577 initial_required_permissions_.reset(new InitialPermissions); | 579 initial_required_permissions_.reset(new InitialPermissions); |
578 if (!ParseHelper(extension, | 580 if (!ParseHelper(extension, |
579 keys::kPermissions, | 581 keys::kPermissions, |
580 &initial_required_permissions_->api_permissions, | 582 &initial_required_permissions_->api_permissions, |
581 &initial_required_permissions_->host_permissions, | 583 &initial_required_permissions_->host_permissions, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 initial_optional_permissions_->api_permissions, | 619 initial_optional_permissions_->api_permissions, |
618 initial_optional_permissions_->manifest_permissions, | 620 initial_optional_permissions_->manifest_permissions, |
619 initial_optional_permissions_->host_permissions, | 621 initial_optional_permissions_->host_permissions, |
620 URLPatternSet()); | 622 URLPatternSet()); |
621 | 623 |
622 initial_required_permissions_.reset(); | 624 initial_required_permissions_.reset(); |
623 initial_optional_permissions_.reset(); | 625 initial_optional_permissions_.reset(); |
624 } | 626 } |
625 | 627 |
626 } // namespace extensions | 628 } // namespace extensions |
OLD | NEW |