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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 button->SetText(GetDialogButtonLabel(type)); | 122 button->SetText(GetDialogButtonLabel(type)); |
123 button->SetEnabled(IsDialogButtonEnabled(type)); | 123 button->SetEnabled(IsDialogButtonEnabled(type)); |
124 bool is_default = type == GetDefaultDialogButton(); | 124 bool is_default = type == GetDefaultDialogButton(); |
125 if (!PlatformStyle::kDialogDefaultButtonCanBeCancel && | 125 if (!PlatformStyle::kDialogDefaultButtonCanBeCancel && |
126 type == ui::DIALOG_BUTTON_CANCEL) { | 126 type == ui::DIALOG_BUTTON_CANCEL) { |
127 is_default = false; | 127 is_default = false; |
128 } | 128 } |
129 button->SetIsDefault(is_default); | 129 button->SetIsDefault(is_default); |
130 } | 130 } |
131 | 131 |
| 132 bool DialogDelegate::ShouldSnapFrameWidth() const { |
| 133 return true; |
| 134 } |
| 135 |
132 int DialogDelegate::GetDialogButtons() const { | 136 int DialogDelegate::GetDialogButtons() const { |
133 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; | 137 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; |
134 } | 138 } |
135 | 139 |
136 int DialogDelegate::GetDefaultDialogButton() const { | 140 int DialogDelegate::GetDefaultDialogButton() const { |
137 if (GetDialogButtons() & ui::DIALOG_BUTTON_OK) | 141 if (GetDialogButtons() & ui::DIALOG_BUTTON_OK) |
138 return ui::DIALOG_BUTTON_OK; | 142 return ui::DIALOG_BUTTON_OK; |
139 if (GetDialogButtons() & ui::DIALOG_BUTTON_CANCEL) | 143 if (GetDialogButtons() & ui::DIALOG_BUTTON_CANCEL) |
140 return ui::DIALOG_BUTTON_CANCEL; | 144 return ui::DIALOG_BUTTON_CANCEL; |
141 return ui::DIALOG_BUTTON_NONE; | 145 return ui::DIALOG_BUTTON_NONE; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 node_data->role = ui::AX_ROLE_DIALOG; | 265 node_data->role = ui::AX_ROLE_DIALOG; |
262 } | 266 } |
263 | 267 |
264 void DialogDelegateView::ViewHierarchyChanged( | 268 void DialogDelegateView::ViewHierarchyChanged( |
265 const ViewHierarchyChangedDetails& details) { | 269 const ViewHierarchyChangedDetails& details) { |
266 if (details.is_add && details.child == this && GetWidget()) | 270 if (details.is_add && details.child == this && GetWidget()) |
267 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 271 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
268 } | 272 } |
269 | 273 |
270 } // namespace views | 274 } // namespace views |
OLD | NEW |