Chromium Code Reviews| 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "third_party/skia/include/core/SkPaint.h" | 9 #include "third_party/skia/include/core/SkPaint.h" |
| 10 #include "third_party/skia/include/core/SkPath.h" | 10 #include "third_party/skia/include/core/SkPath.h" |
| 11 #include "ui/accessibility/ax_view_state.h" | 11 #include "ui/accessibility/ax_view_state.h" |
| 12 #include "ui/base/default_style.h" | 12 #include "ui/base/default_style.h" |
| 13 #include "ui/base/material_design/material_design_controller.h" | |
| 13 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
| 14 #include "ui/events/keycodes/keyboard_codes.h" | 15 #include "ui/events/keycodes/keyboard_codes.h" |
| 15 #include "ui/gfx/canvas.h" | 16 #include "ui/gfx/canvas.h" |
| 16 #include "ui/gfx/font_list.h" | 17 #include "ui/gfx/font_list.h" |
| 18 #include "ui/views/border.h" | |
| 17 #include "ui/views/controls/label.h" | 19 #include "ui/views/controls/label.h" |
| 18 #include "ui/views/controls/tabbed_pane/tabbed_pane_listener.h" | 20 #include "ui/views/controls/tabbed_pane/tabbed_pane_listener.h" |
| 21 #include "ui/views/layout/box_layout.h" | |
| 19 #include "ui/views/layout/layout_manager.h" | 22 #include "ui/views/layout/layout_manager.h" |
| 20 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
| 21 | 24 |
| 22 namespace { | 25 namespace { |
| 23 | 26 |
| 24 // TODO(markusheintz|msw): Use NativeTheme colors. | 27 // TODO(markusheintz|msw): Use NativeTheme colors. |
| 25 const SkColor kTabTitleColor_Inactive = SkColorSetRGB(0x64, 0x64, 0x64); | 28 const SkColor kTabTitleColor_Inactive = SkColorSetRGB(0x64, 0x64, 0x64); |
| 26 const SkColor kTabTitleColor_Active = SK_ColorBLACK; | 29 const SkColor kTabTitleColor_Active = SK_ColorBLACK; |
| 27 const SkColor kTabTitleColor_Hovered = SK_ColorBLACK; | 30 const SkColor kTabTitleColor_Hovered = SK_ColorBLACK; |
| 28 const SkColor kTabBorderColor = SkColorSetRGB(0xC8, 0xC8, 0xC8); | 31 const SkColor kTabBorderColor = SkColorSetRGB(0xC8, 0xC8, 0xC8); |
| 29 const SkScalar kTabBorderThickness = 1.0f; | 32 const SkScalar kTabBorderThickness = 1.0f; |
| 30 | 33 |
| 31 const gfx::Font::Weight kHoverWeight = gfx::Font::Weight::NORMAL; | 34 const gfx::Font::Weight kHoverWeight = gfx::Font::Weight::NORMAL; |
| 32 const gfx::Font::Weight kActiveWeight = gfx::Font::Weight::BOLD; | 35 const gfx::Font::Weight kActiveWeight = gfx::Font::Weight::BOLD; |
| 33 const gfx::Font::Weight kInactiveWeight = gfx::Font::Weight::NORMAL; | 36 const gfx::Font::Weight kInactiveWeight = gfx::Font::Weight::NORMAL; |
| 34 | 37 |
| 38 const int kHarmonyTabStripVerticalPad = 16; | |
| 39 const int kHarmonyTabStripTabHeight = 40; | |
| 40 | |
| 35 } // namespace | 41 } // namespace |
| 36 | 42 |
| 37 namespace views { | 43 namespace views { |
| 38 | 44 |
| 39 // static | 45 // static |
| 40 const char TabbedPane::kViewClassName[] = "TabbedPane"; | 46 const char TabbedPane::kViewClassName[] = "TabbedPane"; |
| 41 | 47 |
| 42 // The tab view shown in the tab strip. | 48 // The tab view shown in the tab strip. |
| 43 class Tab : public View { | 49 class Tab : public View { |
| 44 public: | 50 public: |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 55 | 61 |
| 56 // Overridden from View: | 62 // Overridden from View: |
| 57 bool OnMousePressed(const ui::MouseEvent& event) override; | 63 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 58 void OnMouseEntered(const ui::MouseEvent& event) override; | 64 void OnMouseEntered(const ui::MouseEvent& event) override; |
| 59 void OnMouseExited(const ui::MouseEvent& event) override; | 65 void OnMouseExited(const ui::MouseEvent& event) override; |
| 60 void OnGestureEvent(ui::GestureEvent* event) override; | 66 void OnGestureEvent(ui::GestureEvent* event) override; |
| 61 gfx::Size GetPreferredSize() const override; | 67 gfx::Size GetPreferredSize() const override; |
| 62 void Layout() override; | 68 void Layout() override; |
| 63 const char* GetClassName() const override; | 69 const char* GetClassName() const override; |
| 64 | 70 |
| 71 protected: | |
| 72 Label* title() { return title_; } | |
| 73 | |
| 74 // Called whenever |tab_state_| changes. | |
| 75 virtual void OnStateChanged(); | |
| 76 | |
| 65 private: | 77 private: |
| 66 enum TabState { | 78 enum TabState { |
| 67 TAB_INACTIVE, | 79 TAB_INACTIVE, |
| 68 TAB_ACTIVE, | 80 TAB_ACTIVE, |
| 69 TAB_HOVERED, | 81 TAB_HOVERED, |
| 70 }; | 82 }; |
| 71 | 83 |
| 72 void SetState(TabState tab_state); | 84 void SetState(TabState tab_state); |
| 73 | 85 |
| 74 TabbedPane* tabbed_pane_; | 86 TabbedPane* tabbed_pane_; |
| 75 Label* title_; | 87 Label* title_; |
| 76 gfx::Size preferred_title_size_; | 88 gfx::Size preferred_title_size_; |
| 77 TabState tab_state_; | 89 TabState tab_state_; |
| 78 // The content view associated with this tab. | 90 // The content view associated with this tab. |
| 79 View* contents_; | 91 View* contents_; |
| 80 | 92 |
| 81 DISALLOW_COPY_AND_ASSIGN(Tab); | 93 DISALLOW_COPY_AND_ASSIGN(Tab); |
| 82 }; | 94 }; |
| 83 | 95 |
| 96 // A subclass of Tab that implements the Harmony visual styling. | |
| 97 class MdTab : public Tab { | |
| 98 public: | |
| 99 MdTab(TabbedPane* tabbed_pane, const base::string16& title, View* contents); | |
| 100 ~MdTab() override; | |
| 101 | |
| 102 // Overridden from Tab: | |
| 103 void OnStateChanged() override; | |
| 104 | |
| 105 private: | |
| 106 DISALLOW_COPY_AND_ASSIGN(MdTab); | |
| 107 }; | |
| 108 | |
| 84 // The tab strip shown above the tab contents. | 109 // The tab strip shown above the tab contents. |
| 85 class TabStrip : public View { | 110 class TabStrip : public View { |
| 86 public: | 111 public: |
| 87 // Internal class name. | 112 // Internal class name. |
| 88 static const char kViewClassName[]; | 113 static const char kViewClassName[]; |
| 89 | 114 |
| 90 explicit TabStrip(TabbedPane* tabbed_pane); | 115 explicit TabStrip(TabbedPane* tabbed_pane); |
| 91 ~TabStrip() override; | 116 ~TabStrip() override; |
| 92 | 117 |
| 93 // Overridden from View: | 118 // Overridden from View: |
| 94 gfx::Size GetPreferredSize() const override; | 119 gfx::Size GetPreferredSize() const override; |
| 95 void Layout() override; | 120 void Layout() override; |
| 96 const char* GetClassName() const override; | 121 const char* GetClassName() const override; |
| 97 void OnPaint(gfx::Canvas* canvas) override; | 122 void OnPaint(gfx::Canvas* canvas) override; |
| 98 | 123 |
| 99 private: | 124 private: |
| 100 TabbedPane* tabbed_pane_; | 125 TabbedPane* tabbed_pane_; |
| 101 | 126 |
| 102 DISALLOW_COPY_AND_ASSIGN(TabStrip); | 127 DISALLOW_COPY_AND_ASSIGN(TabStrip); |
| 103 }; | 128 }; |
| 104 | 129 |
| 130 // A subclass of TabStrip that implements the Harmony visual styling. This | |
| 131 // class uses a BoxLayout to position tabs. | |
| 132 class MdTabStrip : public TabStrip { | |
| 133 public: | |
| 134 explicit MdTabStrip(TabbedPane* tabbed_pane); | |
| 135 ~MdTabStrip() override; | |
| 136 | |
| 137 // Overridden from View: | |
| 138 gfx::Size GetPreferredSize() const override; | |
| 139 void Layout() override; | |
| 140 void OnPaint(gfx::Canvas* canvas) override; | |
| 141 | |
| 142 private: | |
| 143 DISALLOW_COPY_AND_ASSIGN(MdTabStrip); | |
| 144 }; | |
| 145 | |
| 105 // static | 146 // static |
| 106 const char Tab::kViewClassName[] = "Tab"; | 147 const char Tab::kViewClassName[] = "Tab"; |
| 107 | 148 |
| 108 Tab::Tab(TabbedPane* tabbed_pane, const base::string16& title, View* contents) | 149 Tab::Tab(TabbedPane* tabbed_pane, const base::string16& title, View* contents) |
| 109 : tabbed_pane_(tabbed_pane), | 150 : tabbed_pane_(tabbed_pane), |
| 110 title_(new Label( | 151 title_(new Label( |
| 111 title, | 152 title, |
| 112 ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta( | 153 ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta( |
| 113 ui::kLabelFontSizeDelta, | 154 ui::kLabelFontSizeDelta, |
| 114 gfx::Font::NORMAL, | 155 gfx::Font::NORMAL, |
| 115 kActiveWeight))), | 156 kActiveWeight))), |
| 116 tab_state_(TAB_ACTIVE), | 157 tab_state_(TAB_ACTIVE), |
| 117 contents_(contents) { | 158 contents_(contents) { |
| 118 // Calculate this now while the font list is guaranteed to be bold. | 159 // Calculate this now while the font list is guaranteed to be bold. |
| 119 preferred_title_size_ = title_->GetPreferredSize(); | 160 preferred_title_size_ = title_->GetPreferredSize(); |
| 120 | 161 |
| 121 SetState(TAB_INACTIVE); | 162 SetState(TAB_INACTIVE); |
| 122 AddChildView(title_); | 163 AddChildView(title_); |
| 123 } | 164 } |
| 124 | 165 |
| 125 Tab::~Tab() {} | 166 Tab::~Tab() {} |
| 126 | 167 |
| 127 void Tab::SetSelected(bool selected) { | 168 void Tab::SetSelected(bool selected) { |
| 128 contents_->SetVisible(selected); | 169 contents_->SetVisible(selected); |
| 129 SetState(selected ? TAB_ACTIVE : TAB_INACTIVE); | 170 SetState(selected ? TAB_ACTIVE : TAB_INACTIVE); |
| 130 } | 171 } |
| 131 | 172 |
| 173 void Tab::OnStateChanged() { | |
| 174 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | |
| 175 switch (tab_state_) { | |
| 176 case TAB_INACTIVE: | |
| 177 title_->SetEnabledColor(kTabTitleColor_Inactive); | |
| 178 title_->SetFontList(rb.GetFontListWithDelta( | |
| 179 ui::kLabelFontSizeDelta, gfx::Font::NORMAL, kInactiveWeight)); | |
| 180 break; | |
| 181 case TAB_ACTIVE: | |
| 182 title_->SetEnabledColor(kTabTitleColor_Active); | |
| 183 title_->SetFontList(rb.GetFontListWithDelta( | |
| 184 ui::kLabelFontSizeDelta, gfx::Font::NORMAL, kActiveWeight)); | |
| 185 break; | |
| 186 case TAB_HOVERED: | |
| 187 title_->SetEnabledColor(kTabTitleColor_Hovered); | |
| 188 title_->SetFontList(rb.GetFontListWithDelta( | |
| 189 ui::kLabelFontSizeDelta, gfx::Font::NORMAL, kHoverWeight)); | |
| 190 break; | |
| 191 } | |
| 192 } | |
| 193 | |
| 132 bool Tab::OnMousePressed(const ui::MouseEvent& event) { | 194 bool Tab::OnMousePressed(const ui::MouseEvent& event) { |
| 133 if (event.IsOnlyLeftMouseButton() && | 195 if (event.IsOnlyLeftMouseButton() && |
| 134 GetLocalBounds().Contains(event.location())) | 196 GetLocalBounds().Contains(event.location())) |
| 135 tabbed_pane_->SelectTab(this); | 197 tabbed_pane_->SelectTab(this); |
| 136 return true; | 198 return true; |
| 137 } | 199 } |
| 138 | 200 |
| 139 void Tab::OnMouseEntered(const ui::MouseEvent& event) { | 201 void Tab::OnMouseEntered(const ui::MouseEvent& event) { |
| 140 SetState(selected() ? TAB_ACTIVE : TAB_HOVERED); | 202 SetState(selected() ? TAB_ACTIVE : TAB_HOVERED); |
| 141 } | 203 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 } | 240 } |
| 179 | 241 |
| 180 const char* Tab::GetClassName() const { | 242 const char* Tab::GetClassName() const { |
| 181 return kViewClassName; | 243 return kViewClassName; |
| 182 } | 244 } |
| 183 | 245 |
| 184 void Tab::SetState(TabState tab_state) { | 246 void Tab::SetState(TabState tab_state) { |
| 185 if (tab_state == tab_state_) | 247 if (tab_state == tab_state_) |
| 186 return; | 248 return; |
| 187 tab_state_ = tab_state; | 249 tab_state_ = tab_state; |
| 188 | 250 OnStateChanged(); |
| 189 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | |
| 190 switch (tab_state) { | |
| 191 case TAB_INACTIVE: | |
| 192 title_->SetEnabledColor(kTabTitleColor_Inactive); | |
| 193 title_->SetFontList(rb.GetFontListWithDelta( | |
| 194 ui::kLabelFontSizeDelta, gfx::Font::NORMAL, kInactiveWeight)); | |
| 195 break; | |
| 196 case TAB_ACTIVE: | |
| 197 title_->SetEnabledColor(kTabTitleColor_Active); | |
| 198 title_->SetFontList(rb.GetFontListWithDelta( | |
| 199 ui::kLabelFontSizeDelta, gfx::Font::NORMAL, kActiveWeight)); | |
| 200 break; | |
| 201 case TAB_HOVERED: | |
| 202 title_->SetEnabledColor(kTabTitleColor_Hovered); | |
| 203 title_->SetFontList(rb.GetFontListWithDelta( | |
| 204 ui::kLabelFontSizeDelta, gfx::Font::NORMAL, kHoverWeight)); | |
| 205 break; | |
| 206 } | |
| 207 SchedulePaint(); | 251 SchedulePaint(); |
| 208 } | 252 } |
| 209 | 253 |
| 254 MdTab::MdTab(TabbedPane* tabbed_pane, | |
| 255 const base::string16& title, | |
| 256 View* contents) | |
| 257 : Tab(tabbed_pane, title, contents) { | |
| 258 OnStateChanged(); | |
| 259 } | |
| 260 | |
| 261 MdTab::~MdTab() {} | |
| 262 | |
| 263 void MdTab::OnStateChanged() { | |
| 264 // These values are directly from the Harmony specs for tabbed panes. | |
| 265 const SkColor kSelectedBorderColor = SkColorSetRGB(0x42, 0x85, 0xF4); | |
|
Evan Stade
2016/09/01 20:46:07
Hi Elly, a couple ex post facto comments. Instead
Evan Stade
2016/09/01 22:02:30
I'm thinking the border should use kColorId_Focuse
| |
| 266 const SkColor kNormalBorderColor = SkColorSetARGB(0x23, 0x00, 0x00, 0x00); | |
| 267 const SkColor kSelectedFontColor = SkColorSetRGB(0x42, 0x85, 0xF4); | |
| 268 const SkColor kNormalFontColor = SkColorSetRGB(0x5A, 0x5A, 0x5A); | |
| 269 | |
| 270 SkColor border_color = selected() ? kSelectedBorderColor : kNormalBorderColor; | |
| 271 int border_thickness = selected() ? 2 : 1; | |
|
Evan Stade
2016/09/01 20:46:07
are you sure these values are right? This results
| |
| 272 SetBorder( | |
| 273 Border::CreateSolidSidedBorder(0, 0, border_thickness, 0, border_color)); | |
| 274 | |
| 275 SkColor font_color = selected() ? kSelectedFontColor : kNormalFontColor; | |
| 276 title()->SetEnabledColor(font_color); | |
| 277 | |
| 278 gfx::Font::Weight font_weight = gfx::Font::Weight::NORMAL; | |
| 279 #if defined(OS_WIN) | |
| 280 if (selected()) | |
| 281 font_weight = gfx::Font::Weight::BOLD; | |
|
Evan Stade
2016/09/01 20:46:06
should this not just be MEDIUM on all platforms?
| |
| 282 #endif | |
| 283 | |
| 284 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | |
| 285 title()->SetFontList(rb.GetFontListWithDelta(ui::kLabelFontSizeDelta, | |
| 286 gfx::Font::NORMAL, font_weight)); | |
| 287 } | |
| 288 | |
| 210 // static | 289 // static |
| 211 const char TabStrip::kViewClassName[] = "TabStrip"; | 290 const char TabStrip::kViewClassName[] = "TabStrip"; |
| 212 | 291 |
| 213 TabStrip::TabStrip(TabbedPane* tabbed_pane) : tabbed_pane_(tabbed_pane) {} | 292 TabStrip::TabStrip(TabbedPane* tabbed_pane) : tabbed_pane_(tabbed_pane) {} |
| 214 | 293 |
| 215 TabStrip::~TabStrip() {} | 294 TabStrip::~TabStrip() {} |
| 216 | 295 |
| 217 gfx::Size TabStrip::GetPreferredSize() const { | 296 gfx::Size TabStrip::GetPreferredSize() const { |
| 218 gfx::Size size; | 297 gfx::Size size; |
| 219 for (int i = 0; i < child_count(); ++i) { | 298 for (int i = 0; i < child_count(); ++i) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 266 SkPaint paint; | 345 SkPaint paint; |
| 267 paint.setStyle(SkPaint::kStroke_Style); | 346 paint.setStyle(SkPaint::kStroke_Style); |
| 268 paint.setColor(kTabBorderColor); | 347 paint.setColor(kTabBorderColor); |
| 269 paint.setStrokeWidth(kTabBorderThickness); | 348 paint.setStrokeWidth(kTabBorderThickness); |
| 270 canvas->DrawPath(path, paint); | 349 canvas->DrawPath(path, paint); |
| 271 } else { | 350 } else { |
| 272 canvas->sk_canvas()->drawLine(0, line_y, line_end, line_y, paint); | 351 canvas->sk_canvas()->drawLine(0, line_y, line_end, line_y, paint); |
| 273 } | 352 } |
| 274 } | 353 } |
| 275 | 354 |
| 355 MdTabStrip::MdTabStrip(TabbedPane* tabbed_pane) : TabStrip(tabbed_pane) { | |
| 356 BoxLayout* layout = | |
| 357 new BoxLayout(BoxLayout::kHorizontal, 0, kHarmonyTabStripVerticalPad, 0); | |
| 358 layout->set_main_axis_alignment(BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); | |
| 359 layout->set_cross_axis_alignment(BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH); | |
| 360 layout->SetDefaultFlex(1); | |
| 361 SetLayoutManager(layout); | |
| 362 } | |
| 363 | |
| 364 MdTabStrip::~MdTabStrip() {} | |
| 365 | |
| 366 gfx::Size MdTabStrip::GetPreferredSize() const { | |
| 367 return gfx::Size(width(), | |
| 368 kHarmonyTabStripVerticalPad * 2 + kHarmonyTabStripTabHeight); | |
| 369 } | |
| 370 | |
| 371 // Let this class's LayoutManager handle the layout. | |
| 372 void MdTabStrip::Layout() { | |
| 373 return View::Layout(); | |
| 374 } | |
| 375 | |
| 376 // The tab strip "border" is drawn as part of the tabs, so all this method needs | |
| 377 // to do is paint the background. | |
| 378 void MdTabStrip::OnPaint(gfx::Canvas* canvas) { | |
| 379 OnPaintBackground(canvas); | |
| 380 } | |
| 381 | |
| 276 TabbedPane::TabbedPane() | 382 TabbedPane::TabbedPane() |
| 277 : listener_(NULL), | 383 : listener_(NULL), |
| 278 tab_strip_(new TabStrip(this)), | 384 tab_strip_(ui::MaterialDesignController::IsSecondaryUiMaterial() |
| 279 contents_(new View()), | 385 ? new MdTabStrip(this) |
| 280 selected_tab_index_(-1) { | 386 : new TabStrip(this)), |
| 387 contents_(new View()), | |
| 388 selected_tab_index_(-1) { | |
| 281 #if defined(OS_MACOSX) | 389 #if defined(OS_MACOSX) |
| 282 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); | 390 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); |
| 283 #else | 391 #else |
| 284 SetFocusBehavior(FocusBehavior::ALWAYS); | 392 SetFocusBehavior(FocusBehavior::ALWAYS); |
| 285 #endif | 393 #endif |
| 286 | 394 |
| 287 AddChildView(tab_strip_); | 395 AddChildView(tab_strip_); |
| 288 AddChildView(contents_); | 396 AddChildView(contents_); |
| 289 } | 397 } |
| 290 | 398 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 303 void TabbedPane::AddTab(const base::string16& title, View* contents) { | 411 void TabbedPane::AddTab(const base::string16& title, View* contents) { |
| 304 AddTabAtIndex(tab_strip_->child_count(), title, contents); | 412 AddTabAtIndex(tab_strip_->child_count(), title, contents); |
| 305 } | 413 } |
| 306 | 414 |
| 307 void TabbedPane::AddTabAtIndex(int index, | 415 void TabbedPane::AddTabAtIndex(int index, |
| 308 const base::string16& title, | 416 const base::string16& title, |
| 309 View* contents) { | 417 View* contents) { |
| 310 DCHECK(index >= 0 && index <= GetTabCount()); | 418 DCHECK(index >= 0 && index <= GetTabCount()); |
| 311 contents->SetVisible(false); | 419 contents->SetVisible(false); |
| 312 | 420 |
| 313 tab_strip_->AddChildViewAt(new Tab(this, title, contents), index); | 421 tab_strip_->AddChildViewAt( |
| 422 ui::MaterialDesignController::IsSecondaryUiMaterial() | |
| 423 ? new MdTab(this, title, contents) | |
| 424 : new Tab(this, title, contents), | |
| 425 index); | |
| 314 contents_->AddChildViewAt(contents, index); | 426 contents_->AddChildViewAt(contents, index); |
| 315 if (selected_tab_index() < 0) | 427 if (selected_tab_index() < 0) |
| 316 SelectTabAt(index); | 428 SelectTabAt(index); |
| 317 | 429 |
| 318 PreferredSizeChanged(); | 430 PreferredSizeChanged(); |
| 319 } | 431 } |
| 320 | 432 |
| 321 void TabbedPane::SelectTabAt(int index) { | 433 void TabbedPane::SelectTabAt(int index) { |
| 322 DCHECK(index >= 0 && index < GetTabCount()); | 434 DCHECK(index >= 0 && index < GetTabCount()); |
| 323 if (index == selected_tab_index()) | 435 if (index == selected_tab_index()) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 407 selected_tab->NotifyAccessibilityEvent( | 519 selected_tab->NotifyAccessibilityEvent( |
| 408 ui::AX_EVENT_FOCUS, true); | 520 ui::AX_EVENT_FOCUS, true); |
| 409 } | 521 } |
| 410 } | 522 } |
| 411 | 523 |
| 412 void TabbedPane::GetAccessibleState(ui::AXViewState* state) { | 524 void TabbedPane::GetAccessibleState(ui::AXViewState* state) { |
| 413 state->role = ui::AX_ROLE_TAB_LIST; | 525 state->role = ui::AX_ROLE_TAB_LIST; |
| 414 } | 526 } |
| 415 | 527 |
| 416 } // namespace views | 528 } // namespace views |
| OLD | NEW |