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"
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
{
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
);
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
;
60 DISALLOW_COPY_AND_ASSIGN(DisplayErrorDialog
);
63 // The class to observe the output failures and shows the error dialog when
65 class ASH_EXPORT DisplayErrorObserver
66 : public chromeos::OutputConfigurator::Observer
,
67 public views::WidgetObserver
{
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
;
82 DisplayErrorDialog
* dialog_
;
84 DISALLOW_COPY_AND_ASSIGN(DisplayErrorObserver
);
87 } // namespace internal
90 #endif // ASH_DISPLAY_DISPLAY_ERROR_DIALOG_H_