| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 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/views/dialog_delegate.h" | 5 #include "chrome/views/dialog_delegate.h" |
| 6 | 6 |
| 7 #include "chrome/views/window.h" | 7 #include "chrome/views/window.h" |
| 8 | 8 |
| 9 namespace views { | 9 namespace views { |
| 10 | 10 |
| 11 // Overridden from WindowDelegate: | 11 // Overridden from WindowDelegate: |
| 12 | 12 |
| 13 int DialogDelegate::GetDefaultDialogButton() const { | 13 int DialogDelegate::GetDefaultDialogButton() const { |
| 14 if (GetDialogButtons() & DIALOGBUTTON_OK) | 14 if (GetDialogButtons() & DIALOGBUTTON_OK) |
| 15 return DIALOGBUTTON_OK; | 15 return DIALOGBUTTON_OK; |
| 16 if (GetDialogButtons() & DIALOGBUTTON_CANCEL) | 16 if (GetDialogButtons() & DIALOGBUTTON_CANCEL) |
| 17 return DIALOGBUTTON_CANCEL; | 17 return DIALOGBUTTON_CANCEL; |
| 18 return DIALOGBUTTON_NONE; | 18 return DIALOGBUTTON_NONE; |
| 19 } | 19 } |
| 20 | 20 |
| 21 View* DialogDelegate::GetInitiallyFocusedView() const { | 21 View* DialogDelegate::GetInitiallyFocusedView() { |
| 22 // Focus the default button if any. | 22 // Focus the default button if any. |
| 23 DialogClientView* dcv = GetDialogClientView(); | 23 DialogClientView* dcv = GetDialogClientView(); |
| 24 int default_button = GetDefaultDialogButton(); | 24 int default_button = GetDefaultDialogButton(); |
| 25 if (default_button == DIALOGBUTTON_NONE) | 25 if (default_button == DIALOGBUTTON_NONE) |
| 26 return NULL; | 26 return NULL; |
| 27 | 27 |
| 28 if ((default_button & GetDialogButtons()) == 0) { | 28 if ((default_button & GetDialogButtons()) == 0) { |
| 29 // The default button is a button we don't have. | 29 // The default button is a button we don't have. |
| 30 NOTREACHED(); | 30 NOTREACHED(); |
| 31 return NULL; | 31 return NULL; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 44 | 44 |
| 45 DialogClientView* DialogDelegate::GetDialogClientView() const { | 45 DialogClientView* DialogDelegate::GetDialogClientView() const { |
| 46 ClientView* client_view = window()->client_view(); | 46 ClientView* client_view = window()->client_view(); |
| 47 DialogClientView* dialog_client_view = client_view->AsDialogClientView(); | 47 DialogClientView* dialog_client_view = client_view->AsDialogClientView(); |
| 48 DCHECK(dialog_client_view); | 48 DCHECK(dialog_client_view); |
| 49 return dialog_client_view; | 49 return dialog_client_view; |
| 50 } | 50 } |
| 51 | 51 |
| 52 } // namespace views | 52 } // namespace views |
| 53 | 53 |
| OLD | NEW |