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/browser/info_map.h" | 5 #include "extensions/browser/info_map.h" |
6 | 6 |
7 #include "content/public/browser/browser_thread.h" | 7 #include "content/public/browser/browser_thread.h" |
8 #include "extensions/browser/content_verifier.h" | 8 #include "extensions/browser/content_verifier.h" |
9 #include "extensions/common/constants.h" | 9 #include "extensions/common/constants.h" |
10 #include "extensions/common/extension.h" | 10 #include "extensions/common/extension.h" |
11 #include "extensions/common/extension_set.h" | 11 #include "extensions/common/extension_set.h" |
12 #include "extensions/common/manifest_handlers/incognito_info.h" | 12 #include "extensions/common/manifest_handlers/incognito_info.h" |
| 13 #include "extensions/common/permissions/permissions_data.h" |
13 | 14 |
14 using content::BrowserThread; | 15 using content::BrowserThread; |
15 | 16 |
16 namespace extensions { | 17 namespace extensions { |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 void CheckOnValidThread() { DCHECK_CURRENTLY_ON(BrowserThread::IO); } | 21 void CheckOnValidThread() { DCHECK_CURRENTLY_ON(BrowserThread::IO); } |
21 | 22 |
22 } // namespace | 23 } // namespace |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 void InfoMap::GetExtensionsWithAPIPermissionForSecurityOrigin( | 144 void InfoMap::GetExtensionsWithAPIPermissionForSecurityOrigin( |
144 const GURL& origin, | 145 const GURL& origin, |
145 int process_id, | 146 int process_id, |
146 APIPermission::ID permission, | 147 APIPermission::ID permission, |
147 ExtensionSet* extensions) const { | 148 ExtensionSet* extensions) const { |
148 DCHECK(extensions); | 149 DCHECK(extensions); |
149 | 150 |
150 if (origin.SchemeIs(kExtensionScheme)) { | 151 if (origin.SchemeIs(kExtensionScheme)) { |
151 const std::string& id = origin.host(); | 152 const std::string& id = origin.host(); |
152 const Extension* extension = extensions_.GetByID(id); | 153 const Extension* extension = extensions_.GetByID(id); |
153 if (extension && extension->HasAPIPermission(permission) && | 154 if (extension && |
| 155 extension->permissions_data()->HasAPIPermission(permission) && |
154 process_map_.Contains(id, process_id)) { | 156 process_map_.Contains(id, process_id)) { |
155 extensions->Insert(extension); | 157 extensions->Insert(extension); |
156 } | 158 } |
157 return; | 159 return; |
158 } | 160 } |
159 | 161 |
160 ExtensionSet::const_iterator i = extensions_.begin(); | 162 ExtensionSet::const_iterator i = extensions_.begin(); |
161 for (; i != extensions_.end(); ++i) { | 163 for (; i != extensions_.end(); ++i) { |
162 if ((*i)->web_extent().MatchesSecurityOrigin(origin) && | 164 if ((*i)->web_extent().MatchesSecurityOrigin(origin) && |
163 process_map_.Contains((*i)->id(), process_id) && | 165 process_map_.Contains((*i)->id(), process_id) && |
164 (*i)->HasAPIPermission(permission)) { | 166 (*i)->permissions_data()->HasAPIPermission(permission)) { |
165 extensions->Insert(*i); | 167 extensions->Insert(*i); |
166 } | 168 } |
167 } | 169 } |
168 } | 170 } |
169 | 171 |
170 bool InfoMap::SecurityOriginHasAPIPermission(const GURL& origin, | 172 bool InfoMap::SecurityOriginHasAPIPermission(const GURL& origin, |
171 int process_id, | 173 int process_id, |
172 APIPermission::ID permission) | 174 APIPermission::ID permission) |
173 const { | 175 const { |
174 ExtensionSet extensions; | 176 ExtensionSet extensions; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 } | 215 } |
214 | 216 |
215 InfoMap::~InfoMap() { | 217 InfoMap::~InfoMap() { |
216 if (quota_service_) { | 218 if (quota_service_) { |
217 BrowserThread::DeleteSoon( | 219 BrowserThread::DeleteSoon( |
218 BrowserThread::IO, FROM_HERE, quota_service_.release()); | 220 BrowserThread::IO, FROM_HERE, quota_service_.release()); |
219 } | 221 } |
220 } | 222 } |
221 | 223 |
222 } // namespace extensions | 224 } // namespace extensions |
OLD | NEW |