Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / chromeos / extensions / screenlock_private_api.h
blob330812a6149295bc392675c61cbb97828aa4420a
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_SCREENLOCK_PRIVATE_API_H_
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_SCREENLOCK_PRIVATE_API_H_
8 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
9 #include "chrome/browser/extensions/chrome_extension_function.h"
10 #include "chromeos/dbus/session_manager_client.h"
12 namespace extensions {
14 class ScreenlockPrivateGetLockedFunction : public ChromeAsyncExtensionFunction {
15 public:
16 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.getLocked",
17 SCREENLOCKPRIVATE_GETLOCKED)
18 ScreenlockPrivateGetLockedFunction();
19 virtual bool RunImpl() OVERRIDE;
20 private:
21 virtual ~ScreenlockPrivateGetLockedFunction();
22 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateGetLockedFunction);
25 class ScreenlockPrivateSetLockedFunction : public ChromeAsyncExtensionFunction {
26 public:
27 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.setLocked",
28 SCREENLOCKPRIVATE_SETLOCKED)
29 ScreenlockPrivateSetLockedFunction();
30 virtual bool RunImpl() OVERRIDE;
31 private:
32 virtual ~ScreenlockPrivateSetLockedFunction();
33 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateSetLockedFunction);
36 class ScreenlockPrivateShowMessageFunction
37 : public ChromeAsyncExtensionFunction {
38 public:
39 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.showMessage",
40 SCREENLOCKPRIVATE_SHOWMESSAGE)
41 ScreenlockPrivateShowMessageFunction();
42 virtual bool RunImpl() OVERRIDE;
43 private:
44 virtual ~ScreenlockPrivateShowMessageFunction();
45 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateShowMessageFunction );
48 class ScreenlockPrivateShowButtonFunction
49 : public ChromeAsyncExtensionFunction {
50 public:
51 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.showButton",
52 SCREENLOCKPRIVATE_SHOWBUTTON)
53 ScreenlockPrivateShowButtonFunction();
54 virtual bool RunImpl() OVERRIDE;
55 private:
56 virtual ~ScreenlockPrivateShowButtonFunction();
57 void OnImageLoaded(const gfx::Image& image);
58 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateShowButtonFunction );
61 class ScreenlockPrivateEventRouter
62 : public extensions::ProfileKeyedAPI,
63 public chromeos::SessionManagerClient::Observer {
64 public:
65 explicit ScreenlockPrivateEventRouter(Profile* profile);
66 virtual ~ScreenlockPrivateEventRouter();
68 void OnButtonClicked();
70 // ProfileKeyedAPI
71 static extensions::ProfileKeyedAPIFactory<ScreenlockPrivateEventRouter>*
72 GetFactoryInstance();
73 virtual void Shutdown() OVERRIDE;
75 // chromeos::SessionManagerClient::Observer
76 virtual void ScreenIsLocked() OVERRIDE;
77 virtual void ScreenIsUnlocked() OVERRIDE;
79 private:
80 friend class extensions::ProfileKeyedAPIFactory<ScreenlockPrivateEventRouter>;
82 // ProfileKeyedAPI
83 static const char* service_name() {
84 return "ScreenlockPrivateEventRouter";
86 static const bool kServiceIsNULLWhileTesting = true;
87 static const bool kServiceRedirectedInIncognito = true;
89 void DispatchEvent(const std::string& event_name, base::Value* arg);
91 Profile* profile_;
92 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateEventRouter);
95 } // namespace extensions
97 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_SCREENLOCK_PRIVATE_API_H_