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

Side by Side Diff: chrome/browser/chromeos/login/user_selection_screen_proxy.cc

Issue 2903353003: Adding mojo calls for easy unlock service (Closed)
Patch Set: comments and rebase Created 3 years, 6 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/login/user_selection_screen_proxy.h"
6
7 #include <utility>
8
9 #include "chrome/browser/ui/ash/lock_screen_client.h"
10
11 namespace chromeos {
12
13 namespace {
14
15 // Converts parameters to a mojo struct that can be sent to the
16 // screenlock view-based UI.
17 ash::mojom::UserPodCustomIconOptionsPtr ToUserPodCustomIconOptionsPtr(
18 const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions&
19 icon_options) {
20 ash::mojom::UserPodCustomIconOptionsPtr icon =
21 ash::mojom::UserPodCustomIconOptions::New();
22 icon->id = icon_options.GetIDString();
23
24 if (!icon_options.tooltip().empty()) {
25 icon->tooltip = icon_options.tooltip();
26 icon->autoshow_tooltip = icon_options.autoshow_tooltip();
27 }
28
29 if (!icon_options.aria_label().empty())
30 icon->aria_label = icon_options.aria_label();
31
32 if (icon_options.hardlock_on_click())
33 icon->hardlock_on_click = true;
34
35 if (icon_options.is_trial_run())
36 icon->is_trial_run = true;
37
38 return icon;
39 }
40
41 } // namespace
42
43 UserSelectionScreenProxy::UserSelectionScreenProxy() = default;
44
45 UserSelectionScreenProxy::~UserSelectionScreenProxy() = default;
46
47 void UserSelectionScreenProxy::ShowUserPodCustomIcon(
48 const AccountId& account_id,
49 const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions&
50 icon_options) {
51 ash::mojom::UserPodCustomIconOptionsPtr icon =
52 ToUserPodCustomIconOptionsPtr(icon_options);
53 if (!icon)
54 return;
55 LockScreenClient::Get()->ShowUserPodCustomIcon(account_id, std::move(icon));
56 }
57
58 void UserSelectionScreenProxy::HideUserPodCustomIcon(
59 const AccountId& account_id) {
60 LockScreenClient::Get()->HideUserPodCustomIcon(account_id);
61 }
62
63 void UserSelectionScreenProxy::SetAuthType(
64 const AccountId& account_id,
65 proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type,
66 const base::string16& initial_value) {
67 LockScreenClient::Get()->SetAuthType(
68 account_id, static_cast<ash::mojom::AuthType>(auth_type), initial_value);
69 }
70
71 base::WeakPtr<chromeos::UserBoardView> UserSelectionScreenProxy::GetWeakPtr() {
72 return base::WeakPtr<chromeos::UserBoardView>();
73 }
74
75 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_selection_screen_proxy.h ('k') | chrome/browser/ui/ash/lock_screen_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698