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

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

Issue 10832063: Don't dispatch window focus change events to other profiles. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
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
« 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/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/extensions/event_names.h" 9 #include "chrome/browser/extensions/event_names.h"
10 #include "chrome/browser/extensions/event_router.h" 10 #include "chrome/browser/extensions/event_router.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 if (focused_profile_ != NULL && previous_focused_profile != NULL && 145 if (focused_profile_ != NULL && previous_focused_profile != NULL &&
146 focused_profile_ != previous_focused_profile) { 146 focused_profile_ != previous_focused_profile) {
147 ListValue none_args; 147 ListValue none_args;
148 none_args.Append( 148 none_args.Append(
149 Value::CreateIntegerValue(extension_misc::kUnknownWindowId)); 149 Value::CreateIntegerValue(extension_misc::kUnknownWindowId));
150 base::JSONWriter::Write(&none_args, &none_json_args); 150 base::JSONWriter::Write(&none_args, &none_json_args);
151 } 151 }
152 152
153 if (!window_profile) 153 if (!window_profile)
154 window_profile = previous_focused_profile; 154 window_profile = previous_focused_profile;
155 if (!profile_->IsSameProfile(window_profile) ||
156 !ExtensionSystem::Get(window_profile)->event_router()) {
157 return;
158 }
155 159
156 ExtensionSystem::Get(window_profile)->event_router()-> 160 ExtensionSystem::Get(window_profile)->event_router()->
157 DispatchEventsToRenderersAcrossIncognito( 161 DispatchEventsToRenderersAcrossIncognito(
158 event_names::kOnWindowFocusedChanged, 162 event_names::kOnWindowFocusedChanged,
159 real_json_args, 163 real_json_args,
160 window_profile, 164 window_profile,
161 none_json_args, 165 none_json_args,
162 GURL()); 166 GURL());
163 } 167 }
164 168
165 void WindowEventRouter::DispatchEvent(const char* event_name, 169 void WindowEventRouter::DispatchEvent(const char* event_name,
166 Profile* profile, 170 Profile* profile,
167 base::ListValue* args) { 171 base::ListValue* args) {
168 std::string json_args; 172 std::string json_args;
169 base::JSONWriter::Write(args, &json_args); 173 base::JSONWriter::Write(args, &json_args);
170 ExtensionSystem::Get(profile)->event_router()-> 174 ExtensionSystem::Get(profile)->event_router()->
171 DispatchEventToRenderers(event_name, json_args, profile, GURL()); 175 DispatchEventToRenderers(event_name, json_args, profile, GURL());
172 } 176 }
173 177
174 } // namespace extensions 178 } // 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