| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
| 6 #include "chrome/common/extensions/permissions/api_permission_set.h" | 6 #include "chrome/common/extensions/permissions/api_permission_set.h" |
| 7 #include "chrome/common/extensions/permissions/chrome_scheme_hosts.h" | 7 #include "chrome/common/extensions/permissions/chrome_scheme_hosts.h" |
| 8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
| 9 #include "extensions/common/url_pattern.h" | 9 #include "extensions/common/url_pattern.h" |
| 10 #include "extensions/common/url_pattern_set.h" | 10 #include "extensions/common/url_pattern_set.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 i != hosts.end(); ++i) { | 24 i != hosts.end(); ++i) { |
| 25 if (i->scheme() != chrome::kChromeUIScheme) | 25 if (i->scheme() != chrome::kChromeUIScheme) |
| 26 continue; | 26 continue; |
| 27 // chrome://favicon is the only URL for chrome:// scheme that we | 27 // chrome://favicon is the only URL for chrome:// scheme that we |
| 28 // want to support. We want to deprecate the "chrome" scheme. | 28 // want to support. We want to deprecate the "chrome" scheme. |
| 29 // We should not add any additional "host" here. | 29 // We should not add any additional "host" here. |
| 30 if (GURL(chrome::kChromeUIFaviconURL).host() != i->host()) | 30 if (GURL(chrome::kChromeUIFaviconURL).host() != i->host()) |
| 31 continue; | 31 continue; |
| 32 messages.push_back(PermissionMessage( | 32 messages.push_back(PermissionMessage( |
| 33 PermissionMessage::kFavicon, | 33 PermissionMessage::kFavicon, |
| 34 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_FAVICON))); | 34 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_FAVICON), |
| 35 string16())); |
| 35 break; | 36 break; |
| 36 } | 37 } |
| 37 return messages; | 38 return messages; |
| 38 } | 39 } |
| 39 | 40 |
| 40 URLPatternSet GetPermittedChromeSchemeHosts( | 41 URLPatternSet GetPermittedChromeSchemeHosts( |
| 41 const Extension* extension, | 42 const Extension* extension, |
| 42 const APIPermissionSet& api_permissions) { | 43 const APIPermissionSet& api_permissions) { |
| 43 URLPatternSet hosts; | 44 URLPatternSet hosts; |
| 44 // Regular extensions are only allowed access to chrome://favicon. | 45 // Regular extensions are only allowed access to chrome://favicon. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 55 api_permissions.end()) || | 56 api_permissions.end()) || |
| 56 (extension->id() == kThumbsWhiteListedExtension && | 57 (extension->id() == kThumbsWhiteListedExtension && |
| 57 extension->from_webstore())) { | 58 extension->from_webstore())) { |
| 58 hosts.AddPattern(URLPattern(URLPattern::SCHEME_CHROMEUI, | 59 hosts.AddPattern(URLPattern(URLPattern::SCHEME_CHROMEUI, |
| 59 chrome::kChromeUIThumbnailURL)); | 60 chrome::kChromeUIThumbnailURL)); |
| 60 } | 61 } |
| 61 return hosts; | 62 return hosts; |
| 62 } | 63 } |
| 63 | 64 |
| 64 } // namespace extensions | 65 } // namespace extensions |
| OLD | NEW |