Chromium Code Reviews| 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_client_view.h" | 5 #include "ui/views/window/dialog_client_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "ui/events/keycodes/keyboard_codes.h" | 10 #include "ui/events/keycodes/keyboard_codes.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 | 207 |
| 208 // Layout the contents view to the top and side edges of the contents bounds. | 208 // Layout the contents view to the top and side edges of the contents bounds. |
| 209 // NOTE: The local insets do not apply to the contents view sides or top. | 209 // NOTE: The local insets do not apply to the contents view sides or top. |
| 210 const gfx::Rect contents_bounds = GetContentsBounds(); | 210 const gfx::Rect contents_bounds = GetContentsBounds(); |
| 211 contents_view()->SetBounds(contents_bounds.x(), contents_bounds.y(), | 211 contents_view()->SetBounds(contents_bounds.x(), contents_bounds.y(), |
| 212 contents_bounds.width(), bounds.bottom() - contents_bounds.y()); | 212 contents_bounds.width(), bounds.bottom() - contents_bounds.y()); |
| 213 } | 213 } |
| 214 | 214 |
| 215 bool DialogClientView::AcceleratorPressed(const ui::Accelerator& accelerator) { | 215 bool DialogClientView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
| 216 DCHECK_EQ(accelerator.key_code(), ui::VKEY_ESCAPE); | 216 DCHECK_EQ(accelerator.key_code(), ui::VKEY_ESCAPE); |
| 217 // Give the contents view a chance to handle it first. | |
| 218 if (contents_view()->HandlesAccelerator(accelerator) && | |
|
sky
2016/03/07 21:14:31
I dislike this because I think it's possible for t
Evan Stade
2016/03/08 01:34:44
How about this: remove escape handling from Dialog
| |
| 219 contents_view()->AcceleratorPressed(accelerator)) { | |
| 220 return true; | |
| 221 } | |
| 222 | |
| 217 GetWidget()->Close(); | 223 GetWidget()->Close(); |
| 218 return true; | 224 return true; |
| 219 } | 225 } |
| 220 | 226 |
| 221 void DialogClientView::ViewHierarchyChanged( | 227 void DialogClientView::ViewHierarchyChanged( |
| 222 const ViewHierarchyChangedDetails& details) { | 228 const ViewHierarchyChangedDetails& details) { |
| 223 ClientView::ViewHierarchyChanged(details); | 229 ClientView::ViewHierarchyChanged(details); |
| 224 if (details.is_add && details.child == this) { | 230 if (details.is_add && details.child == this) { |
| 225 UpdateDialogButtons(); | 231 UpdateDialogButtons(); |
| 226 CreateExtraView(); | 232 CreateExtraView(); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 child_views.end()); | 366 child_views.end()); |
| 361 | 367 |
| 362 // Setup focus. | 368 // Setup focus. |
| 363 for (size_t i = 0; i < child_views.size(); i++) { | 369 for (size_t i = 0; i < child_views.size(); i++) { |
| 364 child_views[i]->SetNextFocusableView( | 370 child_views[i]->SetNextFocusableView( |
| 365 i + 1 != child_views.size() ? child_views[i + 1] : nullptr); | 371 i + 1 != child_views.size() ? child_views[i + 1] : nullptr); |
| 366 } | 372 } |
| 367 } | 373 } |
| 368 | 374 |
| 369 } // namespace views | 375 } // namespace views |
| OLD | NEW |