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

Side by Side Diff: chrome/browser/signin/easy_unlock_service_regular.cc

Issue 608693006: [Easy Unlock] When hardlocking, show a different icon on user (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 2 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/signin/easy_unlock_service_regular.h" 5 #include "chrome/browser/signin/easy_unlock_service_regular.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.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/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
(...skipping 14 matching lines...) Expand all
25 #endif 25 #endif
26 26
27 namespace { 27 namespace {
28 28
29 // Key name of the local device permit record dictonary in kEasyUnlockPairing. 29 // Key name of the local device permit record dictonary in kEasyUnlockPairing.
30 const char kKeyPermitAccess[] = "permitAccess"; 30 const char kKeyPermitAccess[] = "permitAccess";
31 31
32 // Key name of the remote device list in kEasyUnlockPairing. 32 // Key name of the remote device list in kEasyUnlockPairing.
33 const char kKeyDevices[] = "devices"; 33 const char kKeyDevices[] = "devices";
34 34
35 // Key name of the hardlocked flag in kEasyUnlockPairing.
36 const char kKeyHardlocked[] = "hardlocked";
37
35 // Key name of the phone public key in a device dictionary. 38 // Key name of the phone public key in a device dictionary.
36 const char kKeyPhoneId[] = "permitRecord.id"; 39 const char kKeyPhoneId[] = "permitRecord.id";
37 40
38 } // namespace 41 } // namespace
39 42
40 EasyUnlockServiceRegular::EasyUnlockServiceRegular(Profile* profile) 43 EasyUnlockServiceRegular::EasyUnlockServiceRegular(Profile* profile)
41 : EasyUnlockService(profile), 44 : EasyUnlockService(profile),
42 turn_off_flow_status_(EasyUnlockService::IDLE) { 45 turn_off_flow_status_(EasyUnlockService::IDLE) {
43 } 46 }
44 47
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 prefs::kEasyUnlockPairing); 106 prefs::kEasyUnlockPairing);
104 pairing_update->SetWithoutPathExpansion(kKeyDevices, devices.DeepCopy()); 107 pairing_update->SetWithoutPathExpansion(kKeyDevices, devices.DeepCopy());
105 } 108 }
106 109
107 void EasyUnlockServiceRegular::ClearRemoteDevices() { 110 void EasyUnlockServiceRegular::ClearRemoteDevices() {
108 DictionaryPrefUpdate pairing_update(profile()->GetPrefs(), 111 DictionaryPrefUpdate pairing_update(profile()->GetPrefs(),
109 prefs::kEasyUnlockPairing); 112 prefs::kEasyUnlockPairing);
110 pairing_update->RemoveWithoutPathExpansion(kKeyDevices, NULL); 113 pairing_update->RemoveWithoutPathExpansion(kKeyDevices, NULL);
111 } 114 }
112 115
116 void EasyUnlockServiceRegular::SetHardlocked(bool value) {
117 DictionaryPrefUpdate pairing_update(profile()->GetPrefs(),
118 prefs::kEasyUnlockPairing);
119 pairing_update->SetBooleanWithoutPathExpansion(kKeyHardlocked, value);
120
121 SetScreenlockHardlockedState(value);
122 }
123
124 bool EasyUnlockServiceRegular::IsHardlocked() const {
125 const base::DictionaryValue* pairing_dict =
126 profile()->GetPrefs()->GetDictionary(prefs::kEasyUnlockPairing);
127 bool hardlocked = false;
128 return pairing_dict &&
129 pairing_dict->GetBoolean(kKeyHardlocked, &hardlocked) &&
130 hardlocked;
131 }
132
113 void EasyUnlockServiceRegular::RunTurnOffFlow() { 133 void EasyUnlockServiceRegular::RunTurnOffFlow() {
114 if (turn_off_flow_status_ == PENDING) 134 if (turn_off_flow_status_ == PENDING)
115 return; 135 return;
116 136
117 SetTurnOffFlowStatus(PENDING); 137 SetTurnOffFlowStatus(PENDING);
118 138
119 // Currently there should only be one registered phone. 139 // Currently there should only be one registered phone.
120 // TODO(xiyuan): Revisit this when server supports toggle for all or 140 // TODO(xiyuan): Revisit this when server supports toggle for all or
121 // there are multiple phones. 141 // there are multiple phones.
122 const base::DictionaryValue* pairing_dict = 142 const base::DictionaryValue* pairing_dict =
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 224
205 if (!success) { 225 if (!success) {
206 SetTurnOffFlowStatus(FAIL); 226 SetTurnOffFlowStatus(FAIL);
207 return; 227 return;
208 } 228 }
209 229
210 ClearRemoteDevices(); 230 ClearRemoteDevices();
211 SetTurnOffFlowStatus(IDLE); 231 SetTurnOffFlowStatus(IDLE);
212 ReloadApp(); 232 ReloadApp();
213 } 233 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/easy_unlock_service_regular.h ('k') | chrome/browser/signin/easy_unlock_service_signin_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698