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

Side by Side Diff: chrome/browser/chromeos/extensions/screenlock_private_api.cc

Issue 238963002: Use EventRouter instead of ExtensionSystem::Get->event_router() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/extensions/screenlock_private_api.h" 5 #include "chrome/browser/chromeos/extensions/screenlock_private_api.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/chromeos/login/screen_locker.h" 9 #include "chrome/browser/chromeos/login/screen_locker.h"
10 #include "chrome/browser/extensions/image_loader.h" 10 #include "chrome/browser/extensions/image_loader.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 } 266 }
267 267
268 void ScreenlockPrivateEventRouter::DispatchEvent( 268 void ScreenlockPrivateEventRouter::DispatchEvent(
269 const std::string& event_name, 269 const std::string& event_name,
270 base::Value* arg) { 270 base::Value* arg) {
271 scoped_ptr<base::ListValue> args(new base::ListValue()); 271 scoped_ptr<base::ListValue> args(new base::ListValue());
272 if (arg) 272 if (arg)
273 args->Append(arg); 273 args->Append(arg);
274 scoped_ptr<extensions::Event> event(new extensions::Event( 274 scoped_ptr<extensions::Event> event(new extensions::Event(
275 event_name, args.Pass())); 275 event_name, args.Pass()));
276 extensions::ExtensionSystem::Get(browser_context_) 276 extensions::EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass());
277 ->event_router()
278 ->BroadcastEvent(event.Pass());
279 } 277 }
280 278
281 static base::LazyInstance<extensions::BrowserContextKeyedAPIFactory< 279 static base::LazyInstance<extensions::BrowserContextKeyedAPIFactory<
282 ScreenlockPrivateEventRouter> > g_factory = LAZY_INSTANCE_INITIALIZER; 280 ScreenlockPrivateEventRouter> > g_factory = LAZY_INSTANCE_INITIALIZER;
283 281
284 // static 282 // static
285 extensions::BrowserContextKeyedAPIFactory<ScreenlockPrivateEventRouter>* 283 extensions::BrowserContextKeyedAPIFactory<ScreenlockPrivateEventRouter>*
286 ScreenlockPrivateEventRouter::GetFactoryInstance() { 284 ScreenlockPrivateEventRouter::GetFactoryInstance() {
287 return g_factory.Pointer(); 285 return g_factory.Pointer();
288 } 286 }
(...skipping 12 matching lines...) Expand all
301 void ScreenlockPrivateEventRouter::OnAuthAttempted( 299 void ScreenlockPrivateEventRouter::OnAuthAttempted(
302 chromeos::LoginDisplay::AuthType auth_type, 300 chromeos::LoginDisplay::AuthType auth_type,
303 const std::string& value) { 301 const std::string& value) {
304 scoped_ptr<base::ListValue> args(new base::ListValue()); 302 scoped_ptr<base::ListValue> args(new base::ListValue());
305 args->AppendString( 303 args->AppendString(
306 screenlock::ToString(ToScreenlockPrivateAuthType(auth_type))); 304 screenlock::ToString(ToScreenlockPrivateAuthType(auth_type)));
307 args->AppendString(value); 305 args->AppendString(value);
308 306
309 scoped_ptr<extensions::Event> event(new extensions::Event( 307 scoped_ptr<extensions::Event> event(new extensions::Event(
310 screenlock::OnAuthAttempted::kEventName, args.Pass())); 308 screenlock::OnAuthAttempted::kEventName, args.Pass()));
311 extensions::ExtensionSystem::Get(browser_context_) 309 extensions::EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass());
312 ->event_router()
313 ->BroadcastEvent(event.Pass());
314 } 310 }
315 311
316 } // namespace extensions 312 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698