| 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> |
| 9 |
| 8 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 9 #include "chrome/browser/signin/screenlock_bridge.h" | 11 #include "chrome/browser/signin/screenlock_bridge.h" |
| 10 #include "extensions/browser/browser_context_keyed_api_factory.h" | 12 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 11 | 13 |
| 12 namespace gfx { | 14 namespace gfx { |
| 13 class Image; | 15 class Image; |
| 14 } | 16 } |
| 15 | 17 |
| 16 namespace extensions { | 18 namespace extensions { |
| 17 | 19 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 42 class ScreenlockPrivateShowMessageFunction | 44 class ScreenlockPrivateShowMessageFunction |
| 43 : public ChromeAsyncExtensionFunction { | 45 : public ChromeAsyncExtensionFunction { |
| 44 public: | 46 public: |
| 45 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.showMessage", | 47 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.showMessage", |
| 46 SCREENLOCKPRIVATE_SHOWMESSAGE) | 48 SCREENLOCKPRIVATE_SHOWMESSAGE) |
| 47 ScreenlockPrivateShowMessageFunction(); | 49 ScreenlockPrivateShowMessageFunction(); |
| 48 virtual bool RunAsync() OVERRIDE; | 50 virtual bool RunAsync() OVERRIDE; |
| 49 | 51 |
| 50 private: | 52 private: |
| 51 virtual ~ScreenlockPrivateShowMessageFunction(); | 53 virtual ~ScreenlockPrivateShowMessageFunction(); |
| 52 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateShowMessageFunction ); | 54 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateShowMessageFunction); |
| 53 }; | 55 }; |
| 54 | 56 |
| 55 class ScreenlockPrivateShowButtonFunction | 57 class ScreenlockPrivateShowCustomIconFunction |
| 56 : public ChromeAsyncExtensionFunction { | 58 : public ChromeAsyncExtensionFunction { |
| 57 public: | 59 public: |
| 58 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.showButton", | 60 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.showCustomIcon", |
| 59 SCREENLOCKPRIVATE_SHOWBUTTON) | 61 SCREENLOCKPRIVATE_SHOWCUSTOMICON) |
| 60 ScreenlockPrivateShowButtonFunction(); | 62 ScreenlockPrivateShowCustomIconFunction(); |
| 61 virtual bool RunAsync() OVERRIDE; | 63 virtual bool RunAsync() OVERRIDE; |
| 62 | 64 |
| 63 private: | 65 private: |
| 64 virtual ~ScreenlockPrivateShowButtonFunction(); | 66 virtual ~ScreenlockPrivateShowCustomIconFunction(); |
| 65 void OnImageLoaded(const gfx::Image& image); | 67 void OnImageLoaded(const gfx::Image& image); |
| 66 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateShowButtonFunction); | 68 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateShowCustomIconFunction); |
| 67 }; | 69 }; |
| 68 | 70 |
| 69 class ScreenlockPrivateHideButtonFunction | 71 class ScreenlockPrivateHideCustomIconFunction |
| 70 : public ChromeAsyncExtensionFunction { | 72 : public ChromeAsyncExtensionFunction { |
| 71 public: | 73 public: |
| 72 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.hideButton", | 74 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.hideCustomIcon", |
| 73 SCREENLOCKPRIVATE_HIDEBUTTON) | 75 SCREENLOCKPRIVATE_HIDECUSTOMICON) |
| 74 ScreenlockPrivateHideButtonFunction(); | 76 ScreenlockPrivateHideCustomIconFunction(); |
| 75 virtual bool RunAsync() OVERRIDE; | 77 virtual bool RunAsync() OVERRIDE; |
| 76 | 78 |
| 77 private: | 79 private: |
| 78 virtual ~ScreenlockPrivateHideButtonFunction(); | 80 virtual ~ScreenlockPrivateHideCustomIconFunction(); |
| 79 void OnImageLoaded(const gfx::Image& image); | 81 void OnImageLoaded(const gfx::Image& image); |
| 80 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateHideButtonFunction); | 82 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateHideCustomIconFunction); |
| 81 }; | 83 }; |
| 82 | 84 |
| 83 class ScreenlockPrivateSetAuthTypeFunction | 85 class ScreenlockPrivateSetAuthTypeFunction |
| 84 : public ChromeAsyncExtensionFunction { | 86 : public ChromeAsyncExtensionFunction { |
| 85 public: | 87 public: |
| 86 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.setAuthType", | 88 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.setAuthType", |
| 87 SCREENLOCKPRIVATE_SETAUTHTYPE) | 89 SCREENLOCKPRIVATE_SETAUTHTYPE) |
| 88 ScreenlockPrivateSetAuthTypeFunction(); | 90 ScreenlockPrivateSetAuthTypeFunction(); |
| 89 virtual bool RunAsync() OVERRIDE; | 91 virtual bool RunAsync() OVERRIDE; |
| 90 | 92 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 118 virtual ~ScreenlockPrivateAcceptAuthAttemptFunction(); | 120 virtual ~ScreenlockPrivateAcceptAuthAttemptFunction(); |
| 119 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateAcceptAuthAttemptFunction); | 121 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateAcceptAuthAttemptFunction); |
| 120 }; | 122 }; |
| 121 | 123 |
| 122 class ScreenlockPrivateEventRouter : public extensions::BrowserContextKeyedAPI, | 124 class ScreenlockPrivateEventRouter : public extensions::BrowserContextKeyedAPI, |
| 123 public ScreenlockBridge::Observer { | 125 public ScreenlockBridge::Observer { |
| 124 public: | 126 public: |
| 125 explicit ScreenlockPrivateEventRouter(content::BrowserContext* context); | 127 explicit ScreenlockPrivateEventRouter(content::BrowserContext* context); |
| 126 virtual ~ScreenlockPrivateEventRouter(); | 128 virtual ~ScreenlockPrivateEventRouter(); |
| 127 | 129 |
| 128 void OnButtonClicked(); | |
| 129 | |
| 130 void OnAuthAttempted(ScreenlockBridge::LockHandler::AuthType auth_type, | 130 void OnAuthAttempted(ScreenlockBridge::LockHandler::AuthType auth_type, |
| 131 const std::string& value); | 131 const std::string& value); |
| 132 | 132 |
| 133 // BrowserContextKeyedAPI | 133 // BrowserContextKeyedAPI |
| 134 static extensions::BrowserContextKeyedAPIFactory< | 134 static extensions::BrowserContextKeyedAPIFactory< |
| 135 ScreenlockPrivateEventRouter>* | 135 ScreenlockPrivateEventRouter>* |
| 136 GetFactoryInstance(); | 136 GetFactoryInstance(); |
| 137 virtual void Shutdown() OVERRIDE; | 137 virtual void Shutdown() OVERRIDE; |
| 138 | 138 |
| 139 // ScreenlockBridge::Observer | 139 // ScreenlockBridge::Observer |
| (...skipping 13 matching lines...) Expand all Loading... |
| 153 | 153 |
| 154 void DispatchEvent(const std::string& event_name, base::Value* arg); | 154 void DispatchEvent(const std::string& event_name, base::Value* arg); |
| 155 | 155 |
| 156 content::BrowserContext* browser_context_; | 156 content::BrowserContext* browser_context_; |
| 157 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateEventRouter); | 157 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateEventRouter); |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 } // namespace extensions | 160 } // namespace extensions |
| 161 | 161 |
| 162 #endif // CHROME_BROWSER_EXTENSIONS_API_SCREENLOCK_PRIVATE_SCREENLOCK_PRIVATE_A
PI_H_ | 162 #endif // CHROME_BROWSER_EXTENSIONS_API_SCREENLOCK_PRIVATE_SCREENLOCK_PRIVATE_A
PI_H_ |
| OLD | NEW |