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/bubble/bubble_frame_view.h" | 5 #include "ui/views/bubble/bubble_frame_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 *rb->GetImageNamed(IDR_CLOSE_DIALOG).ToImageSkia()); | 126 *rb->GetImageNamed(IDR_CLOSE_DIALOG).ToImageSkia()); |
127 close_button->SetImage( | 127 close_button->SetImage( |
128 CustomButton::STATE_HOVERED, | 128 CustomButton::STATE_HOVERED, |
129 *rb->GetImageNamed(IDR_CLOSE_DIALOG_H).ToImageSkia()); | 129 *rb->GetImageNamed(IDR_CLOSE_DIALOG_H).ToImageSkia()); |
130 close_button->SetImage( | 130 close_button->SetImage( |
131 CustomButton::STATE_PRESSED, | 131 CustomButton::STATE_PRESSED, |
132 *rb->GetImageNamed(IDR_CLOSE_DIALOG_P).ToImageSkia()); | 132 *rb->GetImageNamed(IDR_CLOSE_DIALOG_P).ToImageSkia()); |
133 } | 133 } |
134 close_button->SetTooltipText(l10n_util::GetStringUTF16(IDS_APP_CLOSE)); | 134 close_button->SetTooltipText(l10n_util::GetStringUTF16(IDS_APP_CLOSE)); |
135 close_button->SizeToPreferredSize(); | 135 close_button->SizeToPreferredSize(); |
136 | |
137 // Remove the close button from tab traversal on all platforms. It defaults to | |
msw
2017/07/12 17:20:25
nit: remove the "It defaults to" sentence
tapted
2017/07/12 23:49:10
Done.
| |
138 // FocusBehavior::ACCESSIBLE_ONLY which (apart from on Mac) only affects | |
139 // buttons in AccessiblePaneViews (which the close button is not). Note this | |
140 // does not affect screen readers' ability to focus the element. Keyboard | |
msw
2017/07/12 17:20:25
nit: s/element/close button/
tapted
2017/07/12 23:49:10
Done.
| |
141 // access to this element when not using a screen reader is done via the ESC | |
msw
2017/07/12 17:20:25
nit: s/this element/the close button/
tapted
2017/07/12 23:49:10
Done.
| |
142 // key handler in DialogClientView. | |
143 close_button->SetFocusBehavior(View::FocusBehavior::NEVER); | |
136 return close_button; | 144 return close_button; |
137 } | 145 } |
138 | 146 |
139 gfx::Rect BubbleFrameView::GetBoundsForClientView() const { | 147 gfx::Rect BubbleFrameView::GetBoundsForClientView() const { |
140 gfx::Rect client_bounds = GetContentsBounds(); | 148 gfx::Rect client_bounds = GetContentsBounds(); |
141 client_bounds.Inset(GetInsets()); | 149 client_bounds.Inset(GetInsets()); |
142 if (footnote_container_) { | 150 if (footnote_container_) { |
143 client_bounds.set_height(client_bounds.height() - | 151 client_bounds.set_height(client_bounds.height() - |
144 footnote_container_->height()); | 152 footnote_container_->height()); |
145 } | 153 } |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
564 | 572 |
565 DialogDelegate* dialog_delegate = | 573 DialogDelegate* dialog_delegate = |
566 GetWidget()->widget_delegate()->AsDialogDelegate(); | 574 GetWidget()->widget_delegate()->AsDialogDelegate(); |
567 if (dialog_delegate && dialog_delegate->ShouldSnapFrameWidth()) | 575 if (dialog_delegate && dialog_delegate->ShouldSnapFrameWidth()) |
568 size.set_width(LayoutProvider::Get()->GetSnappedDialogWidth(size.width())); | 576 size.set_width(LayoutProvider::Get()->GetSnappedDialogWidth(size.width())); |
569 | 577 |
570 return size; | 578 return size; |
571 } | 579 } |
572 | 580 |
573 } // namespace views | 581 } // namespace views |
OLD | NEW |