Index: ash/display/display_error_dialog.h |
diff --git a/ash/display/display_error_dialog.h b/ash/display/display_error_dialog.h |
index cd7829ea7caf4e03fde14049eabfb76715d6088f..c320e50dd76b354a715eff1a88c672734616aac3 100644 |
--- a/ash/display/display_error_dialog.h |
+++ b/ash/display/display_error_dialog.h |
@@ -8,7 +8,8 @@ |
#include "ash/ash_export.h" |
#include "ash/display/display_controller.h" |
#include "base/compiler_specific.h" |
-#include "base/gtest_prod_util.h" |
+#include "chromeos/display/output_configurator.h" |
+#include "ui/views/widget/widget_observer.h" |
#include "ui/views/window/dialog_delegate.h" |
namespace aura { |
@@ -32,16 +33,14 @@ namespace internal { |
class ASH_EXPORT DisplayErrorDialog : public views::DialogDelegateView, |
public ash::DisplayController::Observer { |
public: |
- // Shows the error dialog. |
- static void ShowDialog(); |
+ // Shows the error dialog for |new_state| and returns it. |
+ static DisplayErrorDialog* ShowDialog(chromeos::OutputState new_state); |
- private: |
- FRIEND_TEST_ALL_PREFIXES(DisplayErrorDialogTest, Normal); |
- FRIEND_TEST_ALL_PREFIXES(DisplayErrorDialogTest, CallTwice); |
- FRIEND_TEST_ALL_PREFIXES(DisplayErrorDialogTest, SingleDisplay); |
- FRIEND_TEST_ALL_PREFIXES(DisplayErrorDialogTest, DisplayDisconnected); |
+ // Update the error message for |new_state|. |
+ void UpdateMessageForState(chromeos::OutputState new_state); |
- DisplayErrorDialog(); |
+ private: |
+ DisplayErrorDialog(chromeos::OutputState new_state); |
virtual ~DisplayErrorDialog(); |
// views::DialogDelegate overrides: |
@@ -56,14 +55,35 @@ class ASH_EXPORT DisplayErrorDialog : public views::DialogDelegateView, |
// ash::DisplayController::Observer overrides: |
virtual void OnDisplayConfigurationChanging() OVERRIDE; |
- // Returns the pointer of the current instance of this dialog. |
- static DisplayErrorDialog* GetInstanceForTest(); |
- |
views::Label* label_; |
DISALLOW_COPY_AND_ASSIGN(DisplayErrorDialog); |
}; |
+// The class to observe the output failures and shows the error dialog when |
+// necessary. |
+class ASH_EXPORT DisplayErrorObserver |
+ : public chromeos::OutputConfigurator::Observer, |
+ public views::WidgetObserver { |
+ public: |
+ DisplayErrorObserver(); |
+ virtual ~DisplayErrorObserver(); |
+ |
+ DisplayErrorDialog* dialog() const { return dialog_; } |
oshima
2013/02/14 00:01:50
no const if it returns non-const internal state.
Jun Mukai
2013/02/14 00:54:03
made it return to const pointer.
|
+ |
+ // chromeos::OutputConfigurator::Observer overrides: |
+ virtual void OnDisplayModeChangeFailed( |
+ chromeos::OutputState new_state) OVERRIDE; |
+ |
+ // views::WidgetObserver overrides: |
+ virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
+ |
+ private: |
+ DisplayErrorDialog* dialog_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DisplayErrorObserver); |
+}; |
+ |
} // namespace internal |
} // namespace ash |