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