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

Side by Side Diff: chrome/browser/chromeos/login/screens/user_selection_screen.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 "chrome/browser/chromeos/login/screens/user_selection_screen.h" 5 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/browser_process_platform_part.h" 12 #include "chrome/browser/browser_process_platform_part.h"
13 #include "chrome/browser/chromeos/login/lock/screen_locker.h" 13 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
14 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" 14 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
15 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" 15 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h"
16 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" 16 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
17 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" 17 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h"
18 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 18 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
19 #include "chrome/browser/chromeos/profiles/profile_helper.h" 19 #include "chrome/browser/chromeos/profiles/profile_helper.h"
20 #include "chrome/browser/signin/easy_unlock_service.h" 20 #include "chrome/browser/signin/easy_unlock_service.h"
21 #include "chrome/browser/signin/screenlock_bridge.h" 21 #include "chrome/browser/signin/proximity_auth_facade.h"
22 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" 22 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h"
23 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" 23 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
24 #include "components/proximity_auth/screenlock_bridge.h"
24 #include "components/user_manager/user_id.h" 25 #include "components/user_manager/user_id.h"
25 #include "components/user_manager/user_manager.h" 26 #include "components/user_manager/user_manager.h"
26 #include "components/user_manager/user_type.h" 27 #include "components/user_manager/user_type.h"
27 #include "ui/base/user_activity/user_activity_detector.h" 28 #include "ui/base/user_activity/user_activity_detector.h"
28 29
29 namespace chromeos { 30 namespace chromeos {
30 31
31 namespace { 32 namespace {
32 33
33 // User dictionary keys. 34 // User dictionary keys.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 112
112 UserSelectionScreen::UserSelectionScreen(const std::string& display_type) 113 UserSelectionScreen::UserSelectionScreen(const std::string& display_type)
113 : handler_(nullptr), 114 : handler_(nullptr),
114 login_display_delegate_(nullptr), 115 login_display_delegate_(nullptr),
115 view_(nullptr), 116 view_(nullptr),
116 display_type_(display_type), 117 display_type_(display_type),
117 weak_factory_(this) { 118 weak_factory_(this) {
118 } 119 }
119 120
120 UserSelectionScreen::~UserSelectionScreen() { 121 UserSelectionScreen::~UserSelectionScreen() {
121 ScreenlockBridge::Get()->SetLockHandler(nullptr); 122 GetScreenlockBridgeInstance()->SetLockHandler(nullptr);
122 ui::UserActivityDetector* activity_detector = ui::UserActivityDetector::Get(); 123 ui::UserActivityDetector* activity_detector = ui::UserActivityDetector::Get();
123 if (activity_detector->HasObserver(this)) 124 if (activity_detector->HasObserver(this))
124 activity_detector->RemoveObserver(this); 125 activity_detector->RemoveObserver(this);
125 } 126 }
126 127
127 void UserSelectionScreen::InitEasyUnlock() { 128 void UserSelectionScreen::InitEasyUnlock() {
128 ScreenlockBridge::Get()->SetLockHandler(this); 129 GetScreenlockBridgeInstance()->SetLockHandler(this);
129 } 130 }
130 131
131 void UserSelectionScreen::SetLoginDisplayDelegate( 132 void UserSelectionScreen::SetLoginDisplayDelegate(
132 LoginDisplay::Delegate* login_display_delegate) { 133 LoginDisplay::Delegate* login_display_delegate) {
133 login_display_delegate_ = login_display_delegate; 134 login_display_delegate_ = login_display_delegate;
134 } 135 }
135 136
136 // static 137 // static
137 void UserSelectionScreen::FillUserDictionary( 138 void UserSelectionScreen::FillUserDictionary(
138 user_manager::User* user, 139 user_manager::User* user,
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 AuthType auth_type, 439 AuthType auth_type,
439 const base::string16& initial_value) { 440 const base::string16& initial_value) {
440 if (GetAuthType(user_id) == FORCE_OFFLINE_PASSWORD) 441 if (GetAuthType(user_id) == FORCE_OFFLINE_PASSWORD)
441 return; 442 return;
442 DCHECK(GetAuthType(user_id) != FORCE_OFFLINE_PASSWORD || 443 DCHECK(GetAuthType(user_id) != FORCE_OFFLINE_PASSWORD ||
443 auth_type == FORCE_OFFLINE_PASSWORD); 444 auth_type == FORCE_OFFLINE_PASSWORD);
444 user_auth_type_map_[user_id] = auth_type; 445 user_auth_type_map_[user_id] = auth_type;
445 view_->SetAuthType(user_id, auth_type, initial_value); 446 view_->SetAuthType(user_id, auth_type, initial_value);
446 } 447 }
447 448
448 ScreenlockBridge::LockHandler::AuthType UserSelectionScreen::GetAuthType( 449 proximity_auth::ScreenlockBridge::LockHandler::AuthType
449 const std::string& username) const { 450 UserSelectionScreen::GetAuthType(const std::string& username) const {
450 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) 451 if (user_auth_type_map_.find(username) == user_auth_type_map_.end())
451 return OFFLINE_PASSWORD; 452 return OFFLINE_PASSWORD;
452 return user_auth_type_map_.find(username)->second; 453 return user_auth_type_map_.find(username)->second;
453 } 454 }
454 455
455 ScreenlockBridge::LockHandler::ScreenType UserSelectionScreen::GetScreenType() 456 proximity_auth::ScreenlockBridge::LockHandler::ScreenType
456 const { 457 UserSelectionScreen::GetScreenType() const {
457 if (display_type_ == OobeUI::kLockDisplay) 458 if (display_type_ == OobeUI::kLockDisplay)
458 return LOCK_SCREEN; 459 return LOCK_SCREEN;
459 460
460 if (display_type_ == OobeUI::kLoginDisplay) 461 if (display_type_ == OobeUI::kLoginDisplay)
461 return SIGNIN_SCREEN; 462 return SIGNIN_SCREEN;
462 463
463 return OTHER_SCREEN; 464 return OTHER_SCREEN;
464 } 465 }
465 466
466 void UserSelectionScreen::ShowBannerMessage(const base::string16& message) { 467 void UserSelectionScreen::ShowBannerMessage(const base::string16& message) {
467 view_->ShowBannerMessage(message); 468 view_->ShowBannerMessage(message);
468 } 469 }
469 470
470 void UserSelectionScreen::ShowUserPodCustomIcon( 471 void UserSelectionScreen::ShowUserPodCustomIcon(
471 const std::string& user_id, 472 const std::string& user_id,
472 const ScreenlockBridge::UserPodCustomIconOptions& icon_options) { 473 const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions&
474 icon_options) {
473 scoped_ptr<base::DictionaryValue> icon = icon_options.ToDictionaryValue(); 475 scoped_ptr<base::DictionaryValue> icon = icon_options.ToDictionaryValue();
474 if (!icon || icon->empty()) 476 if (!icon || icon->empty())
475 return; 477 return;
476 view_->ShowUserPodCustomIcon(user_id, *icon); 478 view_->ShowUserPodCustomIcon(user_id, *icon);
477 } 479 }
478 480
479 void UserSelectionScreen::HideUserPodCustomIcon(const std::string& user_id) { 481 void UserSelectionScreen::HideUserPodCustomIcon(const std::string& user_id) {
480 view_->HideUserPodCustomIcon(user_id); 482 view_->HideUserPodCustomIcon(user_id);
481 } 483 }
482 484
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 // The user profile should exist if and only if this is the lock screen. 551 // The user profile should exist if and only if this is the lock screen.
550 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); 552 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN);
551 553
552 if (!profile) 554 if (!profile)
553 profile = profile_helper->GetSigninProfile(); 555 profile = profile_helper->GetSigninProfile();
554 556
555 return EasyUnlockService::Get(profile); 557 return EasyUnlockService::Get(profile);
556 } 558 }
557 559
558 } // namespace chromeos 560 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698