OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_EXTENSIONS_API_SCREENLOCK_PRIVATE_SCREENLOCK_PRIVATE_API_
H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SCREENLOCK_PRIVATE_SCREENLOCK_PRIVATE_API_
H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_SCREENLOCK_PRIVATE_SCREENLOCK_PRIVATE_API_
H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_SCREENLOCK_PRIVATE_SCREENLOCK_PRIVATE_API_
H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
11 #include "chrome/browser/signin/screenlock_bridge.h" | 11 #include "components/proximity_auth/screenlock_bridge.h" |
12 #include "extensions/browser/browser_context_keyed_api_factory.h" | 12 #include "extensions/browser/browser_context_keyed_api_factory.h" |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 | 15 |
16 class ScreenlockPrivateGetLockedFunction : public ChromeAsyncExtensionFunction { | 16 class ScreenlockPrivateGetLockedFunction : public ChromeAsyncExtensionFunction { |
17 public: | 17 public: |
18 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.getLocked", | 18 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.getLocked", |
19 SCREENLOCKPRIVATE_GETLOCKED) | 19 SCREENLOCKPRIVATE_GETLOCKED) |
20 ScreenlockPrivateGetLockedFunction(); | 20 ScreenlockPrivateGetLockedFunction(); |
21 bool RunAsync() override; | 21 bool RunAsync() override; |
(...skipping 21 matching lines...) Expand all Loading... |
43 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.acceptAuthAttempt", | 43 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.acceptAuthAttempt", |
44 SCREENLOCKPRIVATE_ACCEPTAUTHATTEMPT) | 44 SCREENLOCKPRIVATE_ACCEPTAUTHATTEMPT) |
45 ScreenlockPrivateAcceptAuthAttemptFunction(); | 45 ScreenlockPrivateAcceptAuthAttemptFunction(); |
46 bool RunSync() override; | 46 bool RunSync() override; |
47 | 47 |
48 private: | 48 private: |
49 ~ScreenlockPrivateAcceptAuthAttemptFunction() override; | 49 ~ScreenlockPrivateAcceptAuthAttemptFunction() override; |
50 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateAcceptAuthAttemptFunction); | 50 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateAcceptAuthAttemptFunction); |
51 }; | 51 }; |
52 | 52 |
53 class ScreenlockPrivateEventRouter : public extensions::BrowserContextKeyedAPI, | 53 class ScreenlockPrivateEventRouter |
54 public ScreenlockBridge::Observer { | 54 : public extensions::BrowserContextKeyedAPI, |
| 55 public proximity_auth::ScreenlockBridge::Observer { |
55 public: | 56 public: |
56 explicit ScreenlockPrivateEventRouter(content::BrowserContext* context); | 57 explicit ScreenlockPrivateEventRouter(content::BrowserContext* context); |
57 ~ScreenlockPrivateEventRouter() override; | 58 ~ScreenlockPrivateEventRouter() override; |
58 | 59 |
59 bool OnAuthAttempted(ScreenlockBridge::LockHandler::AuthType auth_type, | 60 bool OnAuthAttempted( |
60 const std::string& value); | 61 proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, |
| 62 const std::string& value); |
61 | 63 |
62 // BrowserContextKeyedAPI | 64 // BrowserContextKeyedAPI |
63 static extensions::BrowserContextKeyedAPIFactory< | 65 static extensions::BrowserContextKeyedAPIFactory< |
64 ScreenlockPrivateEventRouter>* | 66 ScreenlockPrivateEventRouter>* |
65 GetFactoryInstance(); | 67 GetFactoryInstance(); |
66 void Shutdown() override; | 68 void Shutdown() override; |
67 | 69 |
68 // ScreenlockBridge::Observer | 70 // proximity_auth::ScreenlockBridge::Observer |
69 void OnScreenDidLock( | 71 void OnScreenDidLock(proximity_auth::ScreenlockBridge::LockHandler::ScreenType |
70 ScreenlockBridge::LockHandler::ScreenType screen_type) override; | 72 screen_type) override; |
71 void OnScreenDidUnlock( | 73 void OnScreenDidUnlock( |
72 ScreenlockBridge::LockHandler::ScreenType screen_type) override; | 74 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) |
| 75 override; |
73 void OnFocusedUserChanged(const std::string& user_id) override; | 76 void OnFocusedUserChanged(const std::string& user_id) override; |
74 | 77 |
75 private: | 78 private: |
76 friend class extensions::BrowserContextKeyedAPIFactory< | 79 friend class extensions::BrowserContextKeyedAPIFactory< |
77 ScreenlockPrivateEventRouter>; | 80 ScreenlockPrivateEventRouter>; |
78 | 81 |
79 // BrowserContextKeyedAPI | 82 // BrowserContextKeyedAPI |
80 static const char* service_name() { | 83 static const char* service_name() { |
81 return "ScreenlockPrivateEventRouter"; | 84 return "ScreenlockPrivateEventRouter"; |
82 } | 85 } |
83 static const bool kServiceIsNULLWhileTesting = true; | 86 static const bool kServiceIsNULLWhileTesting = true; |
84 static const bool kServiceRedirectedInIncognito = true; | 87 static const bool kServiceRedirectedInIncognito = true; |
85 | 88 |
86 void DispatchEvent(const std::string& event_name, base::Value* arg); | 89 void DispatchEvent(const std::string& event_name, base::Value* arg); |
87 | 90 |
88 content::BrowserContext* browser_context_; | 91 content::BrowserContext* browser_context_; |
89 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateEventRouter); | 92 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateEventRouter); |
90 }; | 93 }; |
91 | 94 |
92 } // namespace extensions | 95 } // namespace extensions |
93 | 96 |
94 #endif // CHROME_BROWSER_EXTENSIONS_API_SCREENLOCK_PRIVATE_SCREENLOCK_PRIVATE_A
PI_H_ | 97 #endif // CHROME_BROWSER_EXTENSIONS_API_SCREENLOCK_PRIVATE_SCREENLOCK_PRIVATE_A
PI_H_ |
OLD | NEW |