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

Side by Side Diff: components/proximity_auth/screenlock_bridge.cc

Issue 1209193003: [Proximity Auth] Create one ProximityAuthClient per profile, rather than one global one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 "components/proximity_auth/screenlock_bridge.h" 5 #include "components/proximity_auth/screenlock_bridge.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "components/proximity_auth/proximity_auth_client.h" 9 #include "components/proximity_auth/proximity_auth_client.h"
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 return kHardlockedUserPodCustomIconId; 42 return kHardlockedUserPodCustomIconId;
43 case ScreenlockBridge::USER_POD_CUSTOM_ICON_SPINNER: 43 case ScreenlockBridge::USER_POD_CUSTOM_ICON_SPINNER:
44 return kSpinnerUserPodCustomIconId; 44 return kSpinnerUserPodCustomIconId;
45 default: 45 default:
46 return ""; 46 return "";
47 } 47 }
48 } 48 }
49 49
50 } // namespace 50 } // namespace
51 51
52 ScreenlockBridge::ScreenlockBridge(ProximityAuthClient* client) 52 ScreenlockBridge::ScreenlockBridge() : lock_handler_(nullptr) {
53 : client_(client), lock_handler_(nullptr) {
54 DCHECK(client_);
55 } 53 }
56 54
57 ScreenlockBridge::~ScreenlockBridge() { 55 ScreenlockBridge::~ScreenlockBridge() {
58 } 56 }
59 57
60 ScreenlockBridge::UserPodCustomIconOptions::UserPodCustomIconOptions() 58 ScreenlockBridge::UserPodCustomIconOptions::UserPodCustomIconOptions()
61 : autoshow_tooltip_(false), 59 : autoshow_tooltip_(false),
62 hardlock_on_click_(false), 60 hardlock_on_click_(false),
63 is_trial_run_(false) { 61 is_trial_run_(false) {
64 } 62 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 if (user_id == focused_user_id_) 141 if (user_id == focused_user_id_)
144 return; 142 return;
145 focused_user_id_ = user_id; 143 focused_user_id_ = user_id;
146 FOR_EACH_OBSERVER(Observer, observers_, OnFocusedUserChanged(user_id)); 144 FOR_EACH_OBSERVER(Observer, observers_, OnFocusedUserChanged(user_id));
147 } 145 }
148 146
149 bool ScreenlockBridge::IsLocked() const { 147 bool ScreenlockBridge::IsLocked() const {
150 return lock_handler_ != nullptr; 148 return lock_handler_ != nullptr;
151 } 149 }
152 150
153 void ScreenlockBridge::Lock(content::BrowserContext* browser_context) { 151 void ScreenlockBridge::Lock(ProximityAuthClient* client) {
Tim Song 2015/06/26 23:46:43 Hmm... requiring the client here couples the Scree
Ilya Sherman 2015/06/27 08:18:00 I removed the Lock() implementation for now, since
154 #if defined(OS_CHROMEOS) 152 #if defined(OS_CHROMEOS)
155 chromeos::SessionManagerClient* session_manager = 153 chromeos::SessionManagerClient* session_manager =
156 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); 154 chromeos::DBusThreadManager::Get()->GetSessionManagerClient();
157 session_manager->RequestLockScreen(); 155 session_manager->RequestLockScreen();
158 #else 156 #else
159 client_->Lock(browser_context); 157 client->Lock();
160 #endif 158 #endif
161 } 159 }
162 160
163 void ScreenlockBridge::Unlock(content::BrowserContext* browser_context) { 161 void ScreenlockBridge::Unlock(ProximityAuthClient* client) {
Tim Song 2015/06/26 23:46:43 I think it would be better to take the username di
Ilya Sherman 2015/06/27 08:18:00 Done.
164 if (lock_handler_) 162 if (lock_handler_)
165 lock_handler_->Unlock(client_->GetAuthenticatedUsername(browser_context)); 163 lock_handler_->Unlock(client->GetAuthenticatedUsername());
166 } 164 }
167 165
168 void ScreenlockBridge::AddObserver(Observer* observer) { 166 void ScreenlockBridge::AddObserver(Observer* observer) {
169 observers_.AddObserver(observer); 167 observers_.AddObserver(observer);
170 } 168 }
171 169
172 void ScreenlockBridge::RemoveObserver(Observer* observer) { 170 void ScreenlockBridge::RemoveObserver(Observer* observer) {
173 observers_.RemoveObserver(observer); 171 observers_.RemoveObserver(observer);
174 } 172 }
175 173
176 } // namespace proximity_auth 174 } // namespace proximity_auth
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698