| OLD | NEW |
| 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 #include "ui/views/window/dialog_delegate.h" | 5 #include "ui/views/window/dialog_delegate.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 bool DialogDelegate::Close() { | 107 bool DialogDelegate::Close() { |
| 108 int buttons = GetDialogButtons(); | 108 int buttons = GetDialogButtons(); |
| 109 if ((buttons & ui::DIALOG_BUTTON_CANCEL) || | 109 if ((buttons & ui::DIALOG_BUTTON_CANCEL) || |
| 110 (buttons == ui::DIALOG_BUTTON_NONE)) { | 110 (buttons == ui::DIALOG_BUTTON_NONE)) { |
| 111 return Cancel(); | 111 return Cancel(); |
| 112 } | 112 } |
| 113 return Accept(); | 113 return Accept(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void DialogDelegate::UpdateButton(LabelButton* button, ui::DialogButton type) { |
| 117 button->SetText(GetDialogButtonLabel(type)); |
| 118 button->SetEnabled(IsDialogButtonEnabled(type)); |
| 119 button->SetIsDefault(type == GetDefaultDialogButton()); |
| 120 } |
| 121 |
| 116 base::string16 DialogDelegate::GetDialogTitle() const { | 122 base::string16 DialogDelegate::GetDialogTitle() const { |
| 117 return GetWindowTitle(); | 123 return GetWindowTitle(); |
| 118 } | 124 } |
| 119 | 125 |
| 120 int DialogDelegate::GetDialogButtons() const { | 126 int DialogDelegate::GetDialogButtons() const { |
| 121 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; | 127 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; |
| 122 } | 128 } |
| 123 | 129 |
| 124 int DialogDelegate::GetDefaultDialogButton() const { | 130 int DialogDelegate::GetDefaultDialogButton() const { |
| 125 if (GetDialogButtons() & ui::DIALOG_BUTTON_OK) | 131 if (GetDialogButtons() & ui::DIALOG_BUTTON_OK) |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 state->role = ui::AX_ROLE_DIALOG; | 254 state->role = ui::AX_ROLE_DIALOG; |
| 249 } | 255 } |
| 250 | 256 |
| 251 void DialogDelegateView::ViewHierarchyChanged( | 257 void DialogDelegateView::ViewHierarchyChanged( |
| 252 const ViewHierarchyChangedDetails& details) { | 258 const ViewHierarchyChangedDetails& details) { |
| 253 if (details.is_add && details.child == this && GetWidget()) | 259 if (details.is_add && details.child == this && GetWidget()) |
| 254 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 260 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 255 } | 261 } |
| 256 | 262 |
| 257 } // namespace views | 263 } // namespace views |
| OLD | NEW |