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

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

Issue 10824030: Move ExtensionHost into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest master for cq Created 8 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
OLDNEW
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 "base/message_loop.h" 8 #include "base/message_loop.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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 136 }
137 137
138 void LazyBackgroundTaskQueue::Observe( 138 void LazyBackgroundTaskQueue::Observe(
139 int type, 139 int type,
140 const content::NotificationSource& source, 140 const content::NotificationSource& source,
141 const content::NotificationDetails& details) { 141 const content::NotificationDetails& details) {
142 switch (type) { 142 switch (type) {
143 case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: { 143 case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: {
144 // If an on-demand background page finished loading, dispatch queued up 144 // If an on-demand background page finished loading, dispatch queued up
145 // events for it. 145 // events for it.
146 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); 146 ExtensionHost* host =
147 content::Details<ExtensionHost>(details).ptr();
147 if (host->extension_host_type() == 148 if (host->extension_host_type() ==
148 chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { 149 chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
149 CHECK(host->did_stop_loading()); 150 CHECK(host->did_stop_loading());
150 ProcessPendingTasks(host, host->profile(), host->extension()); 151 ProcessPendingTasks(host, host->profile(), host->extension());
151 } 152 }
152 break; 153 break;
153 } 154 }
154 case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: { 155 case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: {
155 Profile* profile = content::Source<Profile>(source).ptr(); 156 Profile* profile = content::Source<Profile>(source).ptr();
156 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); 157 ExtensionHost* host =
158 content::Details<ExtensionHost>(details).ptr();
157 if (host->extension_host_type() == 159 if (host->extension_host_type() ==
158 chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { 160 chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
159 PendingTasksKey key(profile, host->extension()->id()); 161 PendingTasksKey key(profile, host->extension()->id());
160 if (pending_page_loads_.count(key) > 0) { 162 if (pending_page_loads_.count(key) > 0) {
161 // We were waiting for the background page to unload. We can start it 163 // We were waiting for the background page to unload. We can start it
162 // up again and dispatch any queued events. 164 // up again and dispatch any queued events.
163 MessageLoop::current()->PostTask(FROM_HERE, base::Bind( 165 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
164 &LazyBackgroundTaskQueue::StartLazyBackgroundPage, 166 &LazyBackgroundTaskQueue::StartLazyBackgroundPage,
165 AsWeakPtr(), profile, host->extension()->id())); 167 AsWeakPtr(), profile, host->extension()->id()));
166 } else { 168 } else {
(...skipping 18 matching lines...) Expand all
185 } 187 }
186 break; 188 break;
187 } 189 }
188 default: 190 default:
189 NOTREACHED(); 191 NOTREACHED();
190 break; 192 break;
191 } 193 }
192 } 194 }
193 195
194 } // namespace extensions 196 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/lazy_background_task_queue.h ('k') | chrome/browser/extensions/message_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698