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/lazy_background_task_queue.h" | 5 #include "chrome/browser/extensions/lazy_background_task_queue.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "chrome/browser/extensions/extension_host.h" | 8 #include "chrome/browser/extensions/extension_host.h" |
9 #include "chrome/browser/extensions/extension_process_manager.h" | 9 #include "chrome/browser/extensions/extension_process_manager.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 content::Source<Profile>(profile)); | 36 content::Source<Profile>(profile)); |
37 } | 37 } |
38 | 38 |
39 LazyBackgroundTaskQueue::~LazyBackgroundTaskQueue() { | 39 LazyBackgroundTaskQueue::~LazyBackgroundTaskQueue() { |
40 } | 40 } |
41 | 41 |
42 bool LazyBackgroundTaskQueue::ShouldEnqueueTask( | 42 bool LazyBackgroundTaskQueue::ShouldEnqueueTask( |
43 Profile* profile, const Extension* extension) { | 43 Profile* profile, const Extension* extension) { |
44 DCHECK(extension); | 44 DCHECK(extension); |
45 if (extension->has_background_page()) { | 45 if (extension->has_background_page()) { |
46 ExtensionProcessManager* pm = profile->GetExtensionProcessManager(); | 46 ExtensionProcessManager* pm = extensions::ExtensionSystem::Get(profile)-> |
| 47 process_manager(); |
47 ExtensionHost* background_host = | 48 ExtensionHost* background_host = |
48 pm->GetBackgroundHostForExtension(extension->id()); | 49 pm->GetBackgroundHostForExtension(extension->id()); |
49 if (!background_host || !background_host->did_stop_loading()) | 50 if (!background_host || !background_host->did_stop_loading()) |
50 return true; | 51 return true; |
51 if (pm->IsBackgroundHostClosing(extension->id())) | 52 if (pm->IsBackgroundHostClosing(extension->id())) |
52 pm->CancelSuspend(extension); | 53 pm->CancelSuspend(extension); |
53 } | 54 } |
54 | 55 |
55 return false; | 56 return false; |
56 } | 57 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 162 } |
162 break; | 163 break; |
163 } | 164 } |
164 default: | 165 default: |
165 NOTREACHED(); | 166 NOTREACHED(); |
166 break; | 167 break; |
167 } | 168 } |
168 } | 169 } |
169 | 170 |
170 } // namespace extensions | 171 } // namespace extensions |
OLD | NEW |