Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Side by Side Diff: ash/display/display_error_dialog.h

Issue 12212171: Provides more types of errors for output status. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_DISPLAY_DISPLAY_ERROR_DIALOG_H_ 5 #ifndef ASH_DISPLAY_DISPLAY_ERROR_DIALOG_H_
6 #define ASH_DISPLAY_DISPLAY_ERROR_DIALOG_H_ 6 #define ASH_DISPLAY_DISPLAY_ERROR_DIALOG_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/display/display_controller.h" 9 #include "ash/display/display_controller.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/gtest_prod_util.h" 11 #include "chromeos/display/output_configurator.h"
12 #include "ui/views/widget/widget_observer.h"
12 #include "ui/views/window/dialog_delegate.h" 13 #include "ui/views/window/dialog_delegate.h"
13 14
14 namespace aura { 15 namespace aura {
15 class RootWindow; 16 class RootWindow;
16 } // namespace aura 17 } // namespace aura
17 18
18 namespace gfx { 19 namespace gfx {
19 class Display; 20 class Display;
20 class Size; 21 class Size;
21 } // namespace gfx 22 } // namespace gfx
22 23
23 namespace views { 24 namespace views {
24 class Label; 25 class Label;
25 } // namespace views 26 } // namespace views
26 27
27 namespace ash { 28 namespace ash {
28 namespace internal { 29 namespace internal {
29 30
30 // Dialog used to show an error messages when unable to change the display 31 // Dialog used to show an error messages when unable to change the display
31 // configuration to mirroring. 32 // configuration to mirroring.
32 class ASH_EXPORT DisplayErrorDialog : public views::DialogDelegateView, 33 class ASH_EXPORT DisplayErrorDialog : public views::DialogDelegateView,
33 public ash::DisplayController::Observer { 34 public ash::DisplayController::Observer {
34 public: 35 public:
35 // Shows the error dialog. 36 // Shows the error dialog for |new_state| and returns it.
36 static void ShowDialog(); 37 static DisplayErrorDialog* ShowDialog(chromeos::OutputState new_state);
38
39 // Update the error message for |new_state|.
40 void UpdateMessageForState(chromeos::OutputState new_state);
37 41
38 private: 42 private:
39 FRIEND_TEST_ALL_PREFIXES(DisplayErrorDialogTest, Normal); 43 DisplayErrorDialog(chromeos::OutputState new_state);
40 FRIEND_TEST_ALL_PREFIXES(DisplayErrorDialogTest, CallTwice);
41 FRIEND_TEST_ALL_PREFIXES(DisplayErrorDialogTest, SingleDisplay);
42 FRIEND_TEST_ALL_PREFIXES(DisplayErrorDialogTest, DisplayDisconnected);
43
44 DisplayErrorDialog();
45 virtual ~DisplayErrorDialog(); 44 virtual ~DisplayErrorDialog();
46 45
47 // views::DialogDelegate overrides: 46 // views::DialogDelegate overrides:
48 virtual int GetDialogButtons() const OVERRIDE; 47 virtual int GetDialogButtons() const OVERRIDE;
49 48
50 // views::WidgetDelegate overrides:: 49 // views::WidgetDelegate overrides::
51 virtual ui::ModalType GetModalType() const OVERRIDE; 50 virtual ui::ModalType GetModalType() const OVERRIDE;
52 51
53 // views::View overrides: 52 // views::View overrides:
54 virtual gfx::Size GetPreferredSize() OVERRIDE; 53 virtual gfx::Size GetPreferredSize() OVERRIDE;
55 54
56 // ash::DisplayController::Observer overrides: 55 // ash::DisplayController::Observer overrides:
57 virtual void OnDisplayConfigurationChanging() OVERRIDE; 56 virtual void OnDisplayConfigurationChanging() OVERRIDE;
58 57
59 // Returns the pointer of the current instance of this dialog.
60 static DisplayErrorDialog* GetInstanceForTest();
61
62 views::Label* label_; 58 views::Label* label_;
63 59
64 DISALLOW_COPY_AND_ASSIGN(DisplayErrorDialog); 60 DISALLOW_COPY_AND_ASSIGN(DisplayErrorDialog);
65 }; 61 };
66 62
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();
71
72 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.
73
74 // chromeos::OutputConfigurator::Observer overrides:
75 virtual void OnDisplayModeChangeFailed(
76 chromeos::OutputState new_state) OVERRIDE;
77
78 // views::WidgetObserver overrides:
79 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
80
81 private:
82 DisplayErrorDialog* dialog_;
83
84 DISALLOW_COPY_AND_ASSIGN(DisplayErrorObserver);
85 };
86
67 } // namespace internal 87 } // namespace internal
68 } // namespace ash 88 } // namespace ash
69 89
70 #endif // ASH_DISPLAY_DISPLAY_ERROR_DIALOG_H_ 90 #endif // ASH_DISPLAY_DISPLAY_ERROR_DIALOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698