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