Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(973)

Side by Side Diff: extensions/browser/lazy_background_task_queue.cc

Issue 428953003: Move LazyBackgroundTaskQueueTest into extensions_unittests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (lazy-bg) rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "extensions/browser/lazy_background_task_queue.h" 5 #include "extensions/browser/lazy_background_task_queue.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "content/public/browser/browser_context.h" 8 #include "content/public/browser/browser_context.h"
9 #include "content/public/browser/notification_service.h" 9 #include "content/public/browser/notification_service.h"
10 #include "content/public/browser/render_process_host.h" 10 #include "content/public/browser/render_process_host.h"
(...skipping 26 matching lines...) Expand all
37 37
38 extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context)); 38 extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context));
39 } 39 }
40 40
41 LazyBackgroundTaskQueue::~LazyBackgroundTaskQueue() { 41 LazyBackgroundTaskQueue::~LazyBackgroundTaskQueue() {
42 } 42 }
43 43
44 bool LazyBackgroundTaskQueue::ShouldEnqueueTask( 44 bool LazyBackgroundTaskQueue::ShouldEnqueueTask(
45 content::BrowserContext* browser_context, 45 content::BrowserContext* browser_context,
46 const Extension* extension) { 46 const Extension* extension) {
47 // Note: browser_context may not be the same as browser_context_ for incognito
48 // extension tasks.
47 DCHECK(extension); 49 DCHECK(extension);
48 if (BackgroundInfo::HasBackgroundPage(extension)) { 50 if (BackgroundInfo::HasBackgroundPage(extension)) {
49 ProcessManager* pm = ExtensionSystem::Get( 51 ProcessManager* pm = ExtensionSystem::Get(
50 browser_context)->process_manager(); 52 browser_context)->process_manager();
51 DCHECK(pm); 53 DCHECK(pm);
52 ExtensionHost* background_host = 54 ExtensionHost* background_host =
53 pm->GetBackgroundHostForExtension(extension->id()); 55 pm->GetBackgroundHostForExtension(extension->id());
54 if (!background_host || !background_host->did_stop_loading()) 56 if (!background_host || !background_host->did_stop_loading())
55 return true; 57 return true;
56 if (pm->IsBackgroundHostClosing(extension->id())) 58 if (pm->IsBackgroundHostClosing(extension->id()))
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // task queue as well. 182 // task queue as well.
181 ExtensionsBrowserClient* browser_client = ExtensionsBrowserClient::Get(); 183 ExtensionsBrowserClient* browser_client = ExtensionsBrowserClient::Get();
182 if (browser_client->HasOffTheRecordContext(browser_context)) { 184 if (browser_client->HasOffTheRecordContext(browser_context)) {
183 ProcessPendingTasks(NULL, 185 ProcessPendingTasks(NULL,
184 browser_client->GetOffTheRecordContext(browser_context), 186 browser_client->GetOffTheRecordContext(browser_context),
185 extension); 187 extension);
186 } 188 }
187 } 189 }
188 190
189 } // namespace extensions 191 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698