| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/views/modal_dialog_delegate.h" | 5 #include "chrome/browser/views/modal_dialog_delegate.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/views/window.h" |
| 8 #include "views/window/window.h" | 9 #include "views/window/window.h" |
| 9 | 10 |
| 10 void ModalDialogDelegate::ShowModalDialog() { | 11 void ModalDialogDelegate::ShowModalDialog() { |
| 11 gfx::NativeWindow root_hwnd = GetDialogRootWindow(); | 12 gfx::NativeWindow root_hwnd = GetDialogRootWindow(); |
| 12 // GetMessageBoxRootWindow() will be NULL if there's no selected tab (e.g., | 13 // GetMessageBoxRootWindow() will be NULL if there's no selected tab (e.g., |
| 13 // during shutdown), in which case we simply skip showing this dialog. | 14 // during shutdown), in which case we simply skip showing this dialog. |
| 14 if (!root_hwnd) { | 15 if (!root_hwnd) { |
| 15 Cancel(); | 16 Cancel(); |
| 16 } else { | 17 } else { |
| 17 dialog_ = views::Window::CreateChromeWindow(root_hwnd, gfx::Rect(), this); | 18 dialog_ = browser::CreateViewsWindow(root_hwnd, gfx::Rect(), this); |
| 18 dialog_->Show(); | 19 dialog_->Show(); |
| 19 } | 20 } |
| 20 } | 21 } |
| 21 | 22 |
| 22 void ModalDialogDelegate::ActivateModalDialog() { | 23 void ModalDialogDelegate::ActivateModalDialog() { |
| 23 DCHECK(dialog_); | 24 DCHECK(dialog_); |
| 24 // Ensure that the dialog is visible and at the top of the z-order. These | 25 // Ensure that the dialog is visible and at the top of the z-order. These |
| 25 // conditions may not be true if the dialog was opened on a different virtual | 26 // conditions may not be true if the dialog was opened on a different virtual |
| 26 // desktop to the one the browser window is on. | 27 // desktop to the one the browser window is on. |
| 27 dialog_->Show(); | 28 dialog_->Show(); |
| 28 dialog_->Activate(); | 29 dialog_->Activate(); |
| 29 } | 30 } |
| 30 | 31 |
| 31 void ModalDialogDelegate::CloseModalDialog() { | 32 void ModalDialogDelegate::CloseModalDialog() { |
| 32 // If the dialog is visible close it. | 33 // If the dialog is visible close it. |
| 33 if (dialog_) | 34 if (dialog_) |
| 34 dialog_->Close(); | 35 dialog_->Close(); |
| 35 } | 36 } |
| 36 | 37 |
| 37 ModalDialogDelegate::ModalDialogDelegate() : dialog_(NULL) { | 38 ModalDialogDelegate::ModalDialogDelegate() : dialog_(NULL) { |
| 38 } | 39 } |
| 39 | 40 |
| OLD | NEW |