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

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/easy_unlock_util.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"
25 #include "components/signin/core/browser/signin_manager_base.h"
Ilya Sherman 2015/04/24 21:22:01 nit: Not needed?
msarda 2015/04/27 11:29:24 Done.
24 #include "components/user_manager/user_id.h" 26 #include "components/user_manager/user_id.h"
25 #include "components/user_manager/user_manager.h" 27 #include "components/user_manager/user_manager.h"
26 #include "components/user_manager/user_type.h" 28 #include "components/user_manager/user_type.h"
27 #include "ui/base/user_activity/user_activity_detector.h" 29 #include "ui/base/user_activity/user_activity_detector.h"
28 30
29 namespace chromeos { 31 namespace chromeos {
30 32
31 namespace { 33 namespace {
32 34
33 // User dictionary keys. 35 // User dictionary keys.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 113
112 UserSelectionScreen::UserSelectionScreen(const std::string& display_type) 114 UserSelectionScreen::UserSelectionScreen(const std::string& display_type)
113 : handler_(nullptr), 115 : handler_(nullptr),
114 login_display_delegate_(nullptr), 116 login_display_delegate_(nullptr),
115 view_(nullptr), 117 view_(nullptr),
116 display_type_(display_type), 118 display_type_(display_type),
117 weak_factory_(this) { 119 weak_factory_(this) {
118 } 120 }
119 121
120 UserSelectionScreen::~UserSelectionScreen() { 122 UserSelectionScreen::~UserSelectionScreen() {
121 ScreenlockBridge::Get()->SetLockHandler(nullptr); 123 GetScreenlockBridgeInstance()->SetLockHandler(nullptr);
122 ui::UserActivityDetector* activity_detector = ui::UserActivityDetector::Get(); 124 ui::UserActivityDetector* activity_detector = ui::UserActivityDetector::Get();
123 if (activity_detector->HasObserver(this)) 125 if (activity_detector->HasObserver(this))
124 activity_detector->RemoveObserver(this); 126 activity_detector->RemoveObserver(this);
125 } 127 }
126 128
127 void UserSelectionScreen::InitEasyUnlock() { 129 void UserSelectionScreen::InitEasyUnlock() {
128 ScreenlockBridge::Get()->SetLockHandler(this); 130 GetScreenlockBridgeInstance()->SetLockHandler(this);
129 } 131 }
130 132
131 void UserSelectionScreen::SetLoginDisplayDelegate( 133 void UserSelectionScreen::SetLoginDisplayDelegate(
132 LoginDisplay::Delegate* login_display_delegate) { 134 LoginDisplay::Delegate* login_display_delegate) {
133 login_display_delegate_ = login_display_delegate; 135 login_display_delegate_ = login_display_delegate;
134 } 136 }
135 137
136 // static 138 // static
137 void UserSelectionScreen::FillUserDictionary( 139 void UserSelectionScreen::FillUserDictionary(
138 user_manager::User* user, 140 user_manager::User* user,
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 AuthType auth_type, 440 AuthType auth_type,
439 const base::string16& initial_value) { 441 const base::string16& initial_value) {
440 if (GetAuthType(user_id) == FORCE_OFFLINE_PASSWORD) 442 if (GetAuthType(user_id) == FORCE_OFFLINE_PASSWORD)
441 return; 443 return;
442 DCHECK(GetAuthType(user_id) != FORCE_OFFLINE_PASSWORD || 444 DCHECK(GetAuthType(user_id) != FORCE_OFFLINE_PASSWORD ||
443 auth_type == FORCE_OFFLINE_PASSWORD); 445 auth_type == FORCE_OFFLINE_PASSWORD);
444 user_auth_type_map_[user_id] = auth_type; 446 user_auth_type_map_[user_id] = auth_type;
445 view_->SetAuthType(user_id, auth_type, initial_value); 447 view_->SetAuthType(user_id, auth_type, initial_value);
446 } 448 }
447 449
448 ScreenlockBridge::LockHandler::AuthType UserSelectionScreen::GetAuthType( 450 proximity_auth::ScreenlockBridge::LockHandler::AuthType
449 const std::string& username) const { 451 UserSelectionScreen::GetAuthType(const std::string& username) const {
450 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) 452 if (user_auth_type_map_.find(username) == user_auth_type_map_.end())
451 return OFFLINE_PASSWORD; 453 return OFFLINE_PASSWORD;
452 return user_auth_type_map_.find(username)->second; 454 return user_auth_type_map_.find(username)->second;
453 } 455 }
454 456
455 ScreenlockBridge::LockHandler::ScreenType UserSelectionScreen::GetScreenType() 457 proximity_auth::ScreenlockBridge::LockHandler::ScreenType
456 const { 458 UserSelectionScreen::GetScreenType() const {
457 if (display_type_ == OobeUI::kLockDisplay) 459 if (display_type_ == OobeUI::kLockDisplay)
458 return LOCK_SCREEN; 460 return LOCK_SCREEN;
459 461
460 if (display_type_ == OobeUI::kLoginDisplay) 462 if (display_type_ == OobeUI::kLoginDisplay)
461 return SIGNIN_SCREEN; 463 return SIGNIN_SCREEN;
462 464
463 return OTHER_SCREEN; 465 return OTHER_SCREEN;
464 } 466 }
465 467
466 void UserSelectionScreen::ShowBannerMessage(const base::string16& message) { 468 void UserSelectionScreen::ShowBannerMessage(const base::string16& message) {
467 view_->ShowBannerMessage(message); 469 view_->ShowBannerMessage(message);
468 } 470 }
469 471
470 void UserSelectionScreen::ShowUserPodCustomIcon( 472 void UserSelectionScreen::ShowUserPodCustomIcon(
471 const std::string& user_id, 473 const std::string& user_id,
472 const ScreenlockBridge::UserPodCustomIconOptions& icon_options) { 474 const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions&
475 icon_options) {
473 scoped_ptr<base::DictionaryValue> icon = icon_options.ToDictionaryValue(); 476 scoped_ptr<base::DictionaryValue> icon = icon_options.ToDictionaryValue();
474 if (!icon || icon->empty()) 477 if (!icon || icon->empty())
475 return; 478 return;
476 view_->ShowUserPodCustomIcon(user_id, *icon); 479 view_->ShowUserPodCustomIcon(user_id, *icon);
477 } 480 }
478 481
479 void UserSelectionScreen::HideUserPodCustomIcon(const std::string& user_id) { 482 void UserSelectionScreen::HideUserPodCustomIcon(const std::string& user_id) {
480 view_->HideUserPodCustomIcon(user_id); 483 view_->HideUserPodCustomIcon(user_id);
481 } 484 }
482 485
(...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. 552 // The user profile should exist if and only if this is the lock screen.
550 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); 553 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN);
551 554
552 if (!profile) 555 if (!profile)
553 profile = profile_helper->GetSigninProfile(); 556 profile = profile_helper->GetSigninProfile();
554 557
555 return EasyUnlockService::Get(profile); 558 return EasyUnlockService::Get(profile);
556 } 559 }
557 560
558 } // namespace chromeos 561 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698