summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/webui/options2/chromeos/display_options_handler.h
blob: 05e438d2123411bac5a20e887ea7c9cc2a11854a (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
57
58
59
60
// Copyright (c) 2012 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_OPTIONS2_CHROMEOS_DISPLAY_OPTIONS_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_DISPLAY_OPTIONS_HANDLER_H_

#include <vector>

#include "chrome/browser/ui/webui/options2/options_ui.h"
#include "ui/aura/display_observer.h"

namespace base {
class DictionaryValue;
class ListValue;
}

namespace chromeos {
namespace options2 {

// Display options overlay page UI handler.
class DisplayOptionsHandler : public ::options2::OptionsPageUIHandler,
                              public aura::DisplayObserver {
 public:
  DisplayOptionsHandler();
  virtual ~DisplayOptionsHandler();

  // OptionsPageUIHandler implementation.
  virtual void GetLocalizedValues(
      base::DictionaryValue* localized_strings) OVERRIDE;
  virtual void InitializeHandler() OVERRIDE;

  // WebUIMessageHandler implementation.
  virtual void RegisterMessages() OVERRIDE;

  // aura::DisplayObserver implementation.
  virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE;
  virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE;
  virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE;

 private:
  // Updates the display section visibility based on the current display
  // configurations.
  void UpdateDisplaySectionVisibility();

  // Sends the current display information to the web_ui of options page.
  void SendDisplayInfo();

  // Handlers of JS messages.
  void HandleDisplayInfo(const base::ListValue* unused_args);
  void HandleMirroring(const base::ListValue* args);
  void HandleDisplayLayout(const base::ListValue* args);

  DISALLOW_COPY_AND_ASSIGN(DisplayOptionsHandler);
};

}  // namespace options2
}  // namespace chromeos

#endif  // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_DISPLAY_OPTIONS_HANDLER_H_