OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/system/tray/fixed_sized_scroll_view.h" | 5 #include "ash/system/tray/fixed_sized_scroll_view.h" |
6 | 6 |
7 namespace ash { | 7 namespace ash { |
8 namespace internal { | |
9 | 8 |
10 FixedSizedScrollView::FixedSizedScrollView() { | 9 FixedSizedScrollView::FixedSizedScrollView() { |
11 set_notify_enter_exit_on_child(true); | 10 set_notify_enter_exit_on_child(true); |
12 } | 11 } |
13 | 12 |
14 FixedSizedScrollView::~FixedSizedScrollView() { | 13 FixedSizedScrollView::~FixedSizedScrollView() { |
15 } | 14 } |
16 | 15 |
17 void FixedSizedScrollView::SetContentsView(views::View* view) { | 16 void FixedSizedScrollView::SetContentsView(views::View* view) { |
18 SetContents(view); | 17 SetContents(view); |
(...skipping 27 matching lines...) Expand all Loading... |
46 contents()->SetBoundsRect(bounds); | 45 contents()->SetBoundsRect(bounds); |
47 } | 46 } |
48 } | 47 } |
49 | 48 |
50 void FixedSizedScrollView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 49 void FixedSizedScrollView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
51 gfx::Rect bounds = gfx::Rect(contents()->GetPreferredSize()); | 50 gfx::Rect bounds = gfx::Rect(contents()->GetPreferredSize()); |
52 bounds.set_width(std::max(0, width() - GetScrollBarWidth())); | 51 bounds.set_width(std::max(0, width() - GetScrollBarWidth())); |
53 contents()->SetBoundsRect(bounds); | 52 contents()->SetBoundsRect(bounds); |
54 } | 53 } |
55 | 54 |
56 } // namespace internal | |
57 } // namespace ash | 55 } // namespace ash |
OLD | NEW |