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

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

Issue 2785683003: views: implement width snapping for DialogDelegateViews (Closed)
Patch Set: Created 3 years, 8 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 (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/tray_bubble_view.h" 5 #include "ui/views/bubble/tray_bubble_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "cc/paint/paint_flags.h" 10 #include "cc/paint/paint_flags.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 291
292 void TrayBubbleView::GetWidgetHitTestMask(gfx::Path* mask) const { 292 void TrayBubbleView::GetWidgetHitTestMask(gfx::Path* mask) const {
293 DCHECK(mask); 293 DCHECK(mask);
294 mask->addRect(gfx::RectToSkRect(GetBubbleFrameView()->GetContentsBounds())); 294 mask->addRect(gfx::RectToSkRect(GetBubbleFrameView()->GetContentsBounds()));
295 } 295 }
296 296
297 base::string16 TrayBubbleView::GetAccessibleWindowTitle() const { 297 base::string16 TrayBubbleView::GetAccessibleWindowTitle() const {
298 return delegate_->GetAccessibleNameForBubble(); 298 return delegate_->GetAccessibleNameForBubble();
299 } 299 }
300 300
301 gfx::Size TrayBubbleView::GetPreferredSize() const { 301 gfx::Size TrayBubbleView::GetUnsnappedPreferredSize() const {
302 return gfx::Size(preferred_width_, GetHeightForWidth(preferred_width_)); 302 return gfx::Size(preferred_width_, GetHeightForWidth(preferred_width_));
303 } 303 }
304 304
305 gfx::Size TrayBubbleView::GetMaximumSize() const { 305 gfx::Size TrayBubbleView::GetMaximumSize() const {
306 gfx::Size size = GetPreferredSize(); 306 gfx::Size size = GetPreferredSize();
307 size.set_width(params_.max_width); 307 size.set_width(params_.max_width);
308 return size; 308 return size;
309 } 309 }
310 310
311 int TrayBubbleView::GetHeightForWidth(int width) const { 311 int TrayBubbleView::GetHeightForWidth(int width) const {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 377
378 void TrayBubbleView::ViewHierarchyChanged( 378 void TrayBubbleView::ViewHierarchyChanged(
379 const ViewHierarchyChangedDetails& details) { 379 const ViewHierarchyChangedDetails& details) {
380 if (details.is_add && details.child == this) { 380 if (details.is_add && details.child == this) {
381 details.parent->SetPaintToLayer(); 381 details.parent->SetPaintToLayer();
382 details.parent->layer()->SetMasksToBounds(true); 382 details.parent->layer()->SetMasksToBounds(true);
383 } 383 }
384 } 384 }
385 385
386 } // namespace views 386 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698