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_CHROMEOS_EXTENSIONS_SCREENLOCK_PRIVATE_API_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_SCREENLOCK_PRIVATE_API_H_ |
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_SCREENLOCK_PRIVATE_API_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_SCREENLOCK_PRIVATE_API_H_ |
7 | 7 |
8 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" | 8 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
9 #include "chrome/browser/extensions/chrome_extension_function.h" | 9 #include "chrome/browser/extensions/chrome_extension_function.h" |
10 #include "chromeos/dbus/session_manager_client.h" | 10 #include "chromeos/dbus/session_manager_client.h" |
11 | 11 |
| 12 namespace gfx { |
| 13 class Image; |
| 14 } |
| 15 |
12 namespace extensions { | 16 namespace extensions { |
13 | 17 |
14 class ScreenlockPrivateGetLockedFunction : public ChromeAsyncExtensionFunction { | 18 class ScreenlockPrivateGetLockedFunction : public ChromeAsyncExtensionFunction { |
15 public: | 19 public: |
16 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.getLocked", | 20 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.getLocked", |
17 SCREENLOCKPRIVATE_GETLOCKED) | 21 SCREENLOCKPRIVATE_GETLOCKED) |
18 ScreenlockPrivateGetLockedFunction(); | 22 ScreenlockPrivateGetLockedFunction(); |
19 virtual bool RunImpl() OVERRIDE; | 23 virtual bool RunImpl() OVERRIDE; |
20 private: | 24 private: |
21 virtual ~ScreenlockPrivateGetLockedFunction(); | 25 virtual ~ScreenlockPrivateGetLockedFunction(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 private: | 59 private: |
56 virtual ~ScreenlockPrivateShowButtonFunction(); | 60 virtual ~ScreenlockPrivateShowButtonFunction(); |
57 void OnImageLoaded(const gfx::Image& image); | 61 void OnImageLoaded(const gfx::Image& image); |
58 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateShowButtonFunction ); | 62 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateShowButtonFunction ); |
59 }; | 63 }; |
60 | 64 |
61 class ScreenlockPrivateEventRouter | 65 class ScreenlockPrivateEventRouter |
62 : public extensions::ProfileKeyedAPI, | 66 : public extensions::ProfileKeyedAPI, |
63 public chromeos::SessionManagerClient::Observer { | 67 public chromeos::SessionManagerClient::Observer { |
64 public: | 68 public: |
65 explicit ScreenlockPrivateEventRouter(Profile* profile); | 69 explicit ScreenlockPrivateEventRouter(content::BrowserContext* context); |
66 virtual ~ScreenlockPrivateEventRouter(); | 70 virtual ~ScreenlockPrivateEventRouter(); |
67 | 71 |
68 void OnButtonClicked(); | 72 void OnButtonClicked(); |
69 | 73 |
70 // ProfileKeyedAPI | 74 // ProfileKeyedAPI |
71 static extensions::ProfileKeyedAPIFactory<ScreenlockPrivateEventRouter>* | 75 static extensions::ProfileKeyedAPIFactory<ScreenlockPrivateEventRouter>* |
72 GetFactoryInstance(); | 76 GetFactoryInstance(); |
73 virtual void Shutdown() OVERRIDE; | 77 virtual void Shutdown() OVERRIDE; |
74 | 78 |
75 // chromeos::SessionManagerClient::Observer | 79 // chromeos::SessionManagerClient::Observer |
76 virtual void ScreenIsLocked() OVERRIDE; | 80 virtual void ScreenIsLocked() OVERRIDE; |
77 virtual void ScreenIsUnlocked() OVERRIDE; | 81 virtual void ScreenIsUnlocked() OVERRIDE; |
78 | 82 |
79 private: | 83 private: |
80 friend class extensions::ProfileKeyedAPIFactory<ScreenlockPrivateEventRouter>; | 84 friend class extensions::ProfileKeyedAPIFactory<ScreenlockPrivateEventRouter>; |
81 | 85 |
82 // ProfileKeyedAPI | 86 // ProfileKeyedAPI |
83 static const char* service_name() { | 87 static const char* service_name() { |
84 return "ScreenlockPrivateEventRouter"; | 88 return "ScreenlockPrivateEventRouter"; |
85 } | 89 } |
86 static const bool kServiceIsNULLWhileTesting = true; | 90 static const bool kServiceIsNULLWhileTesting = true; |
87 static const bool kServiceRedirectedInIncognito = true; | 91 static const bool kServiceRedirectedInIncognito = true; |
88 | 92 |
89 void DispatchEvent(const std::string& event_name, base::Value* arg); | 93 void DispatchEvent(const std::string& event_name, base::Value* arg); |
90 | 94 |
91 Profile* profile_; | 95 content::BrowserContext* browser_context_; |
92 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateEventRouter); | 96 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateEventRouter); |
93 }; | 97 }; |
94 | 98 |
95 } // namespace extensions | 99 } // namespace extensions |
96 | 100 |
97 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_SCREENLOCK_PRIVATE_API_H_ | 101 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_SCREENLOCK_PRIVATE_API_H_ |
OLD | NEW |