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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
504 } | 504 } |
505 | 505 |
506 bool can_access = false; | 506 bool can_access = false; |
507 | 507 |
508 if (script) { | 508 if (script) { |
509 // If a script is specified, use its matches. | 509 // If a script is specified, use its matches. |
510 can_access = script->MatchesURL(document_url); | 510 can_access = script->MatchesURL(document_url); |
511 } else { | 511 } else { |
512 // Otherwise, see if this extension has permission to execute script | 512 // Otherwise, see if this extension has permission to execute script |
513 // programmatically on pages. | 513 // programmatically on pages. |
514 can_access = GetActivePermissions(extension)-> | 514 can_access = |
515 HasExplicitAccessToOrigin(document_url); | 515 GetActivePermissions(extension)->HasEffectiveAccessToURL(document_url); |
not at google - send to devlin
2014/05/01 20:32:19
why do you need this change? there isn't a script,
robwu
2014/05/01 21:30:38
The change is not needed any more, so I've reverte
not at google - send to devlin
2014/05/02 16:01:48
Understood. We try to keep the permissions as narr
| |
516 } | 516 } |
517 | 517 |
518 if (!can_access && error) { | 518 if (!can_access && error) { |
519 *error = ErrorUtils::FormatErrorMessage(errors::kCannotAccessPage, | 519 *error = ErrorUtils::FormatErrorMessage(errors::kCannotAccessPage, |
520 document_url.spec()); | 520 document_url.spec()); |
521 } | 521 } |
522 | 522 |
523 return can_access; | 523 return can_access; |
524 } | 524 } |
525 | 525 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
608 initial_optional_permissions_->api_permissions, | 608 initial_optional_permissions_->api_permissions, |
609 initial_optional_permissions_->manifest_permissions, | 609 initial_optional_permissions_->manifest_permissions, |
610 initial_optional_permissions_->host_permissions, | 610 initial_optional_permissions_->host_permissions, |
611 URLPatternSet()); | 611 URLPatternSet()); |
612 | 612 |
613 initial_required_permissions_.reset(); | 613 initial_required_permissions_.reset(); |
614 initial_optional_permissions_.reset(); | 614 initial_optional_permissions_.reset(); |
615 } | 615 } |
616 | 616 |
617 } // namespace extensions | 617 } // namespace extensions |
OLD | NEW |