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

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

Issue 204703002: Rename NOTIFICATION_EXTENSION_UNLOADED to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: maybe upload wont do something bizarre this time Created 6 years, 9 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
« no previous file with comments | « extensions/browser/event_router.cc ('k') | extensions/browser/process_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/extensions/extension_host.h" 9 #include "chrome/browser/extensions/extension_host.h"
10 #include "content/public/browser/browser_context.h" 10 #include "content/public/browser/browser_context.h"
(...skipping 14 matching lines...) Expand all
25 25
26 namespace extensions { 26 namespace extensions {
27 27
28 LazyBackgroundTaskQueue::LazyBackgroundTaskQueue( 28 LazyBackgroundTaskQueue::LazyBackgroundTaskQueue(
29 content::BrowserContext* browser_context) 29 content::BrowserContext* browser_context)
30 : browser_context_(browser_context) { 30 : browser_context_(browser_context) {
31 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, 31 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING,
32 content::NotificationService::AllBrowserContextsAndSources()); 32 content::NotificationService::AllBrowserContextsAndSources());
33 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, 33 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED,
34 content::NotificationService::AllBrowserContextsAndSources()); 34 content::NotificationService::AllBrowserContextsAndSources());
35 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 35 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
36 content::Source<content::BrowserContext>(browser_context)); 36 content::Source<content::BrowserContext>(browser_context));
37 } 37 }
38 38
39 LazyBackgroundTaskQueue::~LazyBackgroundTaskQueue() { 39 LazyBackgroundTaskQueue::~LazyBackgroundTaskQueue() {
40 } 40 }
41 41
42 bool LazyBackgroundTaskQueue::ShouldEnqueueTask( 42 bool LazyBackgroundTaskQueue::ShouldEnqueueTask(
43 content::BrowserContext* browser_context, 43 content::BrowserContext* browser_context,
44 const Extension* extension) { 44 const Extension* extension) {
45 DCHECK(extension); 45 DCHECK(extension);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // dispatches the tasks below), but is a good extra precaution. 155 // dispatches the tasks below), but is a good extra precaution.
156 content::BrowserContext* browser_context = 156 content::BrowserContext* browser_context =
157 content::Source<content::BrowserContext>(source).ptr(); 157 content::Source<content::BrowserContext>(source).ptr();
158 ExtensionHost* host = 158 ExtensionHost* host =
159 content::Details<ExtensionHost>(details).ptr(); 159 content::Details<ExtensionHost>(details).ptr();
160 if (host->extension_host_type() == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { 160 if (host->extension_host_type() == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
161 ProcessPendingTasks(NULL, browser_context, host->extension()); 161 ProcessPendingTasks(NULL, browser_context, host->extension());
162 } 162 }
163 break; 163 break;
164 } 164 }
165 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { 165 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: {
166 // Notify consumers that the page failed to load. 166 // Notify consumers that the page failed to load.
167 content::BrowserContext* browser_context = 167 content::BrowserContext* browser_context =
168 content::Source<content::BrowserContext>(source).ptr(); 168 content::Source<content::BrowserContext>(source).ptr();
169 UnloadedExtensionInfo* unloaded = 169 UnloadedExtensionInfo* unloaded =
170 content::Details<UnloadedExtensionInfo>(details).ptr(); 170 content::Details<UnloadedExtensionInfo>(details).ptr();
171 ProcessPendingTasks(NULL, browser_context, unloaded->extension); 171 ProcessPendingTasks(NULL, browser_context, unloaded->extension);
172 // If this extension is also running in an off-the-record context, 172 // If this extension is also running in an off-the-record context,
173 // notify that task queue as well. 173 // notify that task queue as well.
174 ExtensionsBrowserClient* browser_client = ExtensionsBrowserClient::Get(); 174 ExtensionsBrowserClient* browser_client = ExtensionsBrowserClient::Get();
175 if (browser_client->HasOffTheRecordContext(browser_context)) { 175 if (browser_client->HasOffTheRecordContext(browser_context)) {
176 ProcessPendingTasks( 176 ProcessPendingTasks(
177 NULL, 177 NULL,
178 browser_client->GetOffTheRecordContext(browser_context), 178 browser_client->GetOffTheRecordContext(browser_context),
179 unloaded->extension); 179 unloaded->extension);
180 } 180 }
181 break; 181 break;
182 } 182 }
183 default: 183 default:
184 NOTREACHED(); 184 NOTREACHED();
185 break; 185 break;
186 } 186 }
187 } 187 }
188 188
189 } // namespace extensions 189 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/event_router.cc ('k') | extensions/browser/process_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698