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

Unified Diff: chrome/browser/extensions/window_event_router.cc

Issue 10837170: Fix crash in WindowEventRouter::OnActiveWindowChanged when closing an incognito window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/window_event_router.cc
diff --git a/chrome/browser/extensions/window_event_router.cc b/chrome/browser/extensions/window_event_router.cc
index 00d032b36b5bb34980e6c679c9dc1183e3ae7767..427119bf35283f452b4b4b564f3ccb5de532df50 100644
--- a/chrome/browser/extensions/window_event_router.cc
+++ b/chrome/browser/extensions/window_event_router.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/extensions/window_event_router.h"
-#include "base/json/json_writer.h"
#include "base/values.h"
#include "chrome/browser/extensions/event_names.h"
#include "chrome/browser/extensions/event_router.h"
@@ -128,6 +127,7 @@ void WindowEventRouter::OnActiveWindowChanged(
// window_profile is either the default profile for the active window, its
// incognito profile, or NULL iff the previous profile is losing focus.
+ // Note that |previous_focused_profile| may already be destroyed!
Profile* previous_focused_profile = focused_profile_;
focused_profile_ = window_profile;
focused_window_id_ = window_id;
@@ -135,7 +135,7 @@ void WindowEventRouter::OnActiveWindowChanged(
scoped_ptr<base::ListValue> real_args(new ListValue());
real_args->Append(Value::CreateIntegerValue(window_id));
- // When switching between windows in the default and incognitoi profiles,
+ // When switching between windows in the default and incognito profiles,
// dispatch WINDOW_ID_NONE to extensions whose profile lost focus that
// can't see the new focused window across the incognito boundary.
// See crbug.com/46610.
@@ -146,14 +146,9 @@ void WindowEventRouter::OnActiveWindowChanged(
Value::CreateIntegerValue(extension_misc::kUnknownWindowId));
}
- if (!window_profile)
- window_profile = previous_focused_profile;
- if (!profile_->IsSameProfile(window_profile) ||
- !ExtensionSystem::Get(window_profile)->event_router()) {
- return;
- }
-
- ExtensionSystem::Get(window_profile)->event_router()->
+ // Note that we may pass a NULL |window_profile| for the |restrict_to_profile|
+ // argument.
+ ExtensionSystem::Get(profile_)->event_router()->
DispatchEventsToRenderersAcrossIncognito(
event_names::kOnWindowFocusedChanged,
real_args.Pass(),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698