| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 // We keep a cache of images loaded from extension resources based on their | 537 // We keep a cache of images loaded from extension resources based on their |
| 538 // path and a string representation of a size that may have been used to | 538 // path and a string representation of a size that may have been used to |
| 539 // scale it (or the empty string if the image is at its original size). | 539 // scale it (or the empty string if the image is at its original size). |
| 540 typedef std::pair<FilePath, std::string> ImageCacheKey; | 540 typedef std::pair<FilePath, std::string> ImageCacheKey; |
| 541 typedef std::map<ImageCacheKey, SkBitmap> ImageCache; | 541 typedef std::map<ImageCacheKey, SkBitmap> ImageCache; |
| 542 | 542 |
| 543 // Normalize the path for use by the extension. On Windows, this will make | 543 // Normalize the path for use by the extension. On Windows, this will make |
| 544 // sure the drive letter is uppercase. | 544 // sure the drive letter is uppercase. |
| 545 static FilePath MaybeNormalizePath(const FilePath& path); | 545 static FilePath MaybeNormalizePath(const FilePath& path); |
| 546 | 546 |
| 547 // Returns the distinct hosts that can be displayed in the install UI or be | |
| 548 // used for privilege comparisons. This discards some of the detail that is | |
| 549 // present in the manifest to make it as easy as possible to process by users. | |
| 550 // In particular we disregard the scheme and path components of URLPatterns | |
| 551 // and de-dupe the result, which includes filtering out common hosts with | |
| 552 // differing RCDs. If |include_rcd| is true, then the de-duped result | |
| 553 // will be the first full entry, including its RCD. So if the list was | |
| 554 // "*.google.co.uk" and "*.google.com", the returned value would just be | |
| 555 // "*.google.co.uk". Keeping the RCD in the result is useful for display | |
| 556 // purposes when you want to show the user one sample hostname from the list. | |
| 557 // If you need to compare two URLPatternLists for security equality, then set | |
| 558 // |include_rcd| to false, which will return a result like "*.google.", | |
| 559 // regardless of the order of the patterns. | |
| 560 static std::vector<std::string> GetDistinctHosts( | |
| 561 const URLPatternList& host_patterns, bool include_rcd); | |
| 562 | |
| 563 // Returns true if this extension id is from a trusted provider. | 547 // Returns true if this extension id is from a trusted provider. |
| 564 static bool IsTrustedId(const std::string& id); | 548 static bool IsTrustedId(const std::string& id); |
| 565 | 549 |
| 566 Extension(const FilePath& path, Location location); | 550 Extension(const FilePath& path, Location location); |
| 567 ~Extension(); | 551 ~Extension(); |
| 568 | 552 |
| 569 // Initialize the extension from a parsed manifest. | 553 // Initialize the extension from a parsed manifest. |
| 570 bool InitFromValue(const base::DictionaryValue& value, int flags, | 554 bool InitFromValue(const base::DictionaryValue& value, int flags, |
| 571 std::string* error); | 555 std::string* error); |
| 572 | 556 |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 // Was the extension already disabled? | 846 // Was the extension already disabled? |
| 863 bool already_disabled; | 847 bool already_disabled; |
| 864 | 848 |
| 865 // The extension being unloaded - this should always be non-NULL. | 849 // The extension being unloaded - this should always be non-NULL. |
| 866 const Extension* extension; | 850 const Extension* extension; |
| 867 | 851 |
| 868 UnloadedExtensionInfo(const Extension* extension, Reason reason); | 852 UnloadedExtensionInfo(const Extension* extension, Reason reason); |
| 869 }; | 853 }; |
| 870 | 854 |
| 871 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 855 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |