OLD | NEW |
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/extensions/api/screenlock_private/screenlock_private_ap
i.h" | 5 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap
i.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 const std::string& event_name, | 139 const std::string& event_name, |
140 std::unique_ptr<base::Value> arg) { | 140 std::unique_ptr<base::Value> arg) { |
141 std::unique_ptr<base::ListValue> args(new base::ListValue()); | 141 std::unique_ptr<base::ListValue> args(new base::ListValue()); |
142 if (arg) | 142 if (arg) |
143 args->Append(std::move(arg)); | 143 args->Append(std::move(arg)); |
144 std::unique_ptr<Event> event( | 144 std::unique_ptr<Event> event( |
145 new Event(histogram_value, event_name, std::move(args))); | 145 new Event(histogram_value, event_name, std::move(args))); |
146 EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event)); | 146 EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event)); |
147 } | 147 } |
148 | 148 |
149 static base::LazyInstance< | 149 static base::LazyInstance<BrowserContextKeyedAPIFactory< |
150 BrowserContextKeyedAPIFactory<ScreenlockPrivateEventRouter>> g_factory = | 150 ScreenlockPrivateEventRouter>>::DestructorAtExit g_factory = |
151 LAZY_INSTANCE_INITIALIZER; | 151 LAZY_INSTANCE_INITIALIZER; |
152 | 152 |
153 // static | 153 // static |
154 BrowserContextKeyedAPIFactory<ScreenlockPrivateEventRouter>* | 154 BrowserContextKeyedAPIFactory<ScreenlockPrivateEventRouter>* |
155 ScreenlockPrivateEventRouter::GetFactoryInstance() { | 155 ScreenlockPrivateEventRouter::GetFactoryInstance() { |
156 return g_factory.Pointer(); | 156 return g_factory.Pointer(); |
157 } | 157 } |
158 | 158 |
159 void ScreenlockPrivateEventRouter::Shutdown() { | 159 void ScreenlockPrivateEventRouter::Shutdown() { |
160 proximity_auth::ScreenlockBridge::Get()->RemoveObserver(this); | 160 proximity_auth::ScreenlockBridge::Get()->RemoveObserver(this); |
(...skipping 11 matching lines...) Expand all Loading... |
172 args->AppendString(value); | 172 args->AppendString(value); |
173 | 173 |
174 std::unique_ptr<Event> event( | 174 std::unique_ptr<Event> event( |
175 new Event(events::SCREENLOCK_PRIVATE_ON_AUTH_ATTEMPTED, | 175 new Event(events::SCREENLOCK_PRIVATE_ON_AUTH_ATTEMPTED, |
176 screenlock::OnAuthAttempted::kEventName, std::move(args))); | 176 screenlock::OnAuthAttempted::kEventName, std::move(args))); |
177 router->BroadcastEvent(std::move(event)); | 177 router->BroadcastEvent(std::move(event)); |
178 return true; | 178 return true; |
179 } | 179 } |
180 | 180 |
181 } // namespace extensions | 181 } // namespace extensions |
OLD | NEW |