| 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_SET_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_SET_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_SET_H_ | 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_SET_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // Returns true if the set contains the specified extension. | 36 // Returns true if the set contains the specified extension. |
| 37 bool Contains(const std::string& id) const; | 37 bool Contains(const std::string& id) const; |
| 38 | 38 |
| 39 // Adds the specified extension to the set. The set becomes an owner. Any | 39 // Adds the specified extension to the set. The set becomes an owner. Any |
| 40 // previous extension with the same ID is removed. | 40 // previous extension with the same ID is removed. |
| 41 void Insert(const scoped_refptr<const Extension>& extension); | 41 void Insert(const scoped_refptr<const Extension>& extension); |
| 42 | 42 |
| 43 // Removes the specified extension. | 43 // Removes the specified extension. |
| 44 void Remove(const std::string& id); | 44 void Remove(const std::string& id); |
| 45 | 45 |
| 46 // Empties the set. |
| 47 void Clear(); |
| 48 |
| 46 // Returns the extension ID that the given URL is a part of, or empty if | 49 // Returns the extension ID that the given URL is a part of, or empty if |
| 47 // none. This includes web URLs that are part of an extension's web extent. | 50 // none. This includes web URLs that are part of an extension's web extent. |
| 48 std::string GetIdByURL(const GURL& url) const; | 51 std::string GetIdByURL(const GURL& url) const; |
| 49 | 52 |
| 50 // Returns the Extension that the given URL is a part of, or NULL if none. | 53 // Returns the Extension that the given URL is a part of, or NULL if none. |
| 51 // This includes web URLs that are part of an extension's web extent. | 54 // This includes web URLs that are part of an extension's web extent. |
| 52 // NOTE: This can return NULL if called before UpdateExtensions receives | 55 // NOTE: This can return NULL if called before UpdateExtensions receives |
| 53 // bulk extension data (e.g. if called from | 56 // bulk extension data (e.g. if called from |
| 54 // EventBindings::HandleContextCreated) | 57 // EventBindings::HandleContextCreated) |
| 55 const Extension* GetByURL(const GURL& url) const; | 58 const Extension* GetByURL(const GURL& url) const; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 68 | 71 |
| 69 private: | 72 private: |
| 70 FRIEND_TEST_ALL_PREFIXES(ExtensionSetTest, ExtensionSet); | 73 FRIEND_TEST_ALL_PREFIXES(ExtensionSetTest, ExtensionSet); |
| 71 | 74 |
| 72 ExtensionMap extensions_; | 75 ExtensionMap extensions_; |
| 73 | 76 |
| 74 DISALLOW_COPY_AND_ASSIGN(ExtensionSet); | 77 DISALLOW_COPY_AND_ASSIGN(ExtensionSet); |
| 75 }; | 78 }; |
| 76 | 79 |
| 77 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_SET_H_ | 80 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_SET_H_ |
| OLD | NEW |