| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extensions_service.h" | 5 #include "chrome/browser/extensions/extensions_service.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
| (...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1250 } | 1250 } |
| 1251 | 1251 |
| 1252 Extension* ExtensionsService::GetExtensionByWebExtent(const GURL& url) { | 1252 Extension* ExtensionsService::GetExtensionByWebExtent(const GURL& url) { |
| 1253 for (size_t i = 0; i < extensions_.size(); ++i) { | 1253 for (size_t i = 0; i < extensions_.size(); ++i) { |
| 1254 if (extensions_[i]->web_extent().ContainsURL(url)) | 1254 if (extensions_[i]->web_extent().ContainsURL(url)) |
| 1255 return extensions_[i]; | 1255 return extensions_[i]; |
| 1256 } | 1256 } |
| 1257 return NULL; | 1257 return NULL; |
| 1258 } | 1258 } |
| 1259 | 1259 |
| 1260 bool ExtensionsService::ExtensionBindingsAllowed(const GURL& url) { |
| 1261 // Allow bindings for all packaged extension. |
| 1262 if (GetExtensionByURL(url)) |
| 1263 return true; |
| 1264 |
| 1265 // Allow bindings for all component, hosted apps. |
| 1266 Extension* extension = GetExtensionByWebExtent(url); |
| 1267 return (extension && extension->location() == Extension::COMPONENT); |
| 1268 } |
| 1269 |
| 1260 Extension* ExtensionsService::GetExtensionByOverlappingWebExtent( | 1270 Extension* ExtensionsService::GetExtensionByOverlappingWebExtent( |
| 1261 const ExtensionExtent& extent) { | 1271 const ExtensionExtent& extent) { |
| 1262 for (size_t i = 0; i < extensions_.size(); ++i) { | 1272 for (size_t i = 0; i < extensions_.size(); ++i) { |
| 1263 if (extensions_[i]->web_extent().OverlapsWith(extent)) | 1273 if (extensions_[i]->web_extent().OverlapsWith(extent)) |
| 1264 return extensions_[i]; | 1274 return extensions_[i]; |
| 1265 } | 1275 } |
| 1266 | 1276 |
| 1267 return NULL; | 1277 return NULL; |
| 1268 } | 1278 } |
| 1269 | 1279 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1607 // Finish installing on UI thread. | 1617 // Finish installing on UI thread. |
| 1608 ChromeThread::PostTask( | 1618 ChromeThread::PostTask( |
| 1609 ChromeThread::UI, FROM_HERE, | 1619 ChromeThread::UI, FROM_HERE, |
| 1610 NewRunnableMethod( | 1620 NewRunnableMethod( |
| 1611 frontend_, | 1621 frontend_, |
| 1612 &ExtensionsService::ContinueLoadAllExtensions, | 1622 &ExtensionsService::ContinueLoadAllExtensions, |
| 1613 extensions_to_reload, | 1623 extensions_to_reload, |
| 1614 start_time, | 1624 start_time, |
| 1615 true)); | 1625 true)); |
| 1616 } | 1626 } |
| OLD | NEW |