| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 if (!pending_extension_manager()->AddFromExternalUpdateUrl( | 257 if (!pending_extension_manager()->AddFromExternalUpdateUrl( |
| 258 id, update_url, location)) { | 258 id, update_url, location)) { |
| 259 return false; | 259 return false; |
| 260 } | 260 } |
| 261 | 261 |
| 262 update_once_all_providers_are_ready_ = true; | 262 update_once_all_providers_are_ready_ = true; |
| 263 return true; | 263 return true; |
| 264 } | 264 } |
| 265 | 265 |
| 266 const Extension* ExtensionService::GetInstalledApp(const GURL& url) const { | 266 const Extension* ExtensionService::GetInstalledApp(const GURL& url) const { |
| 267 const Extension* extension = extensions_.GetExtensionOrAppByURL( | 267 const Extension* extension = extensions_.GetExtensionOrAppByURL(url); |
| 268 ExtensionURLInfo(url)); | |
| 269 return (extension && extension->is_app()) ? extension : NULL; | 268 return (extension && extension->is_app()) ? extension : NULL; |
| 270 } | 269 } |
| 271 | 270 |
| 272 bool ExtensionService::IsInstalledApp(const GURL& url) const { | 271 bool ExtensionService::IsInstalledApp(const GURL& url) const { |
| 273 return !!GetInstalledApp(url); | 272 return !!GetInstalledApp(url); |
| 274 } | 273 } |
| 275 | 274 |
| 276 const Extension* ExtensionService::GetIsolatedAppForRenderer( | 275 const Extension* ExtensionService::GetIsolatedAppForRenderer( |
| 277 int renderer_child_id) const { | 276 int renderer_child_id) const { |
| 278 std::set<std::string> extension_ids = | 277 std::set<std::string> extension_ids = |
| (...skipping 2298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2577 const std::string& id) const { | 2576 const std::string& id) const { |
| 2578 int include_mask = INCLUDE_ENABLED | | 2577 int include_mask = INCLUDE_ENABLED | |
| 2579 INCLUDE_DISABLED | | 2578 INCLUDE_DISABLED | |
| 2580 INCLUDE_TERMINATED | | 2579 INCLUDE_TERMINATED | |
| 2581 INCLUDE_BLACKLISTED; | 2580 INCLUDE_BLACKLISTED; |
| 2582 return GetExtensionById(id, include_mask); | 2581 return GetExtensionById(id, include_mask); |
| 2583 } | 2582 } |
| 2584 | 2583 |
| 2585 bool ExtensionService::ExtensionBindingsAllowed(const GURL& url) { | 2584 bool ExtensionService::ExtensionBindingsAllowed(const GURL& url) { |
| 2586 // Allow bindings for all packaged extensions and component hosted apps. | 2585 // Allow bindings for all packaged extensions and component hosted apps. |
| 2587 const Extension* extension = extensions_.GetExtensionOrAppByURL( | 2586 const Extension* extension = extensions_.GetExtensionOrAppByURL(url); |
| 2588 ExtensionURLInfo(url)); | |
| 2589 return extension && (!extension->is_hosted_app() || | 2587 return extension && (!extension->is_hosted_app() || |
| 2590 extension->location() == Manifest::COMPONENT); | 2588 extension->location() == Manifest::COMPONENT); |
| 2591 } | 2589 } |
| 2592 | 2590 |
| 2593 bool ExtensionService::ShouldBlockUrlInBrowserTab(GURL* url) { | 2591 bool ExtensionService::ShouldBlockUrlInBrowserTab(GURL* url) { |
| 2594 const Extension* extension = extensions_.GetExtensionOrAppByURL( | 2592 const Extension* extension = extensions_.GetExtensionOrAppByURL(*url); |
| 2595 ExtensionURLInfo(*url)); | |
| 2596 if (extension && extension->is_platform_app()) { | 2593 if (extension && extension->is_platform_app()) { |
| 2597 *url = GURL(chrome::kExtensionInvalidRequestURL); | 2594 *url = GURL(chrome::kExtensionInvalidRequestURL); |
| 2598 return true; | 2595 return true; |
| 2599 } | 2596 } |
| 2600 | 2597 |
| 2601 return false; | 2598 return false; |
| 2602 } | 2599 } |
| 2603 | 2600 |
| 2604 bool ExtensionService::OnExternalExtensionFileFound( | 2601 bool ExtensionService::OnExternalExtensionFileFound( |
| 2605 const std::string& id, | 2602 const std::string& id, |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3085 } | 3082 } |
| 3086 | 3083 |
| 3087 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { | 3084 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { |
| 3088 update_observers_.AddObserver(observer); | 3085 update_observers_.AddObserver(observer); |
| 3089 } | 3086 } |
| 3090 | 3087 |
| 3091 void ExtensionService::RemoveUpdateObserver( | 3088 void ExtensionService::RemoveUpdateObserver( |
| 3092 extensions::UpdateObserver* observer) { | 3089 extensions::UpdateObserver* observer) { |
| 3093 update_observers_.RemoveObserver(observer); | 3090 update_observers_.RemoveObserver(observer); |
| 3094 } | 3091 } |
| OLD | NEW |