OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_KIOSK_MODE_KIOSK_MODE_SCREENSAVER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_KIOSK_MODE_KIOSK_MODE_SCREENSAVER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_KIOSK_MODE_KIOSK_MODE_SCREENSAVER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_KIOSK_MODE_KIOSK_MODE_SCREENSAVER_H_ |
7 | 7 |
8 #include "ash/wm/user_activity_observer.h" | 8 #include "ash/wm/user_activity_observer.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "content/public/browser/notification_observer.h" | |
13 #include "content/public/browser/notification_registrar.h" | |
14 | 12 |
15 namespace extensions { | 13 namespace extensions { |
16 class Extension; | 14 class Extension; |
17 } | 15 } |
18 | 16 |
19 namespace chromeos { | 17 namespace chromeos { |
20 | 18 |
21 class KioskModeScreensaver : public ash::UserActivityObserver, | 19 class KioskModeScreensaver : public ash::UserActivityObserver { |
22 public content::NotificationObserver { | |
23 public: | 20 public: |
24 KioskModeScreensaver(); | 21 KioskModeScreensaver(); |
25 virtual ~KioskModeScreensaver(); | 22 virtual ~KioskModeScreensaver(); |
26 | 23 |
27 private: | 24 private: |
28 friend class KioskModeScreensaverTest; | 25 friend class KioskModeScreensaverTest; |
29 | 26 |
30 // NotificationObserver overrides: | |
31 virtual void Observe(int type, | |
32 const content::NotificationSource& source, | |
33 const content::NotificationDetails& details) OVERRIDE; | |
34 | |
35 // UserActivityObserver::Observer overrides: | 27 // UserActivityObserver::Observer overrides: |
36 virtual void OnUserActivity() OVERRIDE; | 28 virtual void OnUserActivity() OVERRIDE; |
37 | 29 |
38 // Initialization functions, in order | 30 // Initialization functions, in order |
39 // Get the screensaver path once KioskModeHelper is initialized. | 31 // Get the screensaver path once KioskModeHelper is initialized. |
40 void GetScreensaverCrxPath(); | 32 void GetScreensaverCrxPath(); |
41 | 33 |
42 // Callback to receive the path to the screensaver extension's crx and call | 34 // Callback to receive the path to the screensaver extension's crx and call |
43 // the unpacker to unpack and load the crx. | 35 // the unpacker to unpack and load the crx. |
44 void ScreensaverPathCallback(const FilePath& screensaver_crx); | 36 void ScreensaverPathCallback(const FilePath& screensaver_crx); |
45 | 37 |
46 // Called back on the UI thread to Setup the screensaver with the now unpacked | 38 // Called back on the UI thread to Setup the screensaver with the now unpacked |
47 // and loaded extension. | 39 // and loaded extension. |
48 void SetupScreensaver(scoped_refptr<extensions::Extension> extension, | 40 void SetupScreensaver(scoped_refptr<extensions::Extension> extension, |
49 const FilePath& extension_base_path); | 41 const FilePath& extension_base_path); |
50 | 42 |
51 content::NotificationRegistrar registrar_; | |
52 base::WeakPtrFactory<KioskModeScreensaver> weak_ptr_factory_; | 43 base::WeakPtrFactory<KioskModeScreensaver> weak_ptr_factory_; |
53 | 44 |
54 FilePath extension_base_path_; | 45 FilePath extension_base_path_; |
55 | 46 |
56 DISALLOW_COPY_AND_ASSIGN(KioskModeScreensaver); | 47 DISALLOW_COPY_AND_ASSIGN(KioskModeScreensaver); |
57 }; | 48 }; |
58 | 49 |
59 void InitializeKioskModeScreensaver(); | 50 void InitializeKioskModeScreensaver(); |
60 void ShutdownKioskModeScreensaver(); | 51 void ShutdownKioskModeScreensaver(); |
61 | 52 |
62 } // namespace chromeos | 53 } // namespace chromeos |
63 | 54 |
64 #endif // CHROME_BROWSER_CHROMEOS_KIOSK_MODE_KIOSK_MODE_SCREENSAVER_H_ | 55 #endif // CHROME_BROWSER_CHROMEOS_KIOSK_MODE_KIOSK_MODE_SCREENSAVER_H_ |
OLD | NEW |