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 "cc/paint/paint_flags.h" |
10 #include "third_party/skia/include/core/SkPath.h" | 10 #include "third_party/skia/include/core/SkPath.h" |
11 #include "ui/accessibility/ax_action_data.h" | 11 #include "ui/accessibility/ax_action_data.h" |
12 #include "ui/accessibility/ax_node_data.h" | 12 #include "ui/accessibility/ax_node_data.h" |
13 #include "ui/base/default_style.h" | 13 #include "ui/base/default_style.h" |
14 #include "ui/base/material_design/material_design_controller.h" | 14 #include "ui/base/material_design/material_design_controller.h" |
15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
16 #include "ui/events/keycodes/keyboard_codes.h" | 16 #include "ui/events/keycodes/keyboard_codes.h" |
17 #include "ui/gfx/animation/animation_delegate.h" | 17 #include "ui/gfx/animation/animation_delegate.h" |
18 #include "ui/gfx/animation/linear_animation.h" | 18 #include "ui/gfx/animation/linear_animation.h" |
19 #include "ui/gfx/animation/tween.h" | 19 #include "ui/gfx/animation/tween.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 333 |
334 TabStrip::~TabStrip() {} | 334 TabStrip::~TabStrip() {} |
335 | 335 |
336 void TabStrip::OnSelectedTabChanged(Tab* from_tab, Tab* to_tab) {} | 336 void TabStrip::OnSelectedTabChanged(Tab* from_tab, Tab* to_tab) {} |
337 | 337 |
338 const char* TabStrip::GetClassName() const { | 338 const char* TabStrip::GetClassName() const { |
339 return kViewClassName; | 339 return kViewClassName; |
340 } | 340 } |
341 | 341 |
342 void TabStrip::OnPaintBorder(gfx::Canvas* canvas) { | 342 void TabStrip::OnPaintBorder(gfx::Canvas* canvas) { |
343 SkPaint paint; | 343 cc::PaintFlags paint; |
344 paint.setColor(kTabBorderColor); | 344 paint.setColor(kTabBorderColor); |
345 paint.setStrokeWidth(kTabBorderThickness); | 345 paint.setStrokeWidth(kTabBorderThickness); |
346 SkScalar line_y = SkIntToScalar(height()) - (kTabBorderThickness / 2); | 346 SkScalar line_y = SkIntToScalar(height()) - (kTabBorderThickness / 2); |
347 SkScalar line_end = SkIntToScalar(width()); | 347 SkScalar line_end = SkIntToScalar(width()); |
348 int selected_tab_index = GetSelectedTabIndex(); | 348 int selected_tab_index = GetSelectedTabIndex(); |
349 if (selected_tab_index >= 0) { | 349 if (selected_tab_index >= 0) { |
350 Tab* selected_tab = GetTabAtIndex(selected_tab_index); | 350 Tab* selected_tab = GetTabAtIndex(selected_tab_index); |
351 SkPath path; | 351 SkPath path; |
352 SkScalar tab_height = | 352 SkScalar tab_height = |
353 SkIntToScalar(selected_tab->height()) - kTabBorderThickness; | 353 SkIntToScalar(selected_tab->height()) - kTabBorderThickness; |
354 SkScalar tab_width = | 354 SkScalar tab_width = |
355 SkIntToScalar(selected_tab->width()) - kTabBorderThickness; | 355 SkIntToScalar(selected_tab->width()) - kTabBorderThickness; |
356 SkScalar tab_start = SkIntToScalar(selected_tab->GetMirroredX()); | 356 SkScalar tab_start = SkIntToScalar(selected_tab->GetMirroredX()); |
357 path.moveTo(0, line_y); | 357 path.moveTo(0, line_y); |
358 path.rLineTo(tab_start, 0); | 358 path.rLineTo(tab_start, 0); |
359 path.rLineTo(0, -tab_height); | 359 path.rLineTo(0, -tab_height); |
360 path.rLineTo(tab_width, 0); | 360 path.rLineTo(tab_width, 0); |
361 path.rLineTo(0, tab_height); | 361 path.rLineTo(0, tab_height); |
362 path.lineTo(line_end, line_y); | 362 path.lineTo(line_end, line_y); |
363 | 363 |
364 SkPaint paint; | 364 cc::PaintFlags paint; |
365 paint.setStyle(SkPaint::kStroke_Style); | 365 paint.setStyle(cc::PaintFlags::kStroke_Style); |
366 paint.setColor(kTabBorderColor); | 366 paint.setColor(kTabBorderColor); |
367 paint.setStrokeWidth(kTabBorderThickness); | 367 paint.setStrokeWidth(kTabBorderThickness); |
368 canvas->DrawPath(path, paint); | 368 canvas->DrawPath(path, paint); |
369 } else { | 369 } else { |
370 canvas->sk_canvas()->drawLine(0, line_y, line_end, line_y, paint); | 370 canvas->sk_canvas()->drawLine(0, line_y, line_end, line_y, paint); |
371 } | 371 } |
372 } | 372 } |
373 | 373 |
374 Tab* TabStrip::GetTabAtIndex(int index) const { | 374 Tab* TabStrip::GetTabAtIndex(int index) const { |
375 return static_cast<Tab*>(const_cast<View*>(child_at(index))); | 375 return static_cast<Tab*>(const_cast<View*>(child_at(index))); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 | 628 |
629 View* TabbedPane::GetSelectedTabContentView() { | 629 View* TabbedPane::GetSelectedTabContentView() { |
630 return GetSelectedTab() ? GetSelectedTab()->contents() : nullptr; | 630 return GetSelectedTab() ? GetSelectedTab()->contents() : nullptr; |
631 } | 631 } |
632 | 632 |
633 void TabbedPane::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 633 void TabbedPane::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
634 node_data->role = ui::AX_ROLE_TAB_LIST; | 634 node_data->role = ui::AX_ROLE_TAB_LIST; |
635 } | 635 } |
636 | 636 |
637 } // namespace views | 637 } // namespace views |
OLD | NEW |