| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 // Returns the extension ID that the given URL is a part of, or empty if | 46 // 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. | 47 // none. This includes web URLs that are part of an extension's web extent. |
| 48 std::string GetIdByURL(const GURL& url) const; | 48 std::string GetIdByURL(const GURL& url) const; |
| 49 | 49 |
| 50 // Returns the Extension that the given URL is a part of, or NULL if none. | 50 // 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. | 51 // This includes web URLs that are part of an extension's web extent. |
| 52 // NOTE: This can return NULL if called before UpdateExtensions receives | 52 // NOTE: This can return NULL if called before UpdateExtensions receives |
| 53 // bulk extension data (e.g. if called from | 53 // bulk extension data (e.g. if called from |
| 54 // EventBindings::HandleContextCreated) | 54 // EventBindings::HandleContextCreated) |
| 55 // We exclude bookmark apps. TODO(creis): Should they be excluded from the |
| 56 // whole set in the first place? |
| 55 const Extension* GetByURL(const GURL& url) const; | 57 const Extension* GetByURL(const GURL& url) const; |
| 56 | 58 |
| 57 // Returns true if |new_url| is in the extent of the same extension as | 59 // Returns true if |new_url| is in the extent of the same extension as |
| 58 // |old_url|. Also returns true if neither URL is in an app. | 60 // |old_url|. Also returns true if neither URL is in an app. |
| 59 bool InSameExtent(const GURL& old_url, const GURL& new_url) const; | 61 bool InSameExtent(const GURL& old_url, const GURL& new_url) const; |
| 60 | 62 |
| 61 // Look up an Extension object by id. | 63 // Look up an Extension object by id. |
| 62 const Extension* GetByID(const std::string& id) const; | 64 const Extension* GetByID(const std::string& id) const; |
| 63 | 65 |
| 64 // Returns true if |url| should get extension api bindings and be permitted | 66 // Returns true if |url| should get extension api bindings and be permitted |
| 65 // to make api calls. Note that this is independent of what extension | 67 // to make api calls. Note that this is independent of what extension |
| 66 // permissions the given extension has been granted. | 68 // permissions the given extension has been granted. |
| 67 bool ExtensionBindingsAllowed(const GURL& url) const; | 69 bool ExtensionBindingsAllowed(const GURL& url) const; |
| 68 | 70 |
| 69 private: | 71 private: |
| 70 FRIEND_TEST_ALL_PREFIXES(ExtensionSetTest, ExtensionSet); | 72 FRIEND_TEST_ALL_PREFIXES(ExtensionSetTest, ExtensionSet); |
| 71 | 73 |
| 72 ExtensionMap extensions_; | 74 ExtensionMap extensions_; |
| 73 | 75 |
| 74 DISALLOW_COPY_AND_ASSIGN(ExtensionSet); | 76 DISALLOW_COPY_AND_ASSIGN(ExtensionSet); |
| 75 }; | 77 }; |
| 76 | 78 |
| 77 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_SET_H_ | 79 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_SET_H_ |
| OLD | NEW |