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 "chrome/browser/ui/views/tabs/tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <iterator> | 10 #include <iterator> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/command_line.h" | |
15 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
16 #include "base/macros.h" | 15 #include "base/macros.h" |
17 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
18 #include "base/metrics/user_metrics.h" | 17 #include "base/metrics/user_metrics.h" |
19 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
20 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
21 #include "build/build_config.h" | 20 #include "build/build_config.h" |
22 #include "cc/paint/paint_flags.h" | 21 #include "cc/paint/paint_flags.h" |
23 #include "chrome/browser/defaults.h" | 22 #include "chrome/browser/defaults.h" |
24 #include "chrome/browser/themes/theme_properties.h" | 23 #include "chrome/browser/themes/theme_properties.h" |
25 #include "chrome/browser/ui/layout_constants.h" | 24 #include "chrome/browser/ui/layout_constants.h" |
26 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 25 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
27 #include "chrome/browser/ui/view_ids.h" | 26 #include "chrome/browser/ui/view_ids.h" |
28 #include "chrome/browser/ui/views/frame/browser_view.h" | 27 #include "chrome/browser/ui/views/frame/browser_view.h" |
29 #include "chrome/browser/ui/views/tabs/stacked_tab_strip_layout.h" | 28 #include "chrome/browser/ui/views/tabs/stacked_tab_strip_layout.h" |
30 #include "chrome/browser/ui/views/tabs/tab.h" | 29 #include "chrome/browser/ui/views/tabs/tab.h" |
31 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h" | 30 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h" |
32 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" | 31 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" |
33 #include "chrome/browser/ui/views/tabs/tab_strip_layout.h" | 32 #include "chrome/browser/ui/views/tabs/tab_strip_layout.h" |
34 #include "chrome/browser/ui/views/tabs/tab_strip_observer.h" | 33 #include "chrome/browser/ui/views/tabs/tab_strip_observer.h" |
35 #include "chrome/browser/ui/views/touch_uma/touch_uma.h" | 34 #include "chrome/browser/ui/views/touch_uma/touch_uma.h" |
36 #include "chrome/common/chrome_switches.h" | |
37 #include "chrome/grit/generated_resources.h" | 35 #include "chrome/grit/generated_resources.h" |
38 #include "chrome/grit/theme_resources.h" | 36 #include "chrome/grit/theme_resources.h" |
39 #include "content/public/common/content_switches.h" | |
40 #include "third_party/skia/include/core/SkColorFilter.h" | 37 #include "third_party/skia/include/core/SkColorFilter.h" |
41 #include "third_party/skia/include/effects/SkBlurMaskFilter.h" | 38 #include "third_party/skia/include/effects/SkBlurMaskFilter.h" |
42 #include "third_party/skia/include/effects/SkLayerDrawLooper.h" | 39 #include "third_party/skia/include/effects/SkLayerDrawLooper.h" |
43 #include "third_party/skia/include/pathops/SkPathOps.h" | 40 #include "third_party/skia/include/pathops/SkPathOps.h" |
44 #include "ui/accessibility/ax_node_data.h" | 41 #include "ui/accessibility/ax_node_data.h" |
45 #include "ui/base/default_theme_provider.h" | 42 #include "ui/base/default_theme_provider.h" |
46 #include "ui/base/dragdrop/drag_drop_types.h" | 43 #include "ui/base/dragdrop/drag_drop_types.h" |
47 #include "ui/base/l10n/l10n_util.h" | 44 #include "ui/base/l10n/l10n_util.h" |
48 #include "ui/base/models/list_selection_model.h" | 45 #include "ui/base/models/list_selection_model.h" |
49 #include "ui/base/resource/resource_bundle.h" | 46 #include "ui/base/resource/resource_bundle.h" |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 if (drop_info_.get() && drop_info_->url == url) | 1047 if (drop_info_.get() && drop_info_->url == url) |
1051 drop_info_->file_supported = supported; | 1048 drop_info_->file_supported = supported; |
1052 } | 1049 } |
1053 | 1050 |
1054 const ui::ListSelectionModel& TabStrip::GetSelectionModel() const { | 1051 const ui::ListSelectionModel& TabStrip::GetSelectionModel() const { |
1055 return controller_->GetSelectionModel(); | 1052 return controller_->GetSelectionModel(); |
1056 } | 1053 } |
1057 | 1054 |
1058 bool TabStrip::SupportsMultipleSelection() { | 1055 bool TabStrip::SupportsMultipleSelection() { |
1059 // TODO: currently only allow single selection in touch layout mode. | 1056 // TODO: currently only allow single selection in touch layout mode. |
1060 return touch_layout_ == NULL; | 1057 return touch_layout_ == nullptr; |
1061 } | 1058 } |
1062 | 1059 |
1063 bool TabStrip::ShouldHideCloseButtonForInactiveTabs() { | 1060 bool TabStrip::ShouldHideCloseButtonForInactiveTabs() { |
1064 if (!touch_layout_) | 1061 return touch_layout_ != nullptr; |
1065 return false; | |
1066 | |
1067 return !base::CommandLine::ForCurrentProcess()->HasSwitch( | |
1068 switches::kDisableHideInactiveStackedTabCloseButtons); | |
1069 } | 1062 } |
1070 | 1063 |
1071 bool TabStrip::MaySetClip() { | 1064 bool TabStrip::MaySetClip() { |
1072 // Only touch layout needs to restrict the clip. | 1065 // Only touch layout needs to restrict the clip. |
1073 return touch_layout_ || IsStackingDraggedTabs(); | 1066 return touch_layout_ || IsStackingDraggedTabs(); |
1074 } | 1067 } |
1075 | 1068 |
1076 void TabStrip::SelectTab(Tab* tab) { | 1069 void TabStrip::SelectTab(Tab* tab) { |
1077 int model_index = GetModelIndexOfTab(tab); | 1070 int model_index = GetModelIndexOfTab(tab); |
1078 if (IsValidModelIndex(model_index)) | 1071 if (IsValidModelIndex(model_index)) |
(...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2788 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); | 2781 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); |
2789 if (view) | 2782 if (view) |
2790 return view; | 2783 return view; |
2791 } | 2784 } |
2792 Tab* tab = FindTabForEvent(point); | 2785 Tab* tab = FindTabForEvent(point); |
2793 if (tab) | 2786 if (tab) |
2794 return ConvertPointToViewAndGetEventHandler(this, tab, point); | 2787 return ConvertPointToViewAndGetEventHandler(this, tab, point); |
2795 } | 2788 } |
2796 return this; | 2789 return this; |
2797 } | 2790 } |
OLD | NEW |