OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/extension_info_map.h" | 5 #include "chrome/browser/extensions/extension_info_map.h" |
6 | 6 |
7 #include "chrome/common/extensions/extension.h" | 7 #include "chrome/common/extensions/extension.h" |
8 #include "chrome/common/extensions/extension_set.h" | 8 #include "chrome/common/extensions/extension_set.h" |
9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 << extension_id << "," << process_id << "."; | 117 << extension_id << "," << process_id << "."; |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 void ExtensionInfoMap::UnregisterAllExtensionsInProcess(int process_id) { | 121 void ExtensionInfoMap::UnregisterAllExtensionsInProcess(int process_id) { |
122 process_map_.RemoveAllFromProcess(process_id); | 122 process_map_.RemoveAllFromProcess(process_id); |
123 } | 123 } |
124 | 124 |
125 bool ExtensionInfoMap::SecurityOriginHasAPIPermission( | 125 bool ExtensionInfoMap::SecurityOriginHasAPIPermission( |
126 const GURL& origin, int process_id, | 126 const GURL& origin, int process_id, |
127 ExtensionAPIPermission::ID permission) const { | 127 extensions::APIPermission::ID permission) const { |
128 if (origin.SchemeIs(chrome::kExtensionScheme)) { | 128 if (origin.SchemeIs(chrome::kExtensionScheme)) { |
129 const std::string& id = origin.host(); | 129 const std::string& id = origin.host(); |
130 return extensions_.GetByID(id)->HasAPIPermission(permission) && | 130 return extensions_.GetByID(id)->HasAPIPermission(permission) && |
131 process_map_.Contains(id, process_id); | 131 process_map_.Contains(id, process_id); |
132 } | 132 } |
133 | 133 |
134 ExtensionSet::const_iterator i = extensions_.begin(); | 134 ExtensionSet::const_iterator i = extensions_.begin(); |
135 for (; i != extensions_.end(); ++i) { | 135 for (; i != extensions_.end(); ++i) { |
136 if ((*i)->web_extent().MatchesSecurityOrigin(origin) && | 136 if ((*i)->web_extent().MatchesSecurityOrigin(origin) && |
137 process_map_.Contains((*i)->id(), process_id) && | 137 process_map_.Contains((*i)->id(), process_id) && |
(...skipping 10 matching lines...) Expand all Loading... |
148 quota_service_.reset(new ExtensionsQuotaService()); | 148 quota_service_.reset(new ExtensionsQuotaService()); |
149 return quota_service_.get(); | 149 return quota_service_.get(); |
150 } | 150 } |
151 | 151 |
152 ExtensionInfoMap::~ExtensionInfoMap() { | 152 ExtensionInfoMap::~ExtensionInfoMap() { |
153 if (quota_service_.get()) { | 153 if (quota_service_.get()) { |
154 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, | 154 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, |
155 quota_service_.release()); | 155 quota_service_.release()); |
156 } | 156 } |
157 } | 157 } |
OLD | NEW |