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/controls/tabbed_pane/tabbed_pane.h" | 5 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/base/accessibility/accessible_view_state.h" | 8 #include "ui/base/accessibility/accessible_view_state.h" |
9 #include "ui/base/keycodes/keyboard_codes.h" | 9 #include "ui/base/keycodes/keyboard_codes.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 301 |
302 void TabbedPane::SelectTab(Tab* tab) { | 302 void TabbedPane::SelectTab(Tab* tab) { |
303 const int index = tab_strip_->GetIndexOf(tab); | 303 const int index = tab_strip_->GetIndexOf(tab); |
304 if (index >= 0) | 304 if (index >= 0) |
305 SelectTabAt(index); | 305 SelectTabAt(index); |
306 } | 306 } |
307 | 307 |
308 gfx::Size TabbedPane::GetPreferredSize() { | 308 gfx::Size TabbedPane::GetPreferredSize() { |
309 gfx::Size size; | 309 gfx::Size size; |
310 for (int i = 0; i < contents_->child_count(); ++i) | 310 for (int i = 0; i < contents_->child_count(); ++i) |
311 size.ClampToMin(contents_->child_at(i)->GetPreferredSize()); | 311 size.SetToMax(contents_->child_at(i)->GetPreferredSize()); |
312 size.Enlarge(0, tab_strip_->GetPreferredSize().height()); | 312 size.Enlarge(0, tab_strip_->GetPreferredSize().height()); |
313 return size; | 313 return size; |
314 } | 314 } |
315 | 315 |
316 Tab* TabbedPane::GetTabAt(int index) { | 316 Tab* TabbedPane::GetTabAt(int index) { |
317 return static_cast<Tab*>(tab_strip_->child_at(index)); | 317 return static_cast<Tab*>(tab_strip_->child_at(index)); |
318 } | 318 } |
319 | 319 |
320 void TabbedPane::Layout() { | 320 void TabbedPane::Layout() { |
321 const gfx::Size size = tab_strip_->GetPreferredSize(); | 321 const gfx::Size size = tab_strip_->GetPreferredSize(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 selected_tab->NotifyAccessibilityEvent( | 363 selected_tab->NotifyAccessibilityEvent( |
364 ui::AccessibilityTypes::EVENT_FOCUS, true); | 364 ui::AccessibilityTypes::EVENT_FOCUS, true); |
365 } | 365 } |
366 } | 366 } |
367 | 367 |
368 void TabbedPane::GetAccessibleState(ui::AccessibleViewState* state) { | 368 void TabbedPane::GetAccessibleState(ui::AccessibleViewState* state) { |
369 state->role = ui::AccessibilityTypes::ROLE_PAGETABLIST; | 369 state->role = ui::AccessibilityTypes::ROLE_PAGETABLIST; |
370 } | 370 } |
371 | 371 |
372 } // namespace views | 372 } // namespace views |
OLD | NEW |