summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/ui/webui/settings/chromeos/wallpaper_handler.h
blob: 6e0c811b9e097a38fc9ed164f6f3c7e9b81b4f40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_WALLPAPER_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_WALLPAPER_HANDLER_H_

#include "base/macros.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"

namespace base {
class ListValue;
}

namespace content {
class WebUI;
}

class Profile;

namespace chromeos {
namespace settings {

// Chrome "Personalization" settings page UI handler.
class WallpaperHandler : public ::settings::SettingsPageUIHandler {
 public:
  explicit WallpaperHandler(content::WebUI* webui);
  ~WallpaperHandler() override;

  // SettingsPageUIHandler implementation.
  void RegisterMessages() override;
  void OnJavascriptAllowed() override;
  void OnJavascriptDisallowed() override;

 private:
  // Whether the wallpaper setting should be shown.
  void HandleIsWallpaperSettingVisible(const base::ListValue* args);

  // Whether the wallpaper is policy controlled.
  void HandleIsWallpaperPolicyControlled(const base::ListValue* args);

  // Open the wallpaper manager app.
  void HandleOpenWallpaperManager(const base::ListValue* args);

  // Helper function to resolve the Javascript callback.
  void ResolveCallback(const base::Value& callback_id, bool result);

  Profile* const profile_;

  DISALLOW_COPY_AND_ASSIGN(WallpaperHandler);
};

}  // namespace settings
}  // namespace chromeos

#endif  // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_WALLPAPER_HANDLER_H_