OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "extensions/common/extension_set.h" | 5 #include "extensions/common/extension_set.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "extensions/common/constants.h" | 10 #include "extensions/common/constants.h" |
11 #include "extensions/common/extension.h" | 11 #include "extensions/common/extension.h" |
| 12 #include "extensions/common/host_id.h" |
12 #include "extensions/common/manifest_handlers/sandboxed_page_info.h" | 13 #include "extensions/common/manifest_handlers/sandboxed_page_info.h" |
13 | 14 |
14 namespace extensions { | 15 namespace extensions { |
15 | 16 |
16 ExtensionSet::const_iterator::const_iterator() {} | 17 ExtensionSet::const_iterator::const_iterator() {} |
17 | 18 |
18 ExtensionSet::const_iterator::const_iterator(const const_iterator& other) | 19 ExtensionSet::const_iterator::const_iterator(const const_iterator& other) |
19 : it_(other.it_) { | 20 : it_(other.it_) { |
20 } | 21 } |
21 | 22 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 132 |
132 ExtensionIdSet ExtensionSet::GetIDs() const { | 133 ExtensionIdSet ExtensionSet::GetIDs() const { |
133 ExtensionIdSet ids; | 134 ExtensionIdSet ids; |
134 for (ExtensionMap::const_iterator it = extensions_.begin(); | 135 for (ExtensionMap::const_iterator it = extensions_.begin(); |
135 it != extensions_.end(); ++it) { | 136 it != extensions_.end(); ++it) { |
136 ids.insert(it->first); | 137 ids.insert(it->first); |
137 } | 138 } |
138 return ids; | 139 return ids; |
139 } | 140 } |
140 | 141 |
| 142 std::set<HostID> ExtensionSet::GetHostIDs() const { |
| 143 std::set<HostID> ids; |
| 144 for (ExtensionMap::const_iterator it = extensions_.begin(); |
| 145 it != extensions_.end(); ++it) { |
| 146 ids.insert(HostID(HostID::EXTENSIONS, it->first)); |
| 147 } |
| 148 return ids; |
| 149 } |
141 bool ExtensionSet::ExtensionBindingsAllowed(const GURL& url) const { | 150 bool ExtensionSet::ExtensionBindingsAllowed(const GURL& url) const { |
142 if (url.SchemeIs(kExtensionScheme)) | 151 if (url.SchemeIs(kExtensionScheme)) |
143 return true; | 152 return true; |
144 | 153 |
145 for (ExtensionMap::const_iterator it = extensions_.begin(); | 154 for (ExtensionMap::const_iterator it = extensions_.begin(); |
146 it != extensions_.end(); ++it) { | 155 it != extensions_.end(); ++it) { |
147 if (it->second->location() == Manifest::COMPONENT && | 156 if (it->second->location() == Manifest::COMPONENT && |
148 it->second->web_extent().MatchesURL(url)) | 157 it->second->web_extent().MatchesURL(url)) |
149 return true; | 158 return true; |
150 } | 159 } |
151 | 160 |
152 return false; | 161 return false; |
153 } | 162 } |
154 | 163 |
155 } // namespace extensions | 164 } // namespace extensions |
OLD | NEW |