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

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

Issue 10829263: Fixing cross-incognito dispatch of onFocusChanged event. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/window_event_router.h" 5 #include "chrome/browser/extensions/window_event_router.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/extensions/event_names.h" 8 #include "chrome/browser/extensions/event_names.h"
9 #include "chrome/browser/extensions/event_router.h" 9 #include "chrome/browser/extensions/event_router.h"
10 #include "chrome/browser/extensions/extension_system.h" 10 #include "chrome/browser/extensions/extension_system.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 focused_profile_ = window_profile; 132 focused_profile_ = window_profile;
133 focused_window_id_ = window_id; 133 focused_window_id_ = window_id;
134 134
135 scoped_ptr<base::ListValue> real_args(new ListValue()); 135 scoped_ptr<base::ListValue> real_args(new ListValue());
136 real_args->Append(Value::CreateIntegerValue(window_id)); 136 real_args->Append(Value::CreateIntegerValue(window_id));
137 137
138 // When switching between windows in the default and incognito profiles, 138 // When switching between windows in the default and incognito profiles,
139 // dispatch WINDOW_ID_NONE to extensions whose profile lost focus that 139 // dispatch WINDOW_ID_NONE to extensions whose profile lost focus that
140 // can't see the new focused window across the incognito boundary. 140 // can't see the new focused window across the incognito boundary.
141 // See crbug.com/46610. 141 // See crbug.com/46610.
142 scoped_ptr<base::ListValue> none_args(new ListValue()); 142 scoped_ptr<base::ListValue> none_args(NULL);
143 if (focused_profile_ != NULL && previous_focused_profile != NULL && 143 if (focused_profile_ != NULL && previous_focused_profile != NULL &&
144 focused_profile_ != previous_focused_profile) { 144 focused_profile_ != previous_focused_profile) {
145 none_args->Append( 145 none_args.reset(new ListValue());
146 Value::CreateIntegerValue(extension_misc::kUnknownWindowId)); 146 none_args->Append(Value::CreateIntegerValue(
147 extension_misc::kUnknownWindowId));
147 } 148 }
148 149
149 // Note that we may pass a NULL |window_profile| for the |restrict_to_profile| 150 // Note that we may pass a NULL |window_profile| for the |restrict_to_profile|
150 // argument. 151 // argument.
151 ExtensionSystem::Get(profile_)->event_router()-> 152 ExtensionSystem::Get(profile_)->event_router()->
152 DispatchEventsToRenderersAcrossIncognito( 153 DispatchEventsToRenderersAcrossIncognito(
153 event_names::kOnWindowFocusedChanged, 154 event_names::kOnWindowFocusedChanged,
154 real_args.Pass(), 155 real_args.Pass(),
155 window_profile, 156 window_profile,
156 none_args.Pass(), 157 none_args.Pass(),
157 GURL()); 158 GURL());
158 } 159 }
159 160
160 void WindowEventRouter::DispatchEvent(const char* event_name, 161 void WindowEventRouter::DispatchEvent(const char* event_name,
161 Profile* profile, 162 Profile* profile,
162 scoped_ptr<base::ListValue> args) { 163 scoped_ptr<base::ListValue> args) {
163 ExtensionSystem::Get(profile)->event_router()-> 164 ExtensionSystem::Get(profile)->event_router()->
164 DispatchEventToRenderers(event_name, args.Pass(), profile, GURL()); 165 DispatchEventToRenderers(event_name, args.Pass(), profile, GURL());
165 } 166 }
166 167
167 } // namespace extensions 168 } // namespace extensions
OLDNEW
« 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