OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 ExtensionResource* resource, Icons icon) { | 1697 ExtensionResource* resource, Icons icon) { |
1698 std::string path; | 1698 std::string path; |
1699 Extension::Icons ret = GetIconPathAllowLargerSize(&path, icon); | 1699 Extension::Icons ret = GetIconPathAllowLargerSize(&path, icon); |
1700 if (path.empty()) | 1700 if (path.empty()) |
1701 *resource = ExtensionResource(); | 1701 *resource = ExtensionResource(); |
1702 else | 1702 else |
1703 *resource = GetResource(path); | 1703 *resource = GetResource(path); |
1704 return ret; | 1704 return ret; |
1705 } | 1705 } |
1706 | 1706 |
1707 GURL Extension::GetIconUrlAllowLargerSize(Icons icon) { | 1707 GURL Extension::GetIconURL(Icons icon) { |
| 1708 std::string path = GetIconPath(icon); |
| 1709 if (path.empty()) |
| 1710 return GURL(); |
| 1711 else |
| 1712 return GetResourceURL(path); |
| 1713 } |
| 1714 |
| 1715 GURL Extension::GetIconURLAllowLargerSize(Icons icon) { |
1708 std::string path; | 1716 std::string path; |
1709 GetIconPathAllowLargerSize(&path, icon); | 1717 GetIconPathAllowLargerSize(&path, icon); |
1710 return GetResourceURL(path); | 1718 return GetResourceURL(path); |
1711 } | 1719 } |
1712 | 1720 |
1713 bool Extension::CanAccessURL(const URLPattern pattern) const { | 1721 bool Extension::CanAccessURL(const URLPattern pattern) const { |
1714 if (pattern.MatchesScheme(chrome::kChromeUIScheme)) { | 1722 if (pattern.MatchesScheme(chrome::kChromeUIScheme)) { |
1715 // Only allow access to chrome://favicon to regular extensions. Component | 1723 // Only allow access to chrome://favicon to regular extensions. Component |
1716 // extensions can have access to all of chrome://*. | 1724 // extensions can have access to all of chrome://*. |
1717 return (pattern.host() == chrome::kChromeUIFavIconHost || | 1725 return (pattern.host() == chrome::kChromeUIFavIconHost || |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1802 : extension_id(id), | 1810 : extension_id(id), |
1803 extension_path(path), | 1811 extension_path(path), |
1804 extension_location(location) { | 1812 extension_location(location) { |
1805 if (manifest) | 1813 if (manifest) |
1806 extension_manifest.reset( | 1814 extension_manifest.reset( |
1807 static_cast<DictionaryValue*>(manifest->DeepCopy())); | 1815 static_cast<DictionaryValue*>(manifest->DeepCopy())); |
1808 } | 1816 } |
1809 | 1817 |
1810 ExtensionInfo::~ExtensionInfo() { | 1818 ExtensionInfo::~ExtensionInfo() { |
1811 } | 1819 } |
OLD | NEW |