| 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 <iterator> | 9 #include <iterator> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // are part of an extension's web extent. | 95 // are part of an extension's web extent. |
| 96 std::string GetIDByURL(const ExtensionURLInfo& info) const; | 96 std::string GetIDByURL(const ExtensionURLInfo& info) const; |
| 97 | 97 |
| 98 // Returns the Extension, or NULL if none. This includes web URLs that are | 98 // Returns the Extension, or NULL if none. This includes web URLs that are |
| 99 // part of an extension's web extent. | 99 // part of an extension's web extent. |
| 100 // NOTE: This can return NULL if called before UpdateExtensions receives | 100 // NOTE: This can return NULL if called before UpdateExtensions receives |
| 101 // bulk extension data (e.g. if called from | 101 // bulk extension data (e.g. if called from |
| 102 // EventBindings::HandleContextCreated) | 102 // EventBindings::HandleContextCreated) |
| 103 const Extension* GetByURL(const ExtensionURLInfo& info) const; | 103 const Extension* GetByURL(const ExtensionURLInfo& info) const; |
| 104 | 104 |
| 105 // Returns the extension whose web extent contains the URL. |
| 106 const Extension* GetByWebExtent(const ExtensionURLInfo& info) const; |
| 107 |
| 108 // Returns an extension that contains any URL that overlaps with the given |
| 109 // extent, if one exists. |
| 110 const Extension* GetByOverlappingWebExtent(const URLPatternSet& extent) const; |
| 111 |
| 105 // Returns true if |new_url| is in the extent of the same extension as | 112 // Returns true if |new_url| is in the extent of the same extension as |
| 106 // |old_url|. Also returns true if neither URL is in an app. | 113 // |old_url|. Also returns true if neither URL is in an app. |
| 107 bool InSameExtent(const GURL& old_url, const GURL& new_url) const; | 114 bool InSameExtent(const GURL& old_url, const GURL& new_url) const; |
| 108 | 115 |
| 109 // Look up an Extension object by id. | 116 // Look up an Extension object by id. |
| 110 const Extension* GetByID(const std::string& id) const; | 117 const Extension* GetByID(const std::string& id) const; |
| 111 | 118 |
| 112 // Returns true if |info| should get extension api bindings and be permitted | 119 // Returns true if |info| should get extension api bindings and be permitted |
| 113 // to make api calls. Note that this is independent of what extension | 120 // to make api calls. Note that this is independent of what extension |
| 114 // permissions the given extension has been granted. | 121 // permissions the given extension has been granted. |
| 115 bool ExtensionBindingsAllowed(const ExtensionURLInfo& info) const; | 122 bool ExtensionBindingsAllowed(const ExtensionURLInfo& info) const; |
| 116 | 123 |
| 117 private: | 124 private: |
| 118 FRIEND_TEST_ALL_PREFIXES(ExtensionSetTest, ExtensionSet); | 125 FRIEND_TEST_ALL_PREFIXES(ExtensionSetTest, ExtensionSet); |
| 119 | 126 |
| 120 ExtensionMap extensions_; | 127 ExtensionMap extensions_; |
| 121 | 128 |
| 122 DISALLOW_COPY_AND_ASSIGN(ExtensionSet); | 129 DISALLOW_COPY_AND_ASSIGN(ExtensionSet); |
| 123 }; | 130 }; |
| 124 | 131 |
| 125 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_SET_H_ | 132 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_SET_H_ |
| OLD | NEW |