| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 2641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2652 // validation of API permissions here. | 2652 // validation of API permissions here. |
| 2653 // TODO(skerner): Consider showing the reason |permission_str| is not | 2653 // TODO(skerner): Consider showing the reason |permission_str| is not |
| 2654 // a valid URL pattern if it is almost valid. For example, if it has | 2654 // a valid URL pattern if it is almost valid. For example, if it has |
| 2655 // a valid scheme, and failed to parse because it has a port, show an | 2655 // a valid scheme, and failed to parse because it has a port, show an |
| 2656 // error. | 2656 // error. |
| 2657 } | 2657 } |
| 2658 } | 2658 } |
| 2659 return true; | 2659 return true; |
| 2660 } | 2660 } |
| 2661 | 2661 |
| 2662 bool Extension::CanSilentlyIncreasePermissions() const { | 2662 bool Extension::CanSilentlyIncreasePermissionsDuringInstall() const { |
| 2663 if (location() == LOAD && !plugins().empty()) |
| 2664 return false; |
| 2663 return location() != INTERNAL; | 2665 return location() != INTERNAL; |
| 2664 } | 2666 } |
| 2665 | 2667 |
| 2668 bool Extension::CanSilentlyIncreasePermissionsWhileRunning() const { |
| 2669 return location() != INTERNAL && location() != LOAD; |
| 2670 } |
| 2671 |
| 2666 bool Extension::CanSpecifyHostPermission(const URLPattern& pattern, | 2672 bool Extension::CanSpecifyHostPermission(const URLPattern& pattern, |
| 2667 const ExtensionAPIPermissionSet& permissions) const { | 2673 const ExtensionAPIPermissionSet& permissions) const { |
| 2668 if (!pattern.match_all_urls() && | 2674 if (!pattern.match_all_urls() && |
| 2669 pattern.MatchesScheme(chrome::kChromeUIScheme)) { | 2675 pattern.MatchesScheme(chrome::kChromeUIScheme)) { |
| 2670 // Regular extensions are only allowed access to chrome://favicon. | 2676 // Regular extensions are only allowed access to chrome://favicon. |
| 2671 if (pattern.host() == chrome::kChromeUIFaviconHost) | 2677 if (pattern.host() == chrome::kChromeUIFaviconHost) |
| 2672 return true; | 2678 return true; |
| 2673 | 2679 |
| 2674 // Experimental extensions are also allowed chrome://thumb. | 2680 // Experimental extensions are also allowed chrome://thumb. |
| 2675 if (pattern.host() == chrome::kChromeUIThumbnailHost) { | 2681 if (pattern.host() == chrome::kChromeUIThumbnailHost) { |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3042 already_disabled(false), | 3048 already_disabled(false), |
| 3043 extension(extension) {} | 3049 extension(extension) {} |
| 3044 | 3050 |
| 3045 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3051 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
| 3046 const Extension* extension, | 3052 const Extension* extension, |
| 3047 const ExtensionPermissionSet* permissions, | 3053 const ExtensionPermissionSet* permissions, |
| 3048 Reason reason) | 3054 Reason reason) |
| 3049 : reason(reason), | 3055 : reason(reason), |
| 3050 extension(extension), | 3056 extension(extension), |
| 3051 permissions(permissions) {} | 3057 permissions(permissions) {} |
| OLD | NEW |