Separate projection mode from rest of touch HUD
[chromium-blink-merge.git] / ash / display / display_error_dialog.h
blob541adc39ea3122f03017ef79e595ce54949d4561
1 // Copyright (c) 2012 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 ASH_DISPLAY_DISPLAY_ERROR_DIALOG_H_
6 #define ASH_DISPLAY_DISPLAY_ERROR_DIALOG_H_
8 #include "ash/ash_export.h"
9 #include "ash/display/display_controller.h"
10 #include "base/compiler_specific.h"
11 #include "chromeos/display/output_configurator.h"
12 #include "ui/views/widget/widget_observer.h"
13 #include "ui/views/window/dialog_delegate.h"
15 namespace aura {
16 class RootWindow;
17 } // namespace aura
19 namespace gfx {
20 class Display;
21 class Size;
22 } // namespace gfx
24 namespace views {
25 class Label;
26 } // namespace views
28 namespace ash {
29 namespace internal {
31 // Dialog used to show an error messages when unable to change the display
32 // configuration to mirroring.
33 class ASH_EXPORT DisplayErrorDialog : public views::DialogDelegateView,
34 public ash::DisplayController::Observer {
35 public:
36 // Shows the error dialog for |failed_new_state| and returns it.
37 static DisplayErrorDialog* ShowDialog(chromeos::OutputState failed_new_state);
39 // Update the error message for |failed_new_state|.
40 void UpdateMessageForState(chromeos::OutputState failed_new_state);
42 private:
43 explicit DisplayErrorDialog(chromeos::OutputState failed_new_state);
44 virtual ~DisplayErrorDialog();
46 // views::DialogDelegate overrides:
47 virtual int GetDialogButtons() const OVERRIDE;
49 // views::WidgetDelegate overrides::
50 virtual ui::ModalType GetModalType() const OVERRIDE;
52 // views::View overrides:
53 virtual gfx::Size GetPreferredSize() OVERRIDE;
55 // ash::DisplayController::Observer overrides:
56 virtual void OnDisplayConfigurationChanging() OVERRIDE;
58 views::Label* label_;
60 DISALLOW_COPY_AND_ASSIGN(DisplayErrorDialog);
63 // The class to observe the output failures and shows the error dialog when
64 // necessary.
65 class ASH_EXPORT DisplayErrorObserver
66 : public chromeos::OutputConfigurator::Observer,
67 public views::WidgetObserver {
68 public:
69 DisplayErrorObserver();
70 virtual ~DisplayErrorObserver();
72 const DisplayErrorDialog* dialog() const { return dialog_; }
74 // chromeos::OutputConfigurator::Observer overrides:
75 virtual void OnDisplayModeChangeFailed(
76 chromeos::OutputState failed_new_state) OVERRIDE;
78 // views::WidgetObserver overrides:
79 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
81 private:
82 DisplayErrorDialog* dialog_;
84 DISALLOW_COPY_AND_ASSIGN(DisplayErrorObserver);
87 } // namespace internal
88 } // namespace ash
90 #endif // ASH_DISPLAY_DISPLAY_ERROR_DIALOG_H_