| OLD | NEW |
| 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/location.h" | 6 #include "base/location.h" |
| 7 #include "base/logging.h" |
| 7 #include "base/macros.h" | 8 #include "base/macros.h" |
| 8 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 9 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_reauth.h" | 13 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_reauth.h" |
| 12 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 14 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 13 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 14 #include "chromeos/dbus/dbus_thread_manager.h" | 16 #include "chromeos/dbus/dbus_thread_manager.h" |
| 15 #include "chromeos/dbus/session_manager_client.h" | 17 #include "chromeos/dbus/session_manager_client.h" |
| 16 #include "chromeos/login/auth/auth_status_consumer.h" | 18 #include "chromeos/login/auth/auth_status_consumer.h" |
| 17 #include "chromeos/login/auth/user_context.h" | 19 #include "chromeos/login/auth/user_context.h" |
| 18 #include "components/proximity_auth/screenlock_bridge.h" | 20 #include "components/proximity_auth/screenlock_bridge.h" |
| 19 #include "content/public/browser/notification_details.h" | 21 #include "content/public/browser/notification_details.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 89 |
| 88 const user_manager::UserList& lock_users = screen_locker->users(); | 90 const user_manager::UserList& lock_users = screen_locker->users(); |
| 89 DCHECK(lock_users.size() == 1); | 91 DCHECK(lock_users.size() == 1); |
| 90 proximity_auth::ScreenlockBridge::Get() | 92 proximity_auth::ScreenlockBridge::Get() |
| 91 ->lock_handler() | 93 ->lock_handler() |
| 92 ->ShowUserPodCustomIcon(lock_users[0]->GetAccountId(), icon_options); | 94 ->ShowUserPodCustomIcon(lock_users[0]->GetAccountId(), icon_options); |
| 93 } | 95 } |
| 94 | 96 |
| 95 // chromeos::AuthStatusConsumer: | 97 // chromeos::AuthStatusConsumer: |
| 96 void OnAuthSuccess(const chromeos::UserContext& user_context) override { | 98 void OnAuthSuccess(const chromeos::UserContext& user_context) override { |
| 99 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 97 callback_.Run(user_context); | 100 callback_.Run(user_context); |
| 98 // Schedule deletion. | 101 // Schedule deletion. |
| 99 base::MessageLoopForUI::current()->task_runner()->PostTask( | 102 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 100 FROM_HERE, base::Bind(&EndReauthAttempt)); | 103 FROM_HERE, base::Bind(&EndReauthAttempt)); |
| 101 } | 104 } |
| 102 | 105 |
| 103 void OnAuthFailure(const chromeos::AuthFailure& error) override {} | 106 void OnAuthFailure(const chromeos::AuthFailure& error) override {} |
| 104 | 107 |
| 105 private: | 108 private: |
| 106 content::NotificationRegistrar notification_registrar_; | 109 content::NotificationRegistrar notification_registrar_; |
| 107 EasyUnlockReauth::UserContextCallback callback_; | 110 EasyUnlockReauth::UserContextCallback callback_; |
| 108 | 111 |
| 109 DISALLOW_COPY_AND_ASSIGN(ReauthHandler); | 112 DISALLOW_COPY_AND_ASSIGN(ReauthHandler); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 125 base::Callback<void(const UserContext&)> callback) { | 128 base::Callback<void(const UserContext&)> callback) { |
| 126 DCHECK(base::MessageLoopForUI::IsCurrent()); | 129 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 127 if (g_reauth_handler) | 130 if (g_reauth_handler) |
| 128 return false; | 131 return false; |
| 129 | 132 |
| 130 g_reauth_handler = new ReauthHandler(callback); | 133 g_reauth_handler = new ReauthHandler(callback); |
| 131 return g_reauth_handler->Start(); | 134 return g_reauth_handler->Start(); |
| 132 } | 135 } |
| 133 | 136 |
| 134 } // namespace chromeos | 137 } // namespace chromeos |
| OLD | NEW |