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 #ifndef CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_REGULAR_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_REGULAR_H_ |
6 #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_REGULAR_H_ | 6 #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_REGULAR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/prefs/pref_change_registrar.h" | 13 #include "base/prefs/pref_change_registrar.h" |
14 #include "base/time/time.h" | |
14 #include "chrome/browser/signin/easy_unlock_service.h" | 15 #include "chrome/browser/signin/easy_unlock_service.h" |
15 #include "chrome/browser/signin/screenlock_bridge.h" | 16 #include "chrome/browser/signin/screenlock_bridge.h" |
16 | 17 |
17 #if defined(OS_CHROMEOS) | 18 #if defined(OS_CHROMEOS) |
18 #include "chrome/browser/chromeos/login/easy_unlock/short_lived_user_context.h" | 19 #include "chrome/browser/chromeos/login/easy_unlock/short_lived_user_context.h" |
20 #include "chromeos/dbus/power_manager_client.h" | |
19 #endif | 21 #endif |
20 | 22 |
21 namespace base { | 23 namespace base { |
22 class DictionaryValue; | 24 class DictionaryValue; |
23 class ListValue; | 25 class ListValue; |
24 } | 26 } |
25 | 27 |
26 namespace cryptauth { | 28 namespace cryptauth { |
27 class ToggleEasyUnlockResponse; | 29 class ToggleEasyUnlockResponse; |
28 } | 30 } |
29 | 31 |
30 namespace proximity_auth { | 32 namespace proximity_auth { |
31 class CryptAuthClient; | 33 class CryptAuthClient; |
32 } | 34 } |
33 | 35 |
34 class EasyUnlockAppManager; | 36 class EasyUnlockAppManager; |
35 class EasyUnlockToggleFlow; | 37 class EasyUnlockToggleFlow; |
36 class Profile; | 38 class Profile; |
37 | 39 |
38 // EasyUnlockService instance that should be used for regular, non-signin | 40 // EasyUnlockService instance that should be used for regular, non-signin |
39 // profiles. | 41 // profiles. |
40 class EasyUnlockServiceRegular : public EasyUnlockService, | 42 class EasyUnlockServiceRegular : public EasyUnlockService, |
43 #if defined(OS_CHROMEOS) | |
44 public chromeos::PowerManagerClient::Observer, | |
Tim Song
2015/03/25 18:17:28
The base class has a similar observer in EasyUnloc
Ilya Sherman
2015/04/01 00:16:13
Done.
| |
45 #endif | |
41 public ScreenlockBridge::Observer { | 46 public ScreenlockBridge::Observer { |
42 public: | 47 public: |
43 explicit EasyUnlockServiceRegular(Profile* profile); | 48 explicit EasyUnlockServiceRegular(Profile* profile); |
44 ~EasyUnlockServiceRegular() override; | 49 ~EasyUnlockServiceRegular() override; |
45 | 50 |
46 private: | 51 private: |
47 // EasyUnlockService implementation: | 52 // EasyUnlockService implementation: |
48 EasyUnlockService::Type GetType() const override; | 53 EasyUnlockService::Type GetType() const override; |
49 std::string GetUserEmail() const override; | 54 std::string GetUserEmail() const override; |
50 void LaunchSetup() override; | 55 void LaunchSetup() override; |
(...skipping 17 matching lines...) Expand all Loading... | |
68 bool IsAllowedInternal() const override; | 73 bool IsAllowedInternal() const override; |
69 void OnWillFinalizeUnlock(bool success) override; | 74 void OnWillFinalizeUnlock(bool success) override; |
70 | 75 |
71 // ScreenlockBridge::Observer implementation: | 76 // ScreenlockBridge::Observer implementation: |
72 void OnScreenDidLock( | 77 void OnScreenDidLock( |
73 ScreenlockBridge::LockHandler::ScreenType screen_type) override; | 78 ScreenlockBridge::LockHandler::ScreenType screen_type) override; |
74 void OnScreenDidUnlock( | 79 void OnScreenDidUnlock( |
75 ScreenlockBridge::LockHandler::ScreenType screen_type) override; | 80 ScreenlockBridge::LockHandler::ScreenType screen_type) override; |
76 void OnFocusedUserChanged(const std::string& user_id) override; | 81 void OnFocusedUserChanged(const std::string& user_id) override; |
77 | 82 |
83 #if defined(OS_CHROMEOS) | |
84 // chromeos::PowerManagerClient::Observer implementation: | |
85 void SuspendDone(const base::TimeDelta& sleep_duration) override; | |
86 #endif // defined(OS_CHROMEOS) | |
87 | |
78 // Callback when the controlling pref changes. | 88 // Callback when the controlling pref changes. |
79 void OnPrefsChanged(); | 89 void OnPrefsChanged(); |
80 | 90 |
81 // Sets the new turn-off flow status. | 91 // Sets the new turn-off flow status. |
82 void SetTurnOffFlowStatus(TurnOffFlowStatus status); | 92 void SetTurnOffFlowStatus(TurnOffFlowStatus status); |
83 | 93 |
84 // Callback for ToggleEasyUnlock CryptAuth API. | 94 // Callback for ToggleEasyUnlock CryptAuth API. |
85 void OnToggleEasyUnlockApiComplete( | 95 void OnToggleEasyUnlockApiComplete( |
86 const cryptauth::ToggleEasyUnlockResponse& response); | 96 const cryptauth::ToggleEasyUnlockResponse& response); |
87 void OnToggleEasyUnlockApiFailed(const std::string& error_message); | 97 void OnToggleEasyUnlockApiFailed(const std::string& error_message); |
(...skipping 21 matching lines...) Expand all Loading... | |
109 TurnOffFlowStatus turn_off_flow_status_; | 119 TurnOffFlowStatus turn_off_flow_status_; |
110 scoped_ptr<proximity_auth::CryptAuthClient> cryptauth_client_; | 120 scoped_ptr<proximity_auth::CryptAuthClient> cryptauth_client_; |
111 | 121 |
112 AutoPairingResultCallback auto_pairing_callback_; | 122 AutoPairingResultCallback auto_pairing_callback_; |
113 | 123 |
114 // True if the user just unlocked the screen using Easy Unlock. Reset once | 124 // True if the user just unlocked the screen using Easy Unlock. Reset once |
115 // the screen unlocks. Used to distinguish Easy Unlock-powered unlocks from | 125 // the screen unlocks. Used to distinguish Easy Unlock-powered unlocks from |
116 // password-based unlocks for metrics. | 126 // password-based unlocks for metrics. |
117 bool will_unlock_using_easy_unlock_; | 127 bool will_unlock_using_easy_unlock_; |
118 | 128 |
129 // The timestamp for the most recent time when the lock screen was shown. The | |
130 // lock screen is typically shown when the user awakens her computer from | |
131 // sleep -- e.g. by opening the lid -- but can also be shown if the screen is | |
132 // locked but the computer does not go to sleep. | |
133 base::TimeTicks lock_screen_last_shown_timestamp_; | |
134 | |
119 base::WeakPtrFactory<EasyUnlockServiceRegular> weak_ptr_factory_; | 135 base::WeakPtrFactory<EasyUnlockServiceRegular> weak_ptr_factory_; |
120 | 136 |
121 DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceRegular); | 137 DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceRegular); |
122 }; | 138 }; |
123 | 139 |
124 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_REGULAR_H_ | 140 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_REGULAR_H_ |
OLD | NEW |