OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_dialog_delegate.h" | 5 #include "ui/views/bubble/bubble_dialog_delegate.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "ui/accessibility/ax_node_data.h" | 8 #include "ui/accessibility/ax_node_data.h" |
9 #include "ui/base/default_style.h" | 9 #include "ui/base/default_style.h" |
10 #include "ui/base/material_design/material_design_controller.h" | 10 #include "ui/base/material_design/material_design_controller.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 kPanelHorizMargin); | 224 kPanelHorizMargin); |
225 if (anchor_view) | 225 if (anchor_view) |
226 SetAnchorView(anchor_view); | 226 SetAnchorView(anchor_view); |
227 UpdateColorsFromTheme(GetNativeTheme()); | 227 UpdateColorsFromTheme(GetNativeTheme()); |
228 } | 228 } |
229 | 229 |
230 gfx::Rect BubbleDialogDelegateView::GetBubbleBounds() { | 230 gfx::Rect BubbleDialogDelegateView::GetBubbleBounds() { |
231 // The argument rect has its origin at the bubble's arrow anchor point; | 231 // The argument rect has its origin at the bubble's arrow anchor point; |
232 // its size is the preferred size of the bubble's client view (this view). | 232 // its size is the preferred size of the bubble's client view (this view). |
233 bool anchor_minimized = anchor_widget() && anchor_widget()->IsMinimized(); | 233 bool anchor_minimized = anchor_widget() && anchor_widget()->IsMinimized(); |
234 gfx::Size size = GetWidget()->client_view()->GetPreferredSize(); | |
sky
2017/02/14 21:24:35
Can you write test coverage of this?
Elly Fong-Jones
2017/02/15 17:43:39
Done.
| |
235 size.SetToMax(GetMinimumSize()); | |
234 return GetBubbleFrameView()->GetUpdatedWindowBounds( | 236 return GetBubbleFrameView()->GetUpdatedWindowBounds( |
235 GetAnchorRect(), GetWidget()->client_view()->GetPreferredSize(), | 237 GetAnchorRect(), size, adjust_if_offscreen_ && !anchor_minimized); |
236 adjust_if_offscreen_ && !anchor_minimized); | |
237 } | 238 } |
238 | 239 |
239 const gfx::FontList& BubbleDialogDelegateView::GetTitleFontList() const { | 240 const gfx::FontList& BubbleDialogDelegateView::GetTitleFontList() const { |
240 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 241 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
241 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) | 242 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) |
242 return rb.GetFontListWithDelta(ui::kTitleFontSizeDelta); | 243 return rb.GetFontListWithDelta(ui::kTitleFontSizeDelta); |
243 return rb.GetFontList(ui::ResourceBundle::MediumFont); | 244 return rb.GetFontList(ui::ResourceBundle::MediumFont); |
244 } | 245 } |
245 | 246 |
246 void BubbleDialogDelegateView::OnNativeThemeChanged( | 247 void BubbleDialogDelegateView::OnNativeThemeChanged( |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
324 // http://crbug.com/474622 for details. | 325 // http://crbug.com/474622 for details. |
325 if (widget == GetWidget() && visible) { | 326 if (widget == GetWidget() && visible) { |
326 ui::AXNodeData node_data; | 327 ui::AXNodeData node_data; |
327 GetAccessibleNodeData(&node_data); | 328 GetAccessibleNodeData(&node_data); |
328 if (node_data.role == ui::AX_ROLE_ALERT_DIALOG) | 329 if (node_data.role == ui::AX_ROLE_ALERT_DIALOG) |
329 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 330 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
330 } | 331 } |
331 } | 332 } |
332 | 333 |
333 } // namespace views | 334 } // namespace views |
OLD | NEW |