| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/extensions/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 if (!pending_extension_manager()->AddFromExternalUpdateUrl( | 245 if (!pending_extension_manager()->AddFromExternalUpdateUrl( |
| 246 id, update_url, location)) { | 246 id, update_url, location)) { |
| 247 return false; | 247 return false; |
| 248 } | 248 } |
| 249 | 249 |
| 250 update_once_all_providers_are_ready_ = true; | 250 update_once_all_providers_are_ready_ = true; |
| 251 return true; | 251 return true; |
| 252 } | 252 } |
| 253 | 253 |
| 254 const Extension* ExtensionService::GetInstalledApp(const GURL& url) const { | 254 const Extension* ExtensionService::GetInstalledApp(const GURL& url) const { |
| 255 const Extension* extension = extensions_.GetExtensionOrAppByURL( | 255 const Extension* extension = extensions_.GetExtensionOrAppByURL(url); |
| 256 ExtensionURLInfo(url)); | |
| 257 return (extension && extension->is_app()) ? extension : NULL; | 256 return (extension && extension->is_app()) ? extension : NULL; |
| 258 } | 257 } |
| 259 | 258 |
| 260 bool ExtensionService::IsInstalledApp(const GURL& url) const { | 259 bool ExtensionService::IsInstalledApp(const GURL& url) const { |
| 261 return !!GetInstalledApp(url); | 260 return !!GetInstalledApp(url); |
| 262 } | 261 } |
| 263 | 262 |
| 264 const Extension* ExtensionService::GetIsolatedAppForRenderer( | 263 const Extension* ExtensionService::GetIsolatedAppForRenderer( |
| 265 int renderer_child_id) const { | 264 int renderer_child_id) const { |
| 266 std::set<std::string> extension_ids = | 265 std::set<std::string> extension_ids = |
| (...skipping 2131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2398 const std::string& id) const { | 2397 const std::string& id) const { |
| 2399 int include_mask = INCLUDE_ENABLED | | 2398 int include_mask = INCLUDE_ENABLED | |
| 2400 INCLUDE_DISABLED | | 2399 INCLUDE_DISABLED | |
| 2401 INCLUDE_TERMINATED | | 2400 INCLUDE_TERMINATED | |
| 2402 INCLUDE_BLACKLISTED; | 2401 INCLUDE_BLACKLISTED; |
| 2403 return GetExtensionById(id, include_mask); | 2402 return GetExtensionById(id, include_mask); |
| 2404 } | 2403 } |
| 2405 | 2404 |
| 2406 bool ExtensionService::ExtensionBindingsAllowed(const GURL& url) { | 2405 bool ExtensionService::ExtensionBindingsAllowed(const GURL& url) { |
| 2407 // Allow bindings for all packaged extensions and component hosted apps. | 2406 // Allow bindings for all packaged extensions and component hosted apps. |
| 2408 const Extension* extension = extensions_.GetExtensionOrAppByURL( | 2407 const Extension* extension = extensions_.GetExtensionOrAppByURL(url); |
| 2409 ExtensionURLInfo(url)); | |
| 2410 return extension && (!extension->is_hosted_app() || | 2408 return extension && (!extension->is_hosted_app() || |
| 2411 extension->location() == Manifest::COMPONENT); | 2409 extension->location() == Manifest::COMPONENT); |
| 2412 } | 2410 } |
| 2413 | 2411 |
| 2414 bool ExtensionService::ShouldBlockUrlInBrowserTab(GURL* url) { | 2412 bool ExtensionService::ShouldBlockUrlInBrowserTab(GURL* url) { |
| 2415 const Extension* extension = extensions_.GetExtensionOrAppByURL( | 2413 const Extension* extension = extensions_.GetExtensionOrAppByURL(*url); |
| 2416 ExtensionURLInfo(*url)); | |
| 2417 if (extension && extension->is_platform_app()) { | 2414 if (extension && extension->is_platform_app()) { |
| 2418 *url = GURL(chrome::kExtensionInvalidRequestURL); | 2415 *url = GURL(chrome::kExtensionInvalidRequestURL); |
| 2419 return true; | 2416 return true; |
| 2420 } | 2417 } |
| 2421 | 2418 |
| 2422 return false; | 2419 return false; |
| 2423 } | 2420 } |
| 2424 | 2421 |
| 2425 bool ExtensionService::OnExternalExtensionFileFound( | 2422 bool ExtensionService::OnExternalExtensionFileFound( |
| 2426 const std::string& id, | 2423 const std::string& id, |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2879 } | 2876 } |
| 2880 | 2877 |
| 2881 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { | 2878 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { |
| 2882 update_observers_.AddObserver(observer); | 2879 update_observers_.AddObserver(observer); |
| 2883 } | 2880 } |
| 2884 | 2881 |
| 2885 void ExtensionService::RemoveUpdateObserver( | 2882 void ExtensionService::RemoveUpdateObserver( |
| 2886 extensions::UpdateObserver* observer) { | 2883 extensions::UpdateObserver* observer) { |
| 2887 update_observers_.RemoveObserver(observer); | 2884 update_observers_.RemoveObserver(observer); |
| 2888 } | 2885 } |
| OLD | NEW |