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

Side by Side Diff: chrome/browser/chromeos/login/easy_unlock/easy_unlock_reauth.cc

Issue 1096293003: Move screenlock_bridge to components/proximity_auth (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_reauth.h" 8 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_reauth.h"
9 #include "chrome/browser/chromeos/login/lock/screen_locker.h" 9 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
10 #include "chrome/browser/signin/screenlock_bridge.h" 10 #include "chrome/browser/signin/proximity_auth_facade.h"
11 #include "chrome/grit/generated_resources.h" 11 #include "chrome/grit/generated_resources.h"
12 #include "chromeos/dbus/dbus_thread_manager.h" 12 #include "chromeos/dbus/dbus_thread_manager.h"
13 #include "chromeos/dbus/session_manager_client.h" 13 #include "chromeos/dbus/session_manager_client.h"
14 #include "chromeos/login/auth/auth_status_consumer.h" 14 #include "chromeos/login/auth/auth_status_consumer.h"
15 #include "chromeos/login/auth/user_context.h" 15 #include "chromeos/login/auth/user_context.h"
16 #include "components/proximity_auth/screenlock_bridge.h"
16 #include "content/public/browser/notification_details.h" 17 #include "content/public/browser/notification_details.h"
17 #include "content/public/browser/notification_observer.h" 18 #include "content/public/browser/notification_observer.h"
18 #include "content/public/browser/notification_registrar.h" 19 #include "content/public/browser/notification_registrar.h"
19 #include "content/public/browser/notification_service.h" 20 #include "content/public/browser/notification_service.h"
20 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
21 22
22 namespace chromeos { 23 namespace chromeos {
23 24
24 namespace { 25 namespace {
25 26
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 bool is_screen_locked = *content::Details<bool>(details).ptr(); 68 bool is_screen_locked = *content::Details<bool>(details).ptr();
68 DCHECK(is_screen_locked); 69 DCHECK(is_screen_locked);
69 notification_registrar_.RemoveAll(); 70 notification_registrar_.RemoveAll();
70 71
71 // TODO(tengs): Add an explicit reauth state to the locker and account 72 // TODO(tengs): Add an explicit reauth state to the locker and account
72 // picker, so we can customize the UI. 73 // picker, so we can customize the UI.
73 ScreenLocker* screen_locker = ScreenLocker::default_screen_locker(); 74 ScreenLocker* screen_locker = ScreenLocker::default_screen_locker();
74 screen_locker->SetLoginStatusConsumer(this); 75 screen_locker->SetLoginStatusConsumer(this);
75 76
76 // Show tooltip explaining reauth. 77 // Show tooltip explaining reauth.
77 ScreenlockBridge::UserPodCustomIconOptions icon_options; 78 proximity_auth::ScreenlockBridge::UserPodCustomIconOptions icon_options;
78 icon_options.SetIcon(ScreenlockBridge::USER_POD_CUSTOM_ICON_NONE); 79 icon_options.SetIcon(
80 proximity_auth::ScreenlockBridge::USER_POD_CUSTOM_ICON_NONE);
79 icon_options.SetTooltip( 81 icon_options.SetTooltip(
80 l10n_util::GetStringUTF16( 82 l10n_util::GetStringUTF16(
81 IDS_SMART_LOCK_SCREENLOCK_TOOLTIP_HARDLOCK_REAUTH_USER), 83 IDS_SMART_LOCK_SCREENLOCK_TOOLTIP_HARDLOCK_REAUTH_USER),
82 true); 84 true);
83 85
84 const user_manager::UserList& lock_users = screen_locker->users(); 86 const user_manager::UserList& lock_users = screen_locker->users();
85 DCHECK(lock_users.size() == 1); 87 DCHECK(lock_users.size() == 1);
86 ScreenlockBridge::Get()->lock_handler()->ShowUserPodCustomIcon( 88 GetScreenlockBridgeInstance()->lock_handler()->ShowUserPodCustomIcon(
87 lock_users[0]->email(), icon_options); 89 lock_users[0]->email(), icon_options);
88 } 90 }
89 91
90 // chromeos::AuthStatusConsumer: 92 // chromeos::AuthStatusConsumer:
91 void OnAuthSuccess(const chromeos::UserContext& user_context) override { 93 void OnAuthSuccess(const chromeos::UserContext& user_context) override {
92 callback_.Run(user_context); 94 callback_.Run(user_context);
93 // Schedule deletion. 95 // Schedule deletion.
94 base::MessageLoopForUI::current()->PostTask(FROM_HERE, 96 base::MessageLoopForUI::current()->PostTask(FROM_HERE,
95 base::Bind(&EndReauthAttempt)); 97 base::Bind(&EndReauthAttempt));
96 } 98 }
(...skipping 23 matching lines...) Expand all
120 base::Callback<void(const UserContext&)> callback) { 122 base::Callback<void(const UserContext&)> callback) {
121 DCHECK(base::MessageLoopForUI::IsCurrent()); 123 DCHECK(base::MessageLoopForUI::IsCurrent());
122 if (g_reauth_handler) 124 if (g_reauth_handler)
123 return false; 125 return false;
124 126
125 g_reauth_handler = new ReauthHandler(callback); 127 g_reauth_handler = new ReauthHandler(callback);
126 return g_reauth_handler->Start(); 128 return g_reauth_handler->Start();
127 } 129 }
128 130
129 } // namespace chromeos 131 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698