blob: dbdf8f472c3c96a79a9f6b4e71ba0bf810dc8e88 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_API_SCREENLOCK_PRIVATE_SCREENLOCK_PRIVATE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_SCREENLOCK_PRIVATE_SCREENLOCK_PRIVATE_API_H_
#include <string>
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/signin/screenlock_bridge.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
namespace extensions {
class ScreenlockPrivateGetLockedFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("screenlockPrivate.getLocked",
SCREENLOCKPRIVATE_GETLOCKED)
ScreenlockPrivateGetLockedFunction();
virtual bool RunAsync() OVERRIDE;
private:
virtual ~ScreenlockPrivateGetLockedFunction();
DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateGetLockedFunction);
};
class ScreenlockPrivateSetLockedFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("screenlockPrivate.setLocked",
SCREENLOCKPRIVATE_SETLOCKED)
ScreenlockPrivateSetLockedFunction();
virtual bool RunAsync() OVERRIDE;
private:
virtual ~ScreenlockPrivateSetLockedFunction();
DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateSetLockedFunction);
};
class ScreenlockPrivateAcceptAuthAttemptFunction
: public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("screenlockPrivate.acceptAuthAttempt",
SCREENLOCKPRIVATE_ACCEPTAUTHATTEMPT)
ScreenlockPrivateAcceptAuthAttemptFunction();
virtual bool RunSync() OVERRIDE;
private:
virtual ~ScreenlockPrivateAcceptAuthAttemptFunction();
DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateAcceptAuthAttemptFunction);
};
class ScreenlockPrivateEventRouter : public extensions::BrowserContextKeyedAPI,
public ScreenlockBridge::Observer {
public:
explicit ScreenlockPrivateEventRouter(content::BrowserContext* context);
virtual ~ScreenlockPrivateEventRouter();
bool OnAuthAttempted(ScreenlockBridge::LockHandler::AuthType auth_type,
const std::string& value);
// BrowserContextKeyedAPI
static extensions::BrowserContextKeyedAPIFactory<
ScreenlockPrivateEventRouter>*
GetFactoryInstance();
virtual void Shutdown() OVERRIDE;
// ScreenlockBridge::Observer
virtual void OnScreenDidLock() OVERRIDE;
virtual void OnScreenDidUnlock() OVERRIDE;
virtual void OnFocusedUserChanged(const std::string& user_id) OVERRIDE;
private:
friend class extensions::BrowserContextKeyedAPIFactory<
ScreenlockPrivateEventRouter>;
// BrowserContextKeyedAPI
static const char* service_name() {
return "ScreenlockPrivateEventRouter";
}
static const bool kServiceIsNULLWhileTesting = true;
static const bool kServiceRedirectedInIncognito = true;
void DispatchEvent(const std::string& event_name, base::Value* arg);
content::BrowserContext* browser_context_;
DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateEventRouter);
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_SCREENLOCK_PRIVATE_SCREENLOCK_PRIVATE_API_H_
|