| 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 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 newtab_button_asset_width(), | 1219 newtab_button_asset_width(), |
| 1220 newtab_button_asset_height()); | 1220 newtab_button_asset_height()); |
| 1221 newtab_button_ = new NewTabButton(this, this); | 1221 newtab_button_ = new NewTabButton(this, this); |
| 1222 newtab_button_->SetTooltipText( | 1222 newtab_button_->SetTooltipText( |
| 1223 l10n_util::GetStringUTF16(IDS_TOOLTIP_NEW_TAB)); | 1223 l10n_util::GetStringUTF16(IDS_TOOLTIP_NEW_TAB)); |
| 1224 newtab_button_->SetAccessibleName( | 1224 newtab_button_->SetAccessibleName( |
| 1225 l10n_util::GetStringUTF16(IDS_ACCNAME_NEWTAB)); | 1225 l10n_util::GetStringUTF16(IDS_ACCNAME_NEWTAB)); |
| 1226 AddChildView(newtab_button_); | 1226 AddChildView(newtab_button_); |
| 1227 if (drop_indicator_width == 0) { | 1227 if (drop_indicator_width == 0) { |
| 1228 // Direction doesn't matter, both images are the same size. | 1228 // Direction doesn't matter, both images are the same size. |
| 1229 SkBitmap* drop_image = GetDropArrowImage(true); | 1229 gfx::ImageSkia* drop_image = GetDropArrowImage(true); |
| 1230 drop_indicator_width = drop_image->width(); | 1230 drop_indicator_width = drop_image->width(); |
| 1231 drop_indicator_height = drop_image->height(); | 1231 drop_indicator_height = drop_image->height(); |
| 1232 } | 1232 } |
| 1233 if (TouchModeSupport::IsTouchOptimized() || | 1233 if (TouchModeSupport::IsTouchOptimized() || |
| 1234 CommandLine::ForCurrentProcess()->HasSwitch( | 1234 CommandLine::ForCurrentProcess()->HasSwitch( |
| 1235 switches::kEnableStackedTabStrip)) { | 1235 switches::kEnableStackedTabStrip)) { |
| 1236 touch_layout_.reset(new TouchTabStripLayout( | 1236 touch_layout_.reset(new TouchTabStripLayout( |
| 1237 Tab::GetStandardSize(), | 1237 Tab::GetStandardSize(), |
| 1238 tab_h_offset(), | 1238 tab_h_offset(), |
| 1239 kStackedPadding, | 1239 kStackedPadding, |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 int TabStrip::GetDropEffect(const views::DropTargetEvent& event) { | 1797 int TabStrip::GetDropEffect(const views::DropTargetEvent& event) { |
| 1798 const int source_ops = event.source_operations(); | 1798 const int source_ops = event.source_operations(); |
| 1799 if (source_ops & ui::DragDropTypes::DRAG_COPY) | 1799 if (source_ops & ui::DragDropTypes::DRAG_COPY) |
| 1800 return ui::DragDropTypes::DRAG_COPY; | 1800 return ui::DragDropTypes::DRAG_COPY; |
| 1801 if (source_ops & ui::DragDropTypes::DRAG_LINK) | 1801 if (source_ops & ui::DragDropTypes::DRAG_LINK) |
| 1802 return ui::DragDropTypes::DRAG_LINK; | 1802 return ui::DragDropTypes::DRAG_LINK; |
| 1803 return ui::DragDropTypes::DRAG_MOVE; | 1803 return ui::DragDropTypes::DRAG_MOVE; |
| 1804 } | 1804 } |
| 1805 | 1805 |
| 1806 // static | 1806 // static |
| 1807 SkBitmap* TabStrip::GetDropArrowImage(bool is_down) { | 1807 gfx::ImageSkia* TabStrip::GetDropArrowImage(bool is_down) { |
| 1808 return ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( | 1808 return ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 1809 is_down ? IDR_TAB_DROP_DOWN : IDR_TAB_DROP_UP); | 1809 is_down ? IDR_TAB_DROP_DOWN : IDR_TAB_DROP_UP); |
| 1810 } | 1810 } |
| 1811 | 1811 |
| 1812 // TabStrip::DropInfo ---------------------------------------------------------- | 1812 // TabStrip::DropInfo ---------------------------------------------------------- |
| 1813 | 1813 |
| 1814 TabStrip::DropInfo::DropInfo(int drop_index, bool drop_before, bool point_down) | 1814 TabStrip::DropInfo::DropInfo(int drop_index, bool drop_before, bool point_down) |
| 1815 : drop_index(drop_index), | 1815 : drop_index(drop_index), |
| 1816 drop_before(drop_before), | 1816 drop_before(drop_before), |
| 1817 point_down(point_down) { | 1817 point_down(point_down) { |
| 1818 arrow_view = new views::ImageView; | 1818 arrow_view = new views::ImageView; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2003 } | 2003 } |
| 2004 return NULL; | 2004 return NULL; |
| 2005 } | 2005 } |
| 2006 | 2006 |
| 2007 std::vector<int> TabStrip::GetTabXCoordinates() { | 2007 std::vector<int> TabStrip::GetTabXCoordinates() { |
| 2008 std::vector<int> results; | 2008 std::vector<int> results; |
| 2009 for (int i = 0; i < tab_count(); ++i) | 2009 for (int i = 0; i < tab_count(); ++i) |
| 2010 results.push_back(ideal_bounds(i).x()); | 2010 results.push_back(ideal_bounds(i).x()); |
| 2011 return results; | 2011 return results; |
| 2012 } | 2012 } |
| OLD | NEW |