OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/tabs/tab_strip.h" | 5 #include "chrome/browser/views/tabs/tab_strip.h" |
6 | 6 |
7 #include "base/gfx/size.h" | 7 #include "base/gfx/size.h" |
8 #include "chrome/browser/metrics/user_metrics.h" | 8 #include "chrome/browser/metrics/user_metrics.h" |
9 #include "chrome/browser/profile.h" | 9 #include "chrome/browser/profile.h" |
10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
11 #include "chrome/browser/tabs/tab_strip_model.h" | 11 #include "chrome/browser/tabs/tab_strip_model.h" |
12 #include "chrome/browser/view_ids.h" | 12 #include "chrome/browser/view_ids.h" |
13 #include "chrome/browser/views/tabs/dragged_tab_controller.h" | 13 #include "chrome/browser/views/tabs/dragged_tab_controller.h" |
14 #include "chrome/browser/views/tabs/tab.h" | 14 #include "chrome/browser/views/tabs/tab.h" |
15 #include "chrome/browser/tab_contents/web_contents.h" | 15 #include "chrome/browser/tab_contents/web_contents.h" |
16 #include "chrome/common/drag_drop_types.h" | 16 #include "chrome/common/drag_drop_types.h" |
17 #include "chrome/common/gfx/chrome_canvas.h" | 17 #include "chrome/common/gfx/chrome_canvas.h" |
18 #include "chrome/common/gfx/path.h" | 18 #include "chrome/common/gfx/path.h" |
19 #include "chrome/common/l10n_util.h" | 19 #include "chrome/common/l10n_util.h" |
20 #include "chrome/common/os_exchange_data.h" | 20 #include "chrome/common/os_exchange_data.h" |
21 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
22 #include "chrome/common/resource_bundle.h" | 22 #include "chrome/common/resource_bundle.h" |
23 #include "chrome/common/slide_animation.h" | 23 #include "chrome/common/slide_animation.h" |
24 #include "chrome/common/stl_util-inl.h" | 24 #include "chrome/common/stl_util-inl.h" |
25 #include "chrome/common/win_util.h" | 25 #include "chrome/common/win_util.h" |
26 #include "chrome/views/image_view.h" | 26 #include "chrome/views/image_view.h" |
27 #include "chrome/views/painter.h" | 27 #include "chrome/views/painter.h" |
| 28 #include "chrome/views/window.h" |
28 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
29 #include "grit/theme_resources.h" | 30 #include "grit/theme_resources.h" |
30 | 31 |
31 #undef min | 32 #undef min |
32 #undef max | 33 #undef max |
33 | 34 |
34 using views::DropTargetEvent; | 35 using views::DropTargetEvent; |
35 | 36 |
36 static const int kDefaultAnimationDurationMs = 100; | 37 static const int kDefaultAnimationDurationMs = 100; |
37 static const int kResizeLayoutAnimationDurationMs = 166; | 38 static const int kResizeLayoutAnimationDurationMs = 166; |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 // We must ask the _Tab's_ model, not ourselves, because in some situations | 612 // We must ask the _Tab's_ model, not ourselves, because in some situations |
612 // the model will be different to this object, e.g. when a Tab is being | 613 // the model will be different to this object, e.g. when a Tab is being |
613 // removed after its TabContents has been destroyed. | 614 // removed after its TabContents has been destroyed. |
614 if (!tab->IsSelected()) { | 615 if (!tab->IsSelected()) { |
615 tab->ProcessPaint(canvas); | 616 tab->ProcessPaint(canvas); |
616 } else { | 617 } else { |
617 selected_tab = tab; | 618 selected_tab = tab; |
618 } | 619 } |
619 } | 620 } |
620 | 621 |
621 if (win_util::ShouldUseVistaFrame()) { | 622 if (GetWidget()->AsWindow()->UseNativeFrame()) { |
622 // Make sure unselected tabs are somewhat transparent. | 623 // Make sure unselected tabs are somewhat transparent. |
623 SkPaint paint; | 624 SkPaint paint; |
624 paint.setColor(SkColorSetARGB(200, 255, 255, 255)); | 625 paint.setColor(SkColorSetARGB(200, 255, 255, 255)); |
625 paint.setPorterDuffXfermode(SkPorterDuff::kDstIn_Mode); | 626 paint.setPorterDuffXfermode(SkPorterDuff::kDstIn_Mode); |
626 paint.setStyle(SkPaint::kFill_Style); | 627 paint.setStyle(SkPaint::kFill_Style); |
627 canvas->FillRectInt( | 628 canvas->FillRectInt( |
628 0, 0, width(), | 629 0, 0, width(), |
629 height() - 2, // Visible region that overlaps the toolbar. | 630 height() - 2, // Visible region that overlaps the toolbar. |
630 paint); | 631 paint); |
631 } | 632 } |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 return last_tab->x() + last_tab->width(); | 1528 return last_tab->x() + last_tab->width(); |
1528 } | 1529 } |
1529 | 1530 |
1530 bool TabStrip::IsPointInTab(Tab* tab, | 1531 bool TabStrip::IsPointInTab(Tab* tab, |
1531 const gfx::Point& point_in_tabstrip_coords) { | 1532 const gfx::Point& point_in_tabstrip_coords) { |
1532 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); | 1533 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); |
1533 View::ConvertPointToView(this, tab, &point_in_tab_coords); | 1534 View::ConvertPointToView(this, tab, &point_in_tab_coords); |
1534 return tab->HitTest(point_in_tab_coords); | 1535 return tab->HitTest(point_in_tab_coords); |
1535 } | 1536 } |
1536 | 1537 |
OLD | NEW |