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

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

Issue 10804020: Introduce runtime.onSuspendCanceled() event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: delete dead code Created 8 years, 5 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/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 !process_map->Contains(extension->id(), process->GetID())) { 429 !process_map->Contains(extension->id(), process->GetID())) {
430 return; 430 return;
431 } 431 }
432 432
433 const Value* event_args = NULL; 433 const Value* event_args = NULL;
434 if (!CanDispatchEventToProfile(listener_profile, extension, 434 if (!CanDispatchEventToProfile(listener_profile, extension,
435 event, &event_args)) { 435 event, &event_args)) {
436 return; 436 return;
437 } 437 }
438 438
439 CancelSuspend(listener_profile, extension);
koz (OOO until 15th September) 2012/07/19 06:52:12 mpcomplete@: I'm assuming that this is the only pl
Matt Perry 2012/07/19 21:36:22 It depends on what we want to cancel a suspend. Ju
koz (OOO until 15th September) 2012/07/20 06:08:09 My reading of ExtensionMessageService indicates th
Matt Perry 2012/07/20 18:04:17 After thinking about it some more, I think it make
440
439 DispatchEvent(process, extension_id, 441 DispatchEvent(process, extension_id,
440 event->event_name, *event_args, 442 event->event_name, *event_args,
441 event->event_url, event->user_gesture, 443 event->event_url, event->user_gesture,
442 event->info); 444 event->info);
443 IncrementInFlightEvents(listener_profile, extension); 445 IncrementInFlightEvents(listener_profile, extension);
444 } 446 }
445 447
448 void ExtensionEventRouter::CancelSuspend(Profile* profile,
449 const Extension* extension) {
450 if (extension->has_lazy_background_page()) {
451 ExtensionProcessManager* pm =
452 extensions::ExtensionSystem::Get(profile)->process_manager();
453 pm->CancelSuspend(extension);
454 }
455 }
456
446 bool ExtensionEventRouter::CanDispatchEventToProfile( 457 bool ExtensionEventRouter::CanDispatchEventToProfile(
447 Profile* profile, 458 Profile* profile,
448 const Extension* extension, 459 const Extension* extension,
449 const linked_ptr<ExtensionEvent>& event, 460 const linked_ptr<ExtensionEvent>& event,
450 const Value** event_args) { 461 const Value** event_args) {
451 *event_args = event->event_args.get(); 462 *event_args = event->event_args.get();
452 463
453 // Is this event from a different profile than the renderer (ie, an 464 // Is this event from a different profile than the renderer (ie, an
454 // incognito tab event sent to a normal process, or vice versa). 465 // incognito tab event sent to a normal process, or vice versa).
455 bool cross_incognito = event->restrict_to_profile && 466 bool cross_incognito = event->restrict_to_profile &&
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 event_args(event_args.DeepCopy()), 630 event_args(event_args.DeepCopy()),
620 event_url(event_url), 631 event_url(event_url),
621 restrict_to_profile(restrict_to_profile), 632 restrict_to_profile(restrict_to_profile),
622 cross_incognito_args(NULL), 633 cross_incognito_args(NULL),
623 user_gesture(user_gesture), 634 user_gesture(user_gesture),
624 info(info) { 635 info(info) {
625 } 636 }
626 637
627 ExtensionEvent::~ExtensionEvent() { 638 ExtensionEvent::~ExtensionEvent() {
628 } 639 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698