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

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

Issue 2399423004: [Extensions] Convert some ChromeSyncExtensionFunctions (Closed)
Patch Set: Created 4 years, 2 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 <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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 SendResponse(error_.empty()); 89 SendResponse(error_.empty());
90 return true; 90 return true;
91 } 91 }
92 92
93 ScreenlockPrivateAcceptAuthAttemptFunction:: 93 ScreenlockPrivateAcceptAuthAttemptFunction::
94 ScreenlockPrivateAcceptAuthAttemptFunction() {} 94 ScreenlockPrivateAcceptAuthAttemptFunction() {}
95 95
96 ScreenlockPrivateAcceptAuthAttemptFunction:: 96 ScreenlockPrivateAcceptAuthAttemptFunction::
97 ~ScreenlockPrivateAcceptAuthAttemptFunction() {} 97 ~ScreenlockPrivateAcceptAuthAttemptFunction() {}
98 98
99 bool ScreenlockPrivateAcceptAuthAttemptFunction::RunSync() { 99 ExtensionFunction::ResponseAction
100 ScreenlockPrivateAcceptAuthAttemptFunction::Run() {
100 std::unique_ptr<screenlock::AcceptAuthAttempt::Params> params( 101 std::unique_ptr<screenlock::AcceptAuthAttempt::Params> params(
101 screenlock::AcceptAuthAttempt::Params::Create(*args_)); 102 screenlock::AcceptAuthAttempt::Params::Create(*args_));
102 EXTENSION_FUNCTION_VALIDATE(params.get()); 103 EXTENSION_FUNCTION_VALIDATE(params.get());
103 104
104 Profile* profile = Profile::FromBrowserContext(browser_context()); 105 Profile* profile = Profile::FromBrowserContext(browser_context());
105 EasyUnlockService* service = EasyUnlockService::Get(profile); 106 EasyUnlockService* service = EasyUnlockService::Get(profile);
106 if (service) 107 if (service)
107 service->FinalizeUnlock(params->accept); 108 service->FinalizeUnlock(params->accept);
108 return true; 109 return RespondNow(NoArguments());
109 } 110 }
110 111
111 ScreenlockPrivateEventRouter::ScreenlockPrivateEventRouter( 112 ScreenlockPrivateEventRouter::ScreenlockPrivateEventRouter(
112 content::BrowserContext* context) 113 content::BrowserContext* context)
113 : browser_context_(context) { 114 : browser_context_(context) {
114 proximity_auth::ScreenlockBridge::Get()->AddObserver(this); 115 proximity_auth::ScreenlockBridge::Get()->AddObserver(this);
115 } 116 }
116 117
117 ScreenlockPrivateEventRouter::~ScreenlockPrivateEventRouter() {} 118 ScreenlockPrivateEventRouter::~ScreenlockPrivateEventRouter() {}
118 119
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 args->AppendString(value); 172 args->AppendString(value);
172 173
173 std::unique_ptr<Event> event( 174 std::unique_ptr<Event> event(
174 new Event(events::SCREENLOCK_PRIVATE_ON_AUTH_ATTEMPTED, 175 new Event(events::SCREENLOCK_PRIVATE_ON_AUTH_ATTEMPTED,
175 screenlock::OnAuthAttempted::kEventName, std::move(args))); 176 screenlock::OnAuthAttempted::kEventName, std::move(args)));
176 router->BroadcastEvent(std::move(event)); 177 router->BroadcastEvent(std::move(event));
177 return true; 178 return true;
178 } 179 }
179 180
180 } // namespace extensions 181 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698