| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/api/runtime/runtime_api.h" | 5 #include "chrome/browser/extensions/api/runtime/runtime_api.h" |
| 6 | 6 |
| 7 #include "chrome/common/extensions/extension.h" | 7 #include "chrome/common/extensions/extension.h" |
| 8 #include "chrome/browser/extensions/extension_event_router.h" | 8 #include "chrome/browser/extensions/extension_event_router.h" |
| 9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
| 10 #include "chrome/browser/extensions/extension_process_manager.h" | 10 #include "chrome/browser/extensions/extension_process_manager.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 if (!system) | 30 if (!system) |
| 31 return; | 31 return; |
| 32 | 32 |
| 33 // Special case: normally, extensions add their own lazy event listeners. | 33 // Special case: normally, extensions add their own lazy event listeners. |
| 34 // However, since the extension has just been installed, it hasn't had a | 34 // However, since the extension has just been installed, it hasn't had a |
| 35 // chance to register for events. So we register on its behalf. If the | 35 // chance to register for events. So we register on its behalf. If the |
| 36 // extension does not actually have a listener, the event will just be | 36 // extension does not actually have a listener, the event will just be |
| 37 // ignored. | 37 // ignored. |
| 38 system->event_router()->AddLazyEventListener(kOnInstalledEvent, extension_id); | 38 system->event_router()->AddLazyEventListener(kOnInstalledEvent, extension_id); |
| 39 system->event_router()->DispatchEventToExtension( | 39 system->event_router()->DispatchEventToExtension( |
| 40 extension_id, kOnInstalledEvent, "[]", NULL, GURL()); | 40 extension_id, kOnInstalledEvent, NULL, NULL, GURL()); |
| 41 } | 41 } |
| 42 | 42 |
| 43 bool RuntimeGetBackgroundPageFunction::RunImpl() { | 43 bool RuntimeGetBackgroundPageFunction::RunImpl() { |
| 44 ExtensionHost* host = | 44 ExtensionHost* host = |
| 45 ExtensionSystem::Get(profile())->process_manager()-> | 45 ExtensionSystem::Get(profile())->process_manager()-> |
| 46 GetBackgroundHostForExtension(extension_id()); | 46 GetBackgroundHostForExtension(extension_id()); |
| 47 if (host) { | 47 if (host) { |
| 48 OnPageLoaded(host); | 48 OnPageLoaded(host); |
| 49 } else if (GetExtension()->has_lazy_background_page()) { | 49 } else if (GetExtension()->has_lazy_background_page()) { |
| 50 ExtensionSystem::Get(profile())->lazy_background_task_queue()-> | 50 ExtensionSystem::Get(profile())->lazy_background_task_queue()-> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 63 void RuntimeGetBackgroundPageFunction::OnPageLoaded(ExtensionHost* host) { | 63 void RuntimeGetBackgroundPageFunction::OnPageLoaded(ExtensionHost* host) { |
| 64 if (host) { | 64 if (host) { |
| 65 SendResponse(true); | 65 SendResponse(true); |
| 66 } else { | 66 } else { |
| 67 error_ = kPageLoadError; | 67 error_ = kPageLoadError; |
| 68 SendResponse(false); | 68 SendResponse(false); |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace extensions | 72 } // namespace extensions |
| OLD | NEW |