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 "chrome/browser/signin/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 virtual bool RunAsync() OVERRIDE; | 21 virtual bool RunAsync() override; |
22 | 22 |
23 private: | 23 private: |
24 virtual ~ScreenlockPrivateGetLockedFunction(); | 24 virtual ~ScreenlockPrivateGetLockedFunction(); |
25 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateGetLockedFunction); | 25 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateGetLockedFunction); |
26 }; | 26 }; |
27 | 27 |
28 class ScreenlockPrivateSetLockedFunction : public ChromeAsyncExtensionFunction { | 28 class ScreenlockPrivateSetLockedFunction : public ChromeAsyncExtensionFunction { |
29 public: | 29 public: |
30 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.setLocked", | 30 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.setLocked", |
31 SCREENLOCKPRIVATE_SETLOCKED) | 31 SCREENLOCKPRIVATE_SETLOCKED) |
32 ScreenlockPrivateSetLockedFunction(); | 32 ScreenlockPrivateSetLockedFunction(); |
33 virtual bool RunAsync() OVERRIDE; | 33 virtual bool RunAsync() override; |
34 | 34 |
35 private: | 35 private: |
36 virtual ~ScreenlockPrivateSetLockedFunction(); | 36 virtual ~ScreenlockPrivateSetLockedFunction(); |
37 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateSetLockedFunction); | 37 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateSetLockedFunction); |
38 }; | 38 }; |
39 | 39 |
40 class ScreenlockPrivateAcceptAuthAttemptFunction | 40 class ScreenlockPrivateAcceptAuthAttemptFunction |
41 : public ChromeSyncExtensionFunction { | 41 : public ChromeSyncExtensionFunction { |
42 public: | 42 public: |
43 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.acceptAuthAttempt", | 43 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.acceptAuthAttempt", |
44 SCREENLOCKPRIVATE_ACCEPTAUTHATTEMPT) | 44 SCREENLOCKPRIVATE_ACCEPTAUTHATTEMPT) |
45 ScreenlockPrivateAcceptAuthAttemptFunction(); | 45 ScreenlockPrivateAcceptAuthAttemptFunction(); |
46 virtual bool RunSync() OVERRIDE; | 46 virtual bool RunSync() override; |
47 | 47 |
48 private: | 48 private: |
49 virtual ~ScreenlockPrivateAcceptAuthAttemptFunction(); | 49 virtual ~ScreenlockPrivateAcceptAuthAttemptFunction(); |
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 : public extensions::BrowserContextKeyedAPI, |
54 public ScreenlockBridge::Observer { | 54 public ScreenlockBridge::Observer { |
55 public: | 55 public: |
56 explicit ScreenlockPrivateEventRouter(content::BrowserContext* context); | 56 explicit ScreenlockPrivateEventRouter(content::BrowserContext* context); |
57 virtual ~ScreenlockPrivateEventRouter(); | 57 virtual ~ScreenlockPrivateEventRouter(); |
58 | 58 |
59 bool OnAuthAttempted(ScreenlockBridge::LockHandler::AuthType auth_type, | 59 bool OnAuthAttempted(ScreenlockBridge::LockHandler::AuthType auth_type, |
60 const std::string& value); | 60 const std::string& value); |
61 | 61 |
62 // BrowserContextKeyedAPI | 62 // BrowserContextKeyedAPI |
63 static extensions::BrowserContextKeyedAPIFactory< | 63 static extensions::BrowserContextKeyedAPIFactory< |
64 ScreenlockPrivateEventRouter>* | 64 ScreenlockPrivateEventRouter>* |
65 GetFactoryInstance(); | 65 GetFactoryInstance(); |
66 virtual void Shutdown() OVERRIDE; | 66 virtual void Shutdown() override; |
67 | 67 |
68 // ScreenlockBridge::Observer | 68 // ScreenlockBridge::Observer |
69 virtual void OnScreenDidLock() OVERRIDE; | 69 virtual void OnScreenDidLock() override; |
70 virtual void OnScreenDidUnlock() OVERRIDE; | 70 virtual void OnScreenDidUnlock() override; |
71 virtual void OnFocusedUserChanged(const std::string& user_id) OVERRIDE; | 71 virtual void OnFocusedUserChanged(const std::string& user_id) override; |
72 | 72 |
73 private: | 73 private: |
74 friend class extensions::BrowserContextKeyedAPIFactory< | 74 friend class extensions::BrowserContextKeyedAPIFactory< |
75 ScreenlockPrivateEventRouter>; | 75 ScreenlockPrivateEventRouter>; |
76 | 76 |
77 // BrowserContextKeyedAPI | 77 // BrowserContextKeyedAPI |
78 static const char* service_name() { | 78 static const char* service_name() { |
79 return "ScreenlockPrivateEventRouter"; | 79 return "ScreenlockPrivateEventRouter"; |
80 } | 80 } |
81 static const bool kServiceIsNULLWhileTesting = true; | 81 static const bool kServiceIsNULLWhileTesting = true; |
82 static const bool kServiceRedirectedInIncognito = true; | 82 static const bool kServiceRedirectedInIncognito = true; |
83 | 83 |
84 void DispatchEvent(const std::string& event_name, base::Value* arg); | 84 void DispatchEvent(const std::string& event_name, base::Value* arg); |
85 | 85 |
86 content::BrowserContext* browser_context_; | 86 content::BrowserContext* browser_context_; |
87 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateEventRouter); | 87 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateEventRouter); |
88 }; | 88 }; |
89 | 89 |
90 } // namespace extensions | 90 } // namespace extensions |
91 | 91 |
92 #endif // CHROME_BROWSER_EXTENSIONS_API_SCREENLOCK_PRIVATE_SCREENLOCK_PRIVATE_A
PI_H_ | 92 #endif // CHROME_BROWSER_EXTENSIONS_API_SCREENLOCK_PRIVATE_SCREENLOCK_PRIVATE_A
PI_H_ |
OLD | NEW |