| 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 "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" | 5 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 proximity_auth::ScreenlockBridge::UserPodCustomIcon GetIconForState( | 25 proximity_auth::ScreenlockBridge::UserPodCustomIcon GetIconForState( |
| 26 ScreenlockState state) { | 26 ScreenlockState state) { |
| 27 switch (state) { | 27 switch (state) { |
| 28 case ScreenlockState::NO_BLUETOOTH: | 28 case ScreenlockState::NO_BLUETOOTH: |
| 29 case ScreenlockState::NO_PHONE: | 29 case ScreenlockState::NO_PHONE: |
| 30 case ScreenlockState::PHONE_NOT_AUTHENTICATED: | 30 case ScreenlockState::PHONE_NOT_AUTHENTICATED: |
| 31 case ScreenlockState::PHONE_LOCKED: | 31 case ScreenlockState::PHONE_LOCKED: |
| 32 case ScreenlockState::PHONE_NOT_LOCKABLE: | 32 case ScreenlockState::PHONE_NOT_LOCKABLE: |
| 33 case ScreenlockState::PHONE_UNSUPPORTED: | 33 case ScreenlockState::PHONE_UNSUPPORTED: |
| 34 return proximity_auth::ScreenlockBridge::USER_POD_CUSTOM_ICON_LOCKED; |
| 34 case ScreenlockState::RSSI_TOO_LOW: | 35 case ScreenlockState::RSSI_TOO_LOW: |
| 35 return proximity_auth::ScreenlockBridge::USER_POD_CUSTOM_ICON_LOCKED; | 36 case ScreenlockState::PHONE_LOCKED_AND_RSSI_TOO_LOW: |
| 36 case ScreenlockState::TX_POWER_TOO_HIGH: | |
| 37 case ScreenlockState::PHONE_LOCKED_AND_TX_POWER_TOO_HIGH: | |
| 38 // TODO(isherman): This icon is currently identical to the regular locked | 37 // TODO(isherman): This icon is currently identical to the regular locked |
| 39 // icon. Once the reduced proximity range flag is removed, consider | 38 // icon. Once the reduced proximity range flag is removed, consider |
| 40 // deleting the redundant icon. | 39 // deleting the redundant icon. |
| 41 return proximity_auth::ScreenlockBridge:: | 40 return proximity_auth::ScreenlockBridge:: |
| 42 USER_POD_CUSTOM_ICON_LOCKED_WITH_PROXIMITY_HINT; | 41 USER_POD_CUSTOM_ICON_LOCKED_WITH_PROXIMITY_HINT; |
| 43 case ScreenlockState::BLUETOOTH_CONNECTING: | 42 case ScreenlockState::BLUETOOTH_CONNECTING: |
| 44 return proximity_auth::ScreenlockBridge::USER_POD_CUSTOM_ICON_SPINNER; | 43 return proximity_auth::ScreenlockBridge::USER_POD_CUSTOM_ICON_SPINNER; |
| 45 case ScreenlockState::AUTHENTICATED: | 44 case ScreenlockState::AUTHENTICATED: |
| 46 return proximity_auth::ScreenlockBridge::USER_POD_CUSTOM_ICON_UNLOCKED; | 45 return proximity_auth::ScreenlockBridge::USER_POD_CUSTOM_ICON_UNLOCKED; |
| 47 case ScreenlockState::INACTIVE: | 46 case ScreenlockState::INACTIVE: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 68 case ScreenlockState::PHONE_NOT_AUTHENTICATED: | 67 case ScreenlockState::PHONE_NOT_AUTHENTICATED: |
| 69 return IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_PHONE_NOT_AUTHENTICATED; | 68 return IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_PHONE_NOT_AUTHENTICATED; |
| 70 case ScreenlockState::PHONE_LOCKED: | 69 case ScreenlockState::PHONE_LOCKED: |
| 71 return IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_PHONE_LOCKED; | 70 return IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_PHONE_LOCKED; |
| 72 case ScreenlockState::PHONE_NOT_LOCKABLE: | 71 case ScreenlockState::PHONE_NOT_LOCKABLE: |
| 73 return IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_PHONE_UNLOCKABLE; | 72 return IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_PHONE_UNLOCKABLE; |
| 74 case ScreenlockState::PHONE_UNSUPPORTED: | 73 case ScreenlockState::PHONE_UNSUPPORTED: |
| 75 return IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_UNSUPPORTED_ANDROID_VERSION; | 74 return IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_UNSUPPORTED_ANDROID_VERSION; |
| 76 case ScreenlockState::RSSI_TOO_LOW: | 75 case ScreenlockState::RSSI_TOO_LOW: |
| 77 return IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_RSSI_TOO_LOW; | 76 return IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_RSSI_TOO_LOW; |
| 78 case ScreenlockState::TX_POWER_TOO_HIGH: | 77 case ScreenlockState::PHONE_LOCKED_AND_RSSI_TOO_LOW: |
| 79 return IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_TX_POWER_TOO_HIGH; | 78 return IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_PHONE_LOCKED_AND_RSSI_TOO_LOW; |
| 80 case ScreenlockState::PHONE_LOCKED_AND_TX_POWER_TOO_HIGH: | |
| 81 return | |
| 82 IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_PHONE_LOCKED_AND_TX_POWER_TOO_HIGH; | |
| 83 case ScreenlockState::AUTHENTICATED: | 79 case ScreenlockState::AUTHENTICATED: |
| 84 return IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_HARDLOCK_INSTRUCTIONS; | 80 return IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_HARDLOCK_INSTRUCTIONS; |
| 85 } | 81 } |
| 86 | 82 |
| 87 NOTREACHED(); | 83 NOTREACHED(); |
| 88 return 0; | 84 return 0; |
| 89 } | 85 } |
| 90 | 86 |
| 91 bool TooltipContainsDeviceType(ScreenlockState state) { | 87 bool TooltipContainsDeviceType(ScreenlockState state) { |
| 92 return (state == ScreenlockState::AUTHENTICATED || | 88 return (state == ScreenlockState::AUTHENTICATED || |
| 93 state == ScreenlockState::PHONE_NOT_LOCKABLE || | 89 state == ScreenlockState::PHONE_NOT_LOCKABLE || |
| 94 state == ScreenlockState::NO_BLUETOOTH || | 90 state == ScreenlockState::NO_BLUETOOTH || |
| 95 state == ScreenlockState::PHONE_UNSUPPORTED || | 91 state == ScreenlockState::PHONE_UNSUPPORTED || |
| 96 state == ScreenlockState::TX_POWER_TOO_HIGH || | 92 state == ScreenlockState::RSSI_TOO_LOW || |
| 97 state == ScreenlockState::PHONE_LOCKED_AND_TX_POWER_TOO_HIGH); | 93 state == ScreenlockState::PHONE_LOCKED_AND_RSSI_TOO_LOW); |
| 98 } | 94 } |
| 99 | 95 |
| 100 // Returns true iff the |state| corresponds to a locked remote device. | 96 // Returns true iff the |state| corresponds to a locked remote device. |
| 101 bool IsLockedState(ScreenlockState state) { | 97 bool IsLockedState(ScreenlockState state) { |
| 102 return (state == ScreenlockState::PHONE_LOCKED || | 98 return (state == ScreenlockState::PHONE_LOCKED || |
| 103 state == ScreenlockState::PHONE_LOCKED_AND_TX_POWER_TOO_HIGH); | 99 state == ScreenlockState::PHONE_LOCKED_AND_RSSI_TOO_LOW); |
| 104 } | 100 } |
| 105 | 101 |
| 106 } // namespace | 102 } // namespace |
| 107 | 103 |
| 108 EasyUnlockScreenlockStateHandler::EasyUnlockScreenlockStateHandler( | 104 EasyUnlockScreenlockStateHandler::EasyUnlockScreenlockStateHandler( |
| 109 const AccountId& account_id, | 105 const AccountId& account_id, |
| 110 HardlockState initial_hardlock_state, | 106 HardlockState initial_hardlock_state, |
| 111 proximity_auth::ScreenlockBridge* screenlock_bridge) | 107 proximity_auth::ScreenlockBridge* screenlock_bridge) |
| 112 : state_(ScreenlockState::INACTIVE), | 108 : state_(ScreenlockState::INACTIVE), |
| 113 account_id_(account_id), | 109 account_id_(account_id), |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 IDS_EASY_UNLOCK_SCREENLOCK_USER_POD_AUTH_VALUE)); | 385 IDS_EASY_UNLOCK_SCREENLOCK_USER_POD_AUTH_VALUE)); |
| 390 } | 386 } |
| 391 } else if (existing_auth_type != | 387 } else if (existing_auth_type != |
| 392 proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD) { | 388 proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD) { |
| 393 screenlock_bridge_->lock_handler()->SetAuthType( | 389 screenlock_bridge_->lock_handler()->SetAuthType( |
| 394 account_id_, | 390 account_id_, |
| 395 proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, | 391 proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, |
| 396 base::string16()); | 392 base::string16()); |
| 397 } | 393 } |
| 398 } | 394 } |
| OLD | NEW |