OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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. | |
4 | |
5 #ifndef CHROME_BROWSER_CHROMEOS_SCREENSAVER_SCREENSAVER_CONTROLLER_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_SCREENSAVER_SCREENSAVER_CONTROLLER_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "ash/wm/user_activity_observer.h" | |
11 #include "base/basictypes.h" | |
12 #include "base/gtest_prod_util.h" | |
13 #include "base/memory/weak_ptr.h" | |
14 #include "base/time.h" | |
15 #include "chromeos/dbus/power_manager_client.h" | |
16 #include "content/public/browser/notification_observer.h" | |
17 #include "content/public/browser/notification_registrar.h" | |
18 | |
19 namespace extensions { | |
20 class Extension; | |
21 } | |
22 | |
23 namespace chromeos { | |
24 | |
25 // This class controls the management of the screensaver extension. It is | |
26 // responsible for, | |
stevenjb
2013/01/31 23:42:18
nit: s/,/:
rkc
2013/02/01 00:35:45
Done.
| |
27 // . Enabling and disabling of the screensaver, long with ensuring that we have | |
stevenjb
2013/01/31 23:42:18
s/long/along
rkc
2013/02/01 00:35:45
Done.
| |
28 // only one screensaver at a time. | |
29 // . Managing the showing and hiding of the current screensaver based on user | |
30 // activity. | |
31 // . Any power management that may be required while a screensaver is active. | |
32 class ScreensaverController : public ash::UserActivityObserver, | |
33 public PowerManagerClient::Observer, | |
34 public content::NotificationObserver { | |
35 public: | |
36 ScreensaverController(); | |
37 virtual ~ScreensaverController(); | |
38 | |
39 private: | |
40 FRIEND_TEST_ALL_PREFIXES(ScreensaverControllerTest, Basic); | |
41 FRIEND_TEST_ALL_PREFIXES(ScreensaverControllerTest, OutOfOrder); | |
42 | |
43 // Overridden from content::NotificationObserver: | |
44 virtual void Observe(int type, | |
45 const content::NotificationSource& source, | |
46 const content::NotificationDetails& details) OVERRIDE; | |
47 | |
48 // Overridden from PowerManagerClient::Observer: | |
49 virtual void IdleNotify(int64 threshold) OVERRIDE; | |
50 | |
51 // UserActivityObserver::Observer overrides: | |
52 virtual void OnUserActivity() OVERRIDE; | |
53 | |
54 void SetupScreensaver(const std::string& screensaver_extension_id); | |
55 void TeardownScreensaver(); | |
56 | |
57 void RequestNextIdleNotification(); | |
58 | |
59 std::string screensaver_extension_id_; | |
60 | |
61 content::NotificationRegistrar registrar_; | |
62 | |
63 base::TimeDelta threshold_; | |
64 | |
65 base::WeakPtrFactory<ScreensaverController> weak_ptr_factory_; | |
66 | |
67 DISALLOW_COPY_AND_ASSIGN(ScreensaverController); | |
68 }; | |
69 | |
70 } // namespace chromeos | |
71 | |
72 #endif // CHROME_BROWSER_CHROMEOS_SCREENSAVER_SCREENSAVER_CONTROLLER_H_ | |
OLD | NEW |