OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/special_popup_row.h" | 5 #include "ash/system/tray/special_popup_row.h" |
6 | 6 |
7 #include "ash/system/tray/hover_highlight_view.h" | 7 #include "ash/system/tray/hover_highlight_view.h" |
8 #include "ash/system/tray/throbber_view.h" | 8 #include "ash/system/tray/throbber_view.h" |
9 #include "ash/system/tray/tray_constants.h" | 9 #include "ash/system/tray/tray_constants.h" |
10 #include "ash/system/tray/tray_popup_header_button.h" | 10 #include "ash/system/tray/tray_popup_header_button.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 96 } |
97 button_container_->AddChildView(throbber); | 97 button_container_->AddChildView(throbber); |
98 } | 98 } |
99 | 99 |
100 gfx::Size SpecialPopupRow::GetPreferredSize() { | 100 gfx::Size SpecialPopupRow::GetPreferredSize() { |
101 gfx::Size size = views::View::GetPreferredSize(); | 101 gfx::Size size = views::View::GetPreferredSize(); |
102 size.set_height(kSpecialPopupRowHeight); | 102 size.set_height(kSpecialPopupRowHeight); |
103 return size; | 103 return size; |
104 } | 104 } |
105 | 105 |
| 106 int SpecialPopupRow::GetHeightForWidth(int width) { |
| 107 return kSpecialPopupRowHeight; |
| 108 } |
| 109 |
106 void SpecialPopupRow::Layout() { | 110 void SpecialPopupRow::Layout() { |
107 views::View::Layout(); | 111 views::View::Layout(); |
108 gfx::Rect content_bounds = GetContentsBounds(); | 112 gfx::Rect content_bounds = GetContentsBounds(); |
109 if (content_bounds.IsEmpty()) | 113 if (content_bounds.IsEmpty()) |
110 return; | 114 return; |
111 if (!button_container_) { | 115 if (!button_container_) { |
112 content_->SetBoundsRect(GetContentsBounds()); | 116 content_->SetBoundsRect(GetContentsBounds()); |
113 return; | 117 return; |
114 } | 118 } |
115 | 119 |
116 gfx::Rect bounds(button_container_->GetPreferredSize()); | 120 gfx::Rect bounds(button_container_->GetPreferredSize()); |
117 bounds.set_height(content_bounds.height()); | 121 bounds.set_height(content_bounds.height()); |
118 gfx::Rect container_bounds = content_bounds; | 122 gfx::Rect container_bounds = content_bounds; |
119 container_bounds.ClampToCenteredSize(bounds.size()); | 123 container_bounds.ClampToCenteredSize(bounds.size()); |
120 container_bounds.set_x(content_bounds.width() - container_bounds.width()); | 124 container_bounds.set_x(content_bounds.width() - container_bounds.width()); |
121 button_container_->SetBoundsRect(container_bounds); | 125 button_container_->SetBoundsRect(container_bounds); |
122 | 126 |
123 bounds = content_->bounds(); | 127 bounds = content_->bounds(); |
124 bounds.set_width(button_container_->x()); | 128 bounds.set_width(button_container_->x()); |
125 content_->SetBoundsRect(bounds); | 129 content_->SetBoundsRect(bounds); |
126 } | 130 } |
127 | 131 |
128 } // namespace internal | 132 } // namespace internal |
129 } // namespace ash | 133 } // namespace ash |
OLD | NEW |