Chromium Code Reviews| Index: ash/display/display_error_dialog.cc |
| diff --git a/ash/display/display_error_dialog.cc b/ash/display/display_error_dialog.cc |
| index 6757e966f3f0c7d4a4966df3b16c5bde40615512..604d86acf6d9d9d4c9017f8cae2d216b45ade1e0 100644 |
| --- a/ash/display/display_error_dialog.cc |
| +++ b/ash/display/display_error_dialog.cc |
| @@ -7,6 +7,7 @@ |
| #include "ash/screen_ash.h" |
| #include "ash/shell.h" |
| #include "grit/ash_strings.h" |
| +#include "ui/aura/root_window.h" |
| #include "ui/aura/window.h" |
| #include "ui/base/l10n/l10n_util.h" |
| #include "ui/base/ui_base_types.h" |
| @@ -39,15 +40,22 @@ void DisplayErrorDialog::ShowDialog() { |
| return; |
| } |
| - const gfx::Display& secondary_display = ash::ScreenAsh::GetSecondaryDisplay(); |
| + gfx::Screen* screen = Shell::GetScreen(); |
| + const gfx::Display& target_display = |
| + (screen->GetNumDisplays() > 1) ? |
| + ScreenAsh::GetSecondaryDisplay() : screen->GetPrimaryDisplay(); |
| g_instance = new DisplayErrorDialog(); |
| views::Widget* widget = new views::Widget; |
| views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
| params.delegate = g_instance; |
| - // Makes |widget| belong to the secondary display. Size and location are |
| + // Makes |widget| belong to the target display. Size and location are |
| // fixed by CenterWindow() below. |
| - params.bounds = secondary_display.bounds(); |
| + params.bounds = target_display.bounds(); |
| + DisplayController* display_controller = |
| + Shell::GetInstance()->display_controller(); |
| + params.context = |
| + display_controller->GetRootWindowForDisplayId(target_display.id()); |
| params.keep_on_top = true; |
| widget->Init(params); |
| @@ -93,5 +101,10 @@ void DisplayErrorDialog::OnDisplayConfigurationChanging() { |
| GetWidget()->Close(); |
| } |
| +// static |
| +DisplayErrorDialog* DisplayErrorDialog::GetInstanceForTest() { |
|
oshima
2013/02/06 00:17:28
DCHECK(g_instance);
Jun Mukai
2013/02/06 00:37:18
g_instance can be NULL in case the dialog is gone
|
| + return g_instance; |
| +} |
| + |
| } // namespace internal |
| } // namespace ash |