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 <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 newtab_button_asset_width(), | 1232 newtab_button_asset_width(), |
1233 newtab_button_asset_height()); | 1233 newtab_button_asset_height()); |
1234 newtab_button_ = new NewTabButton(this, this); | 1234 newtab_button_ = new NewTabButton(this, this); |
1235 newtab_button_->SetTooltipText( | 1235 newtab_button_->SetTooltipText( |
1236 l10n_util::GetStringUTF16(IDS_TOOLTIP_NEW_TAB)); | 1236 l10n_util::GetStringUTF16(IDS_TOOLTIP_NEW_TAB)); |
1237 newtab_button_->SetAccessibleName( | 1237 newtab_button_->SetAccessibleName( |
1238 l10n_util::GetStringUTF16(IDS_ACCNAME_NEWTAB)); | 1238 l10n_util::GetStringUTF16(IDS_ACCNAME_NEWTAB)); |
1239 AddChildView(newtab_button_); | 1239 AddChildView(newtab_button_); |
1240 if (drop_indicator_width == 0) { | 1240 if (drop_indicator_width == 0) { |
1241 // Direction doesn't matter, both images are the same size. | 1241 // Direction doesn't matter, both images are the same size. |
1242 SkBitmap* drop_image = GetDropArrowImage(true); | 1242 gfx::ImageSkia* drop_image = GetDropArrowImage(true); |
1243 drop_indicator_width = drop_image->width(); | 1243 drop_indicator_width = drop_image->width(); |
1244 drop_indicator_height = drop_image->height(); | 1244 drop_indicator_height = drop_image->height(); |
1245 } | 1245 } |
1246 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH || | 1246 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH || |
1247 CommandLine::ForCurrentProcess()->HasSwitch( | 1247 CommandLine::ForCurrentProcess()->HasSwitch( |
1248 switches::kEnableStackedTabStrip)) { | 1248 switches::kEnableStackedTabStrip)) { |
1249 touch_layout_.reset(new TouchTabStripLayout( | 1249 touch_layout_.reset(new TouchTabStripLayout( |
1250 Tab::GetStandardSize(), | 1250 Tab::GetStandardSize(), |
1251 tab_h_offset(), | 1251 tab_h_offset(), |
1252 kStackedPadding, | 1252 kStackedPadding, |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1810 int TabStrip::GetDropEffect(const views::DropTargetEvent& event) { | 1810 int TabStrip::GetDropEffect(const views::DropTargetEvent& event) { |
1811 const int source_ops = event.source_operations(); | 1811 const int source_ops = event.source_operations(); |
1812 if (source_ops & ui::DragDropTypes::DRAG_COPY) | 1812 if (source_ops & ui::DragDropTypes::DRAG_COPY) |
1813 return ui::DragDropTypes::DRAG_COPY; | 1813 return ui::DragDropTypes::DRAG_COPY; |
1814 if (source_ops & ui::DragDropTypes::DRAG_LINK) | 1814 if (source_ops & ui::DragDropTypes::DRAG_LINK) |
1815 return ui::DragDropTypes::DRAG_LINK; | 1815 return ui::DragDropTypes::DRAG_LINK; |
1816 return ui::DragDropTypes::DRAG_MOVE; | 1816 return ui::DragDropTypes::DRAG_MOVE; |
1817 } | 1817 } |
1818 | 1818 |
1819 // static | 1819 // static |
1820 SkBitmap* TabStrip::GetDropArrowImage(bool is_down) { | 1820 gfx::ImageSkia* TabStrip::GetDropArrowImage(bool is_down) { |
1821 return ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( | 1821 return ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
1822 is_down ? IDR_TAB_DROP_DOWN : IDR_TAB_DROP_UP); | 1822 is_down ? IDR_TAB_DROP_DOWN : IDR_TAB_DROP_UP); |
1823 } | 1823 } |
1824 | 1824 |
1825 // TabStrip::DropInfo ---------------------------------------------------------- | 1825 // TabStrip::DropInfo ---------------------------------------------------------- |
1826 | 1826 |
1827 TabStrip::DropInfo::DropInfo(int drop_index, bool drop_before, bool point_down) | 1827 TabStrip::DropInfo::DropInfo(int drop_index, bool drop_before, bool point_down) |
1828 : drop_index(drop_index), | 1828 : drop_index(drop_index), |
1829 drop_before(drop_before), | 1829 drop_before(drop_before), |
1830 point_down(point_down) { | 1830 point_down(point_down) { |
1831 arrow_view = new views::ImageView; | 1831 arrow_view = new views::ImageView; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2016 } | 2016 } |
2017 return NULL; | 2017 return NULL; |
2018 } | 2018 } |
2019 | 2019 |
2020 std::vector<int> TabStrip::GetTabXCoordinates() { | 2020 std::vector<int> TabStrip::GetTabXCoordinates() { |
2021 std::vector<int> results; | 2021 std::vector<int> results; |
2022 for (int i = 0; i < tab_count(); ++i) | 2022 for (int i = 0; i < tab_count(); ++i) |
2023 results.push_back(ideal_bounds(i).x()); | 2023 results.push_back(ideal_bounds(i).x()); |
2024 return results; | 2024 return results; |
2025 } | 2025 } |
OLD | NEW |