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_KIOSK_MODE_KIOSK_MODE_SCREENSAVER_H_
6#define CHROME_BROWSER_CHROMEOS_KIOSK_MODE_KIOSK_MODE_SCREENSAVER_H_
7
8#include "base/basictypes.h"
9#include "base/files/file_path.h"
10#include "base/memory/weak_ptr.h"
11#include "ui/wm/core/user_activity_observer.h"
12
13namespace extensions {
14class Extension;
15}
16
17namespace chromeos {
18
19class KioskModeScreensaver : public wm::UserActivityObserver {
20 public:
21  KioskModeScreensaver();
22  virtual ~KioskModeScreensaver();
23
24 private:
25  friend class KioskModeScreensaverTest;
26
27  // wm::UserActivityObserver overrides:
28  virtual void OnUserActivity(const ui::Event* event) OVERRIDE;
29
30  // Initialization functions, in order
31  // Get the screensaver path once KioskModeHelper is initialized.
32  void GetScreensaverCrxPath();
33
34  // Callback to receive the path to the screensaver extension's crx and call
35  // the unpacker to unpack and load the crx.
36  void ScreensaverPathCallback(const base::FilePath& screensaver_crx);
37
38  // Called back on the UI thread to Setup the screensaver with the now unpacked
39  // and loaded extension.
40  void SetupScreensaver(scoped_refptr<extensions::Extension> extension,
41                        const base::FilePath& extension_base_path);
42
43  base::FilePath extension_base_path_;
44
45  base::WeakPtrFactory<KioskModeScreensaver> weak_ptr_factory_;
46
47  DISALLOW_COPY_AND_ASSIGN(KioskModeScreensaver);
48};
49
50void InitializeKioskModeScreensaver();
51void ShutdownKioskModeScreensaver();
52
53}  // namespace chromeos
54
55#endif  // CHROME_BROWSER_CHROMEOS_KIOSK_MODE_KIOSK_MODE_SCREENSAVER_H_
56