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

Side by Side Diff: chrome/browser/extensions/extension_info_map.cc

Issue 10649003: Move each permission classes to its own files in extensions/permissions (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase on HEAD Created 8 years, 6 months 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
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_info_map.h ('k') | chrome/browser/extensions/extension_info_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698