Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: chrome/common/extensions/extension_set.h

Issue 8827013: Move/replace/rename URL-based extension getters from ExtensionService to/in ExtensionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: id Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 void Insert(const scoped_refptr<const Extension>& extension); 86 void Insert(const scoped_refptr<const Extension>& extension);
87 87
88 // Removes the specified extension. 88 // Removes the specified extension.
89 void Remove(const std::string& id); 89 void Remove(const std::string& id);
90 90
91 // Removes all extensions. 91 // Removes all extensions.
92 void Clear(); 92 void Clear();
93 93
94 // Returns the extension ID, or empty if none. This includes web URLs that 94 // Returns the extension ID, or empty if none. This includes web URLs that
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 GetExtensionOrAppIDByURL(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* GetExtensionOrAppByURL(const ExtensionURLInfo& info) const;
104
105 // Returns the hosted app whose web extent contains the URL.
106 const Extension* GetHostedAppByURL(const ExtensionURLInfo& info) const;
107
108 // Returns a hosted app that contains any URL that overlaps with the given
109 // extent, if one exists.
110 const Extension* GetHostedAppByOverlappingWebExtent(
111 const URLPatternSet& extent) const;
104 112
105 // Returns true if |new_url| is in the extent of the same extension as 113 // 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. 114 // |old_url|. Also returns true if neither URL is in an app.
107 bool InSameExtent(const GURL& old_url, const GURL& new_url) const; 115 bool InSameExtent(const GURL& old_url, const GURL& new_url) const;
108 116
109 // Look up an Extension object by id. 117 // Look up an Extension object by id.
110 const Extension* GetByID(const std::string& id) const; 118 const Extension* GetByID(const std::string& id) const;
111 119
112 // Returns true if |info| should get extension api bindings and be permitted 120 // 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 121 // to make api calls. Note that this is independent of what extension
114 // permissions the given extension has been granted. 122 // permissions the given extension has been granted.
115 bool ExtensionBindingsAllowed(const ExtensionURLInfo& info) const; 123 bool ExtensionBindingsAllowed(const ExtensionURLInfo& info) const;
116 124
117 private: 125 private:
118 FRIEND_TEST_ALL_PREFIXES(ExtensionSetTest, ExtensionSet); 126 FRIEND_TEST_ALL_PREFIXES(ExtensionSetTest, ExtensionSet);
119 127
120 ExtensionMap extensions_; 128 ExtensionMap extensions_;
121 129
122 DISALLOW_COPY_AND_ASSIGN(ExtensionSet); 130 DISALLOW_COPY_AND_ASSIGN(ExtensionSet);
123 }; 131 };
124 132
125 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_SET_H_ 133 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_SET_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_messages.h ('k') | chrome/common/extensions/extension_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698