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

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

Issue 10559052: Split mode incognito extension can get misleading pref changed events from regular mode (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Wrote test Created 8 years, 6 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/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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 listener_profile->GetExtensionService()->process_map(); 422 listener_profile->GetExtensionService()->process_map();
423 // If the event is privileged, only send to extension processes. Otherwise, 423 // If the event is privileged, only send to extension processes. Otherwise,
424 // it's OK to send to normal renderers (e.g., for content scripts). 424 // it's OK to send to normal renderers (e.g., for content scripts).
425 if (ExtensionAPI::GetSharedInstance()->IsPrivileged(event->event_name) && 425 if (ExtensionAPI::GetSharedInstance()->IsPrivileged(event->event_name) &&
426 !process_map->Contains(extension->id(), process->GetID())) { 426 !process_map->Contains(extension->id(), process->GetID())) {
427 return; 427 return;
428 } 428 }
429 429
430 const Value* event_args = NULL; 430 const Value* event_args = NULL;
431 if (!CanDispatchEventToProfile(listener_profile, extension, 431 if (!CanDispatchEventToProfile(listener_profile, extension,
432 event, &event_args)) 432 event, &event_args)) {
433 return; 433 return;
434 }
434 435
435 DispatchEvent(process, extension_id, 436 DispatchEvent(process, extension_id,
436 event->event_name, *event_args, 437 event->event_name, *event_args,
437 event->event_url, event->user_gesture, 438 event->event_url, event->user_gesture,
438 event->info); 439 event->info);
439 IncrementInFlightEvents(listener_profile, extension); 440 IncrementInFlightEvents(listener_profile, extension);
440 } 441 }
441 442
442 bool ExtensionEventRouter::CanDispatchEventToProfile( 443 bool ExtensionEventRouter::CanDispatchEventToProfile(
443 Profile* profile, 444 Profile* profile,
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 event_args(event_args.DeepCopy()), 616 event_args(event_args.DeepCopy()),
616 event_url(event_url), 617 event_url(event_url),
617 restrict_to_profile(restrict_to_profile), 618 restrict_to_profile(restrict_to_profile),
618 cross_incognito_args(NULL), 619 cross_incognito_args(NULL),
619 user_gesture(user_gesture), 620 user_gesture(user_gesture),
620 info(info) { 621 info(info) {
621 } 622 }
622 623
623 ExtensionEvent::~ExtensionEvent() { 624 ExtensionEvent::~ExtensionEvent() {
624 } 625 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698