Chromium Code Reviews| 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 dc056de22018f4026d00c98d7a01c30d8a0557a9..7b2c68f37c0a28c26ef3044540abc265efa2baf7 100644 |
| --- a/chrome/browser/extensions/window_event_router.cc |
| +++ b/chrome/browser/extensions/window_event_router.cc |
| @@ -128,6 +128,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; |
| @@ -137,7 +138,7 @@ void WindowEventRouter::OnActiveWindowChanged( |
| std::string real_json_args; |
| base::JSONWriter::Write(&real_args, &real_json_args); |
| - // 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. |
| @@ -150,14 +151,10 @@ void WindowEventRouter::OnActiveWindowChanged( |
| base::JSONWriter::Write(&none_args, &none_json_args); |
| } |
| - if (!window_profile) |
| - window_profile = previous_focused_profile; |
| - if (!profile_->IsSameProfile(window_profile) || |
| - !ExtensionSystem::Get(window_profile)->event_router()) { |
| + if ((window_profile && !profile_->IsSameProfile(window_profile))) |
|
Yoyo Zhou
2012/08/08 19:36:58
excessive parentheses
dcheng
2012/08/08 20:05:56
Already removed in my latest snapshot.
|
| return; |
| - } |
| - ExtensionSystem::Get(window_profile)->event_router()-> |
| + ExtensionSystem::Get(profile_)->event_router()-> |
|
Yoyo Zhou
2012/08/08 19:36:58
This seems to be the important fix.
|
| DispatchEventsToRenderersAcrossIncognito( |
| event_names::kOnWindowFocusedChanged, |
| real_json_args, |