1 // Copyright 2019 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_SETTINGS_CHROMEOS_WALLPAPER_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_WALLPAPER_HANDLER_H_
7 
8 #include "base/macros.h"
9 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
10 
11 namespace base {
12 class ListValue;
13 }
14 
15 namespace chromeos {
16 namespace settings {
17 
18 // Chrome "Personalization" settings page UI handler.
19 class WallpaperHandler : public ::settings::SettingsPageUIHandler {
20  public:
21   WallpaperHandler();
22   ~WallpaperHandler() override;
23 
24   // SettingsPageUIHandler implementation.
25   void RegisterMessages() override;
26   void OnJavascriptAllowed() override;
27   void OnJavascriptDisallowed() override;
28 
29  private:
30   // Whether the wallpaper setting should be shown.
31   void HandleIsWallpaperSettingVisible(const base::ListValue* args);
32 
33   // Whether the wallpaper is policy controlled.
34   void HandleIsWallpaperPolicyControlled(const base::ListValue* args);
35 
36   // Open the wallpaper manager app.
37   void HandleOpenWallpaperManager(const base::ListValue* args);
38 
39   // Helper function to resolve the Javascript callback.
40   void ResolveCallback(const base::Value& callback_id, bool result);
41 
42   DISALLOW_COPY_AND_ASSIGN(WallpaperHandler);
43 };
44 
45 }  // namespace settings
46 }  // namespace chromeos
47 
48 #endif  // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_WALLPAPER_HANDLER_H_
49