Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "chrome/browser/ui/views/desktop_capture/desktop_media_list_view.h" | 5 #include "chrome/browser/ui/views/desktop_capture/desktop_media_list_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 if (i > 0 && i % active_style_->columns == 0) { | 111 if (i > 0 && i % active_style_->columns == 0) { |
| 112 x = 0; | 112 x = 0; |
| 113 y += active_style_->item_size.height(); | 113 y += active_style_->item_size.height(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 child_at(i)->SetBounds(x, y, active_style_->item_size.width(), | 116 child_at(i)->SetBounds(x, y, active_style_->item_size.width(), |
| 117 active_style_->item_size.height()); | 117 active_style_->item_size.height()); |
| 118 | 118 |
| 119 x += active_style_->item_size.width(); | 119 x += active_style_->item_size.width(); |
| 120 } | 120 } |
| 121 | |
| 122 // TODO(qiangchen): Bounded ScrollView has a bug to display horizontal bar | |
| 123 // always, and then display vertical bar when the content just fit the | |
| 124 // container. See crbug/636338. | |
|
msw
2016/09/06 19:01:13
nit: file a new bug for the TODO to fix the underl
qiangchen
2016/09/06 21:48:03
Done.
| |
| 125 // Fix the underlying issue and remove the following code. | |
| 126 gfx::Size parent_content_size = parent()->GetContentsBounds().size(); | |
| 127 gfx::Size preferred_size = GetPreferredSize(); | |
| 128 SetSize(gfx::Size( | |
|
msw
2016/09/06 19:01:13
optional nit: use Size::SetToMax():
gfx::Size pref
qiangchen
2016/09/06 21:48:03
Done.
| |
| 129 std::max(parent_content_size.width(), preferred_size.width()), | |
| 130 std::max(parent_content_size.height(), preferred_size.height()))); | |
| 121 } | 131 } |
| 122 | 132 |
| 123 bool DesktopMediaListView::OnKeyPressed(const ui::KeyEvent& event) { | 133 bool DesktopMediaListView::OnKeyPressed(const ui::KeyEvent& event) { |
| 124 int position_increment = 0; | 134 int position_increment = 0; |
| 125 switch (event.key_code()) { | 135 switch (event.key_code()) { |
| 126 case ui::VKEY_UP: | 136 case ui::VKEY_UP: |
| 127 position_increment = -active_style_->columns; | 137 position_increment = -active_style_->columns; |
| 128 break; | 138 break; |
| 129 case ui::VKEY_DOWN: | 139 case ui::VKEY_DOWN: |
| 130 position_increment = active_style_->columns; | 140 position_increment = active_style_->columns; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 } | 283 } |
| 274 | 284 |
| 275 DesktopMediaSourceView* DesktopMediaListView::GetChild(int index) { | 285 DesktopMediaSourceView* DesktopMediaListView::GetChild(int index) { |
| 276 return static_cast<DesktopMediaSourceView*>(child_at(index)); | 286 return static_cast<DesktopMediaSourceView*>(child_at(index)); |
| 277 } | 287 } |
| 278 | 288 |
| 279 void DesktopMediaListView::GetAccessibleState(ui::AXViewState* state) { | 289 void DesktopMediaListView::GetAccessibleState(ui::AXViewState* state) { |
| 280 state->role = ui::AX_ROLE_GROUP; | 290 state->role = ui::AX_ROLE_GROUP; |
| 281 state->name = accessible_name_; | 291 state->name = accessible_name_; |
| 282 } | 292 } |
| OLD | NEW |