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.
5 #ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_CHROMEOS_KIOSK_APPS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_CHROMEOS_KIOSK_APPS_HANDLER_H_
10 #include "base/compiler_specific.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
13 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager_observer.h"
14 #include "content/public/browser/web_ui_message_handler.h"
17 class DictionaryValue
;
22 class WebUIDataSource
;
27 class KioskAppManager
;
28 class OwnerSettingsServiceChromeOS
;
30 class KioskAppsHandler
: public content::WebUIMessageHandler
,
31 public KioskAppManagerObserver
{
33 explicit KioskAppsHandler(OwnerSettingsServiceChromeOS
* service
);
34 ~KioskAppsHandler() override
;
36 void GetLocalizedValues(content::WebUIDataSource
* source
);
38 // content::WebUIMessageHandler overrides:
39 void RegisterMessages() override
;
41 // KioskAppManagerObserver overrides:
42 void OnKioskAppDataChanged(const std::string
& app_id
) override
;
43 void OnKioskAppDataLoadFailure(const std::string
& app_id
) override
;
44 void OnKioskExtensionLoadedInCache(const std::string
& app_id
) override
;
45 void OnKioskExtensionDownloadFailed(const std::string
& app_id
) override
;
47 void OnKioskAppsSettingsChanged() override
;
50 // Sends all kiosk apps and settings to webui.
51 void SendKioskAppSettings();
54 void HandleInitializeKioskAppSettings(const base::ListValue
* args
);
55 void HandleGetKioskAppSettings(const base::ListValue
* args
);
56 void HandleAddKioskApp(const base::ListValue
* args
);
57 void HandleRemoveKioskApp(const base::ListValue
* args
);
58 void HandleEnableKioskAutoLaunch(const base::ListValue
* args
);
59 void HandleDisableKioskAutoLaunch(const base::ListValue
* args
);
60 void HandleSetDisableBailoutShortcut(const base::ListValue
* args
);
62 void UpdateApp(const std::string
& app_id
);
63 void ShowError(const std::string
& app_id
);
65 // Callback for KioskAppManager::GetConsumerKioskModeStatus().
66 void OnGetConsumerKioskAutoLaunchStatus(
67 chromeos::KioskAppManager::ConsumerKioskAutoLaunchStatus status
);
69 KioskAppManager
* kiosk_app_manager_
; // not owned.
71 bool is_kiosk_enabled_
;
72 bool is_auto_launch_enabled_
;
73 OwnerSettingsServiceChromeOS
* const owner_settings_service_
; // not owned
74 base::WeakPtrFactory
<KioskAppsHandler
> weak_ptr_factory_
;
76 DISALLOW_COPY_AND_ASSIGN(KioskAppsHandler
);
79 } // namespace chromeos
81 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_CHROMEOS_KIOSK_APPS_HANDLER_H_