Index: chrome/browser/extensions/api/runtime/runtime_api.cc |
diff --git a/chrome/browser/extensions/api/runtime/runtime_api.cc b/chrome/browser/extensions/api/runtime/runtime_api.cc |
index 2d97e3a86b38caec46a87110904fb836e16ee170..4629804e7e1e9d1de123c99bb687ab1be7ee8d0e 100644 |
--- a/chrome/browser/extensions/api/runtime/runtime_api.cc |
+++ b/chrome/browser/extensions/api/runtime/runtime_api.cc |
@@ -132,17 +132,16 @@ void RuntimeEventRouter::DispatchOnUpdateAvailableEvent( |
} |
bool RuntimeGetBackgroundPageFunction::RunImpl() { |
- ExtensionHost* host = |
- ExtensionSystem::Get(profile())->process_manager()-> |
- GetBackgroundHostForExtension(extension_id()); |
- if (host) { |
+ ExtensionSystem* system = ExtensionSystem::Get(profile()); |
+ ExtensionHost* host = system->process_manager()-> |
+ GetBackgroundHostForExtension(extension_id()); |
+ if (system->lazy_background_task_queue()->ShouldEnqueueTask( |
+ profile(), GetExtension())) { |
+ system->lazy_background_task_queue()->AddPendingTask( |
+ profile(), extension_id(), |
+ base::Bind(&RuntimeGetBackgroundPageFunction::OnPageLoaded, this)); |
+ } else if (host) { |
OnPageLoaded(host); |
- } else if (GetExtension()->has_lazy_background_page()) { |
- ExtensionSystem::Get(profile())->lazy_background_task_queue()-> |
- AddPendingTask( |
- profile(), extension_id(), |
- base::Bind(&RuntimeGetBackgroundPageFunction::OnPageLoaded, |
- this)); |
} else { |
error_ = kNoBackgroundPageError; |
return false; |