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

Side by Side Diff: chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc

Issue 1549233002: Convert Pass()→std::move() in //chrome/browser/extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 12 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/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 <utility>
8
7 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
8 #include "base/values.h" 10 #include "base/values.h"
9 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/signin/chrome_proximity_auth_client.h" 12 #include "chrome/browser/signin/chrome_proximity_auth_client.h"
11 #include "chrome/browser/signin/easy_unlock_service.h" 13 #include "chrome/browser/signin/easy_unlock_service.h"
12 #include "chrome/common/extensions/api/screenlock_private.h" 14 #include "chrome/common/extensions/api/screenlock_private.h"
13 #include "chrome/common/extensions/extension_constants.h" 15 #include "chrome/common/extensions/extension_constants.h"
14 #include "components/proximity_auth/screenlock_bridge.h" 16 #include "components/proximity_auth/screenlock_bridge.h"
15 #include "extensions/browser/app_window/app_window_registry.h" 17 #include "extensions/browser/app_window/app_window_registry.h"
16 #include "extensions/browser/event_router.h" 18 #include "extensions/browser/event_router.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 void ScreenlockPrivateEventRouter::OnFocusedUserChanged( 131 void ScreenlockPrivateEventRouter::OnFocusedUserChanged(
130 const AccountId& account_id) {} 132 const AccountId& account_id) {}
131 133
132 void ScreenlockPrivateEventRouter::DispatchEvent( 134 void ScreenlockPrivateEventRouter::DispatchEvent(
133 events::HistogramValue histogram_value, 135 events::HistogramValue histogram_value,
134 const std::string& event_name, 136 const std::string& event_name,
135 base::Value* arg) { 137 base::Value* arg) {
136 scoped_ptr<base::ListValue> args(new base::ListValue()); 138 scoped_ptr<base::ListValue> args(new base::ListValue());
137 if (arg) 139 if (arg)
138 args->Append(arg); 140 args->Append(arg);
139 scoped_ptr<Event> event(new Event(histogram_value, event_name, args.Pass())); 141 scoped_ptr<Event> event(
140 EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); 142 new Event(histogram_value, event_name, std::move(args)));
143 EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event));
141 } 144 }
142 145
143 static base::LazyInstance< 146 static base::LazyInstance<
144 BrowserContextKeyedAPIFactory<ScreenlockPrivateEventRouter>> g_factory = 147 BrowserContextKeyedAPIFactory<ScreenlockPrivateEventRouter>> g_factory =
145 LAZY_INSTANCE_INITIALIZER; 148 LAZY_INSTANCE_INITIALIZER;
146 149
147 // static 150 // static
148 BrowserContextKeyedAPIFactory<ScreenlockPrivateEventRouter>* 151 BrowserContextKeyedAPIFactory<ScreenlockPrivateEventRouter>*
149 ScreenlockPrivateEventRouter::GetFactoryInstance() { 152 ScreenlockPrivateEventRouter::GetFactoryInstance() {
150 return g_factory.Pointer(); 153 return g_factory.Pointer();
151 } 154 }
152 155
153 void ScreenlockPrivateEventRouter::Shutdown() { 156 void ScreenlockPrivateEventRouter::Shutdown() {
154 proximity_auth::ScreenlockBridge::Get()->RemoveObserver(this); 157 proximity_auth::ScreenlockBridge::Get()->RemoveObserver(this);
155 } 158 }
156 159
157 bool ScreenlockPrivateEventRouter::OnAuthAttempted( 160 bool ScreenlockPrivateEventRouter::OnAuthAttempted(
158 proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, 161 proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type,
159 const std::string& value) { 162 const std::string& value) {
160 EventRouter* router = EventRouter::Get(browser_context_); 163 EventRouter* router = EventRouter::Get(browser_context_);
161 if (!router->HasEventListener(screenlock::OnAuthAttempted::kEventName)) 164 if (!router->HasEventListener(screenlock::OnAuthAttempted::kEventName))
162 return false; 165 return false;
163 166
164 scoped_ptr<base::ListValue> args(new base::ListValue()); 167 scoped_ptr<base::ListValue> args(new base::ListValue());
165 args->AppendString(screenlock::ToString(FromLockHandlerAuthType(auth_type))); 168 args->AppendString(screenlock::ToString(FromLockHandlerAuthType(auth_type)));
166 args->AppendString(value); 169 args->AppendString(value);
167 170
168 scoped_ptr<Event> event( 171 scoped_ptr<Event> event(
169 new Event(events::SCREENLOCK_PRIVATE_ON_AUTH_ATTEMPTED, 172 new Event(events::SCREENLOCK_PRIVATE_ON_AUTH_ATTEMPTED,
170 screenlock::OnAuthAttempted::kEventName, args.Pass())); 173 screenlock::OnAuthAttempted::kEventName, std::move(args)));
171 router->BroadcastEvent(event.Pass()); 174 router->BroadcastEvent(std::move(event));
172 return true; 175 return true;
173 } 176 }
174 177
175 } // namespace extensions 178 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698