Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: ui/views/bubble/bubble_dialog_delegate.cc

Issue 2692113002: harmony: fix sizing on webusb chooser dialog (Closed)
Patch Set: use preferred instead of minimum Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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();
235 size.SetToMax(GetPreferredSize());
sky 2017/02/24 21:15:19 I would expect GetPreferredSize() to include the p
tapted 2017/02/27 22:17:36 DialogClientView actually has some bugs around fee
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698