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