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/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 "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 417 |
418 void TrayBubbleView::GetWidgetHitTestMask(gfx::Path* mask) const { | 418 void TrayBubbleView::GetWidgetHitTestMask(gfx::Path* mask) const { |
419 DCHECK(mask); | 419 DCHECK(mask); |
420 mask->addRect(gfx::RectToSkRect(GetBubbleFrameView()->GetContentsBounds())); | 420 mask->addRect(gfx::RectToSkRect(GetBubbleFrameView()->GetContentsBounds())); |
421 } | 421 } |
422 | 422 |
423 gfx::Size TrayBubbleView::GetPreferredSize() const { | 423 gfx::Size TrayBubbleView::GetPreferredSize() const { |
424 return gfx::Size(preferred_width_, GetHeightForWidth(preferred_width_)); | 424 return gfx::Size(preferred_width_, GetHeightForWidth(preferred_width_)); |
425 } | 425 } |
426 | 426 |
427 gfx::Size TrayBubbleView::GetMaximumSize() { | 427 gfx::Size TrayBubbleView::GetMaximumSize() const { |
428 gfx::Size size = GetPreferredSize(); | 428 gfx::Size size = GetPreferredSize(); |
429 size.set_width(params_.max_width); | 429 size.set_width(params_.max_width); |
430 return size; | 430 return size; |
431 } | 431 } |
432 | 432 |
433 int TrayBubbleView::GetHeightForWidth(int width) const { | 433 int TrayBubbleView::GetHeightForWidth(int width) const { |
434 int height = GetInsets().height(); | 434 int height = GetInsets().height(); |
435 width = std::max(width - GetInsets().width(), 0); | 435 width = std::max(width - GetInsets().width(), 0); |
436 for (int i = 0; i < child_count(); ++i) { | 436 for (int i = 0; i < child_count(); ++i) { |
437 const View* child = child_at(i); | 437 const View* child = child_at(i); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 void TrayBubbleView::ViewHierarchyChanged( | 500 void TrayBubbleView::ViewHierarchyChanged( |
501 const ViewHierarchyChangedDetails& details) { | 501 const ViewHierarchyChangedDetails& details) { |
502 if (details.is_add && details.child == this) { | 502 if (details.is_add && details.child == this) { |
503 details.parent->SetPaintToLayer(true); | 503 details.parent->SetPaintToLayer(true); |
504 details.parent->SetFillsBoundsOpaquely(true); | 504 details.parent->SetFillsBoundsOpaquely(true); |
505 details.parent->layer()->SetMasksToBounds(true); | 505 details.parent->layer()->SetMasksToBounds(true); |
506 } | 506 } |
507 } | 507 } |
508 | 508 |
509 } // namespace views | 509 } // namespace views |
OLD | NEW |