OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 errors::kInvalidMatch, | 651 errors::kInvalidMatch, |
652 base::IntToString(definition_index), | 652 base::IntToString(definition_index), |
653 base::IntToString(j), | 653 base::IntToString(j), |
654 URLPattern::GetParseResultString(parse_result)); | 654 URLPattern::GetParseResultString(parse_result)); |
655 return false; | 655 return false; |
656 } | 656 } |
657 | 657 |
658 if (pattern.MatchesScheme(chrome::kFileScheme) && | 658 if (pattern.MatchesScheme(chrome::kFileScheme) && |
659 !CanExecuteScriptEverywhere()) { | 659 !CanExecuteScriptEverywhere()) { |
660 wants_file_access_ = true; | 660 wants_file_access_ = true; |
661 if (!(creation_flags_ & ALLOW_FILE_ACCESS)) | 661 if (!(creation_flags_ & ALLOW_FILE_ACCESS)) { |
662 pattern.SetValidSchemes( | 662 pattern.SetValidSchemes( |
663 pattern.valid_schemes() & ~URLPattern::SCHEME_FILE); | 663 pattern.valid_schemes() & ~URLPattern::SCHEME_FILE); |
| 664 } |
664 } | 665 } |
665 | 666 |
666 result->add_url_pattern(pattern); | 667 result->add_url_pattern(pattern); |
667 } | 668 } |
668 | 669 |
669 // exclude_matches | 670 // exclude_matches |
670 if (content_script->HasKey(keys::kExcludeMatches)) { // optional | 671 if (content_script->HasKey(keys::kExcludeMatches)) { // optional |
671 const ListValue* exclude_matches = NULL; | 672 const ListValue* exclude_matches = NULL; |
672 if (!content_script->GetList(keys::kExcludeMatches, &exclude_matches)) { | 673 if (!content_script->GetList(keys::kExcludeMatches, &exclude_matches)) { |
673 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 674 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
(...skipping 2737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3411 return false; | 3412 return false; |
3412 } | 3413 } |
3413 | 3414 |
3414 // The path component is not used for host permissions, so we force it | 3415 // The path component is not used for host permissions, so we force it |
3415 // to match all paths. | 3416 // to match all paths. |
3416 pattern.SetPath("/*"); | 3417 pattern.SetPath("/*"); |
3417 | 3418 |
3418 if (pattern.MatchesScheme(chrome::kFileScheme) && | 3419 if (pattern.MatchesScheme(chrome::kFileScheme) && |
3419 !CanExecuteScriptEverywhere()) { | 3420 !CanExecuteScriptEverywhere()) { |
3420 wants_file_access_ = true; | 3421 wants_file_access_ = true; |
3421 if (!(creation_flags_ & ALLOW_FILE_ACCESS)) | 3422 if (!(creation_flags_ & ALLOW_FILE_ACCESS)) { |
3422 pattern.SetValidSchemes( | 3423 pattern.SetValidSchemes( |
3423 pattern.valid_schemes() & ~URLPattern::SCHEME_FILE); | 3424 pattern.valid_schemes() & ~URLPattern::SCHEME_FILE); |
| 3425 } |
3424 } | 3426 } |
3425 | 3427 |
3426 host_permissions->AddPattern(pattern); | 3428 host_permissions->AddPattern(pattern); |
3427 continue; | 3429 continue; |
3428 } | 3430 } |
3429 | 3431 |
3430 // It's probably an unknown API permission. Do not throw an error so | 3432 // It's probably an unknown API permission. Do not throw an error so |
3431 // extensions can retain backwards compatability (http://crbug.com/42742). | 3433 // extensions can retain backwards compatability (http://crbug.com/42742). |
3432 install_warnings_.push_back(InstallWarning( | 3434 install_warnings_.push_back(InstallWarning( |
3433 InstallWarning::FORMAT_TEXT, | 3435 InstallWarning::FORMAT_TEXT, |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3915 | 3917 |
3916 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3918 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
3917 const Extension* extension, | 3919 const Extension* extension, |
3918 const PermissionSet* permissions, | 3920 const PermissionSet* permissions, |
3919 Reason reason) | 3921 Reason reason) |
3920 : reason(reason), | 3922 : reason(reason), |
3921 extension(extension), | 3923 extension(extension), |
3922 permissions(permissions) {} | 3924 permissions(permissions) {} |
3923 | 3925 |
3924 } // namespace extensions | 3926 } // namespace extensions |
OLD | NEW |