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

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

Issue 9150008: Introduce background.scripts feature for extension manifests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 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 (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/extension_event_router.h" 5 #include "chrome/browser/extensions/extension_event_router.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/extensions/extension_devtools_manager.h" 10 #include "chrome/browser/extensions/extension_devtools_manager.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 switches::kEnableLazyBackgroundPages)) 217 switches::kEnableLazyBackgroundPages))
218 return true; 218 return true;
219 219
220 if (extension_id.empty()) 220 if (extension_id.empty())
221 // TODO(tessamac): Create all background pages. Wait for all to be loaded? 221 // TODO(tessamac): Create all background pages. Wait for all to be loaded?
222 // or dispatch event to each extension when it's ready? 222 // or dispatch event to each extension when it's ready?
223 return true; 223 return true;
224 224
225 const Extension* extension = profile_->GetExtensionService()-> 225 const Extension* extension = profile_->GetExtensionService()->
226 GetExtensionById(extension_id, false); // exclude disabled extensions 226 GetExtensionById(extension_id, false); // exclude disabled extensions
227 if (extension && extension->background_url().is_valid()) { 227 if (extension && extension->has_background_page()) {
228 ExtensionProcessManager* pm = profile_->GetExtensionProcessManager(); 228 ExtensionProcessManager* pm = profile_->GetExtensionProcessManager();
229 if (!pm->GetBackgroundHostForExtension(extension_id)) { 229 if (!pm->GetBackgroundHostForExtension(extension_id)) {
230 pm->CreateBackgroundHost(extension, extension->background_url()); 230 pm->CreateBackgroundHost(extension, extension->GetBackgroundURL());
231 return false; 231 return false;
232 } 232 }
233 } 233 }
234 234
235 return true; 235 return true;
236 } 236 }
237 237
238 void ExtensionEventRouter::DispatchEventImpl( 238 void ExtensionEventRouter::DispatchEventImpl(
239 const linked_ptr<ExtensionEvent>& event, bool was_pending) { 239 const linked_ptr<ExtensionEvent>& event, bool was_pending) {
240 if (!profile_) 240 if (!profile_)
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 ExtensionHost* eh = content::Details<ExtensionHost>(details).ptr(); 392 ExtensionHost* eh = content::Details<ExtensionHost>(details).ptr();
393 DispatchPendingEvents(eh->extension_id()); 393 DispatchPendingEvents(eh->extension_id());
394 break; 394 break;
395 } 395 }
396 // TODO(tessamac): if background page crashed/failed clear queue. 396 // TODO(tessamac): if background page crashed/failed clear queue.
397 default: 397 default:
398 NOTREACHED(); 398 NOTREACHED();
399 return; 399 return;
400 } 400 }
401 } 401 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698