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

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

Issue 7328029: Use process-per-app-instance for hosted apps without background permission. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update tests. Created 9 years, 5 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 | 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 #include "chrome/browser/extensions/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2158 2158
2159 const Extension* ExtensionService::GetExtensionByWebExtent(const GURL& url) { 2159 const Extension* ExtensionService::GetExtensionByWebExtent(const GURL& url) {
2160 for (size_t i = 0; i < extensions_.size(); ++i) { 2160 for (size_t i = 0; i < extensions_.size(); ++i) {
2161 if (extensions_[i]->web_extent().MatchesURL(url)) 2161 if (extensions_[i]->web_extent().MatchesURL(url))
2162 return extensions_[i]; 2162 return extensions_[i];
2163 } 2163 }
2164 return NULL; 2164 return NULL;
2165 } 2165 }
2166 2166
2167 bool ExtensionService::ExtensionBindingsAllowed(const GURL& url) { 2167 bool ExtensionService::ExtensionBindingsAllowed(const GURL& url) {
2168 // Allow bindings for all packaged extension. 2168 // Allow bindings for all packaged extensions.
2169 if (GetExtensionByURL(url)) 2169 // Note that GetExtensionByURL may return an Extension for hosted apps
2170 // if the URL came from GetEffectiveURL.
2171 const Extension* extension = GetExtensionByURL(url);
2172 if (extension && extension->GetType() != Extension::TYPE_HOSTED_APP)
2170 return true; 2173 return true;
2171 2174
2172 // Allow bindings for all component, hosted apps. 2175 // Allow bindings for all component, hosted apps.
2173 const Extension* extension = GetExtensionByWebExtent(url); 2176 if (!extension)
2177 extension = GetExtensionByWebExtent(url);
2174 return (extension && extension->location() == Extension::COMPONENT); 2178 return (extension && extension->location() == Extension::COMPONENT);
2175 } 2179 }
2176 2180
2177 const Extension* ExtensionService::GetExtensionByOverlappingWebExtent( 2181 const Extension* ExtensionService::GetExtensionByOverlappingWebExtent(
2178 const URLPatternSet& extent) { 2182 const URLPatternSet& extent) {
2179 for (size_t i = 0; i < extensions_.size(); ++i) { 2183 for (size_t i = 0; i < extensions_.size(); ++i) {
2180 if (extensions_[i]->web_extent().OverlapsWith(extent)) 2184 if (extensions_[i]->web_extent().OverlapsWith(extent))
2181 return extensions_[i]; 2185 return extensions_[i];
2182 } 2186 }
2183 2187
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
2425 2429
2426 ExtensionService::NaClModuleInfoList::iterator 2430 ExtensionService::NaClModuleInfoList::iterator
2427 ExtensionService::FindNaClModule(const GURL& url) { 2431 ExtensionService::FindNaClModule(const GURL& url) {
2428 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 2432 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
2429 iter != nacl_module_list_.end(); ++iter) { 2433 iter != nacl_module_list_.end(); ++iter) {
2430 if (iter->url == url) 2434 if (iter->url == url)
2431 return iter; 2435 return iter;
2432 } 2436 }
2433 return nacl_module_list_.end(); 2437 return nacl_module_list_.end();
2434 } 2438 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698