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.
4
5#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_KIOSK_AUTOLAUNCH_SCREEN_HANDLER_H_
6#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_KIOSK_AUTOLAUNCH_SCREEN_HANDLER_H_
7
8#include "base/compiler_specific.h"
9#include "chrome/browser/chromeos/app_mode/kiosk_app_manager_observer.h"
10#include "chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen_actor.h"
11#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
12#include "content/public/browser/web_ui.h"
13
14namespace chromeos {
15
16// WebUI implementation of KioskAutolaunchScreenActor.
17class KioskAutolaunchScreenHandler : public KioskAutolaunchScreenActor,
18                                     public KioskAppManagerObserver,
19                                     public BaseScreenHandler {
20 public:
21  KioskAutolaunchScreenHandler();
22  virtual ~KioskAutolaunchScreenHandler();
23
24  // KioskAutolaunchScreenActor implementation:
25  virtual void Show() OVERRIDE;
26  virtual void SetDelegate(Delegate* delegate) OVERRIDE;
27
28  // KioskAppManagerObserver overrides:
29  virtual void OnKioskAppsSettingsChanged() OVERRIDE;
30  virtual void OnKioskAppDataChanged(const std::string& app_id) OVERRIDE;
31
32  // BaseScreenHandler implementation:
33  virtual void DeclareLocalizedValues(LocalizedValuesBuilder* builder) OVERRIDE;
34  virtual void Initialize() OVERRIDE;
35
36  // WebUIMessageHandler implementation:
37  virtual void RegisterMessages() OVERRIDE;
38
39 private:
40  // Updates auto-start UI assets on JS side.
41  void UpdateKioskApp();
42
43  // JS messages handlers.
44  void HandleOnCancel();
45  void HandleOnConfirm();
46  void HandleOnVisible();
47
48  Delegate* delegate_;
49
50  // Keeps whether screen should be shown right after initialization.
51  bool show_on_init_;
52  bool is_visible_;
53
54  DISALLOW_COPY_AND_ASSIGN(KioskAutolaunchScreenHandler);
55};
56
57}  // namespace chromeos
58
59#endif  // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_KIOSK_AUTOLAUNCH_SCREEN_HANDLER_H_
60