| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/dragged_tab_controller.h" | 5 #include "chrome/browser/ui/views/tabs/dragged_tab_controller.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 87 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 88 | 88 |
| 89 SkBitmap* high_icon = rb.GetBitmapNamed(IDR_DOCK_HIGH); | 89 SkBitmap* high_icon = rb.GetBitmapNamed(IDR_DOCK_HIGH); |
| 90 SkBitmap* wide_icon = rb.GetBitmapNamed(IDR_DOCK_WIDE); | 90 SkBitmap* wide_icon = rb.GetBitmapNamed(IDR_DOCK_WIDE); |
| 91 | 91 |
| 92 canvas->Save(); | 92 canvas->Save(); |
| 93 bool rtl_ui = base::i18n::IsRTL(); | 93 bool rtl_ui = base::i18n::IsRTL(); |
| 94 if (rtl_ui) { | 94 if (rtl_ui) { |
| 95 // Flip canvas to draw the mirrored tab images for RTL UI. | 95 // Flip canvas to draw the mirrored tab images for RTL UI. |
| 96 canvas->Translate(gfx::Point(width(), 0)); | 96 canvas->Translate(gfx::Point(width(), 0)); |
| 97 canvas->ScaleInt(-1, 1); | 97 canvas->Scale(-1, 1); |
| 98 } | 98 } |
| 99 int x_of_active_tab = width() / 2 + kTabSpacing / 2; | 99 int x_of_active_tab = width() / 2 + kTabSpacing / 2; |
| 100 int x_of_inactive_tab = width() / 2 - high_icon->width() - kTabSpacing / 2; | 100 int x_of_inactive_tab = width() / 2 - high_icon->width() - kTabSpacing / 2; |
| 101 switch (type_) { | 101 switch (type_) { |
| 102 case DockInfo::LEFT_OF_WINDOW: | 102 case DockInfo::LEFT_OF_WINDOW: |
| 103 case DockInfo::LEFT_HALF: | 103 case DockInfo::LEFT_HALF: |
| 104 if (!rtl_ui) | 104 if (!rtl_ui) |
| 105 std::swap(x_of_active_tab, x_of_inactive_tab); | 105 std::swap(x_of_active_tab, x_of_inactive_tab); |
| 106 canvas->DrawBitmapInt(*high_icon, x_of_active_tab, | 106 canvas->DrawBitmapInt(*high_icon, x_of_active_tab, |
| 107 (height() - high_icon->height()) / 2); | 107 (height() - high_icon->height()) / 2); |
| (...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1372 | 1372 |
| 1373 bool DraggedTabController::AreTabsConsecutive() { | 1373 bool DraggedTabController::AreTabsConsecutive() { |
| 1374 for (size_t i = 1; i < drag_data_.size(); ++i) { | 1374 for (size_t i = 1; i < drag_data_.size(); ++i) { |
| 1375 if (drag_data_[i - 1].source_model_index + 1 != | 1375 if (drag_data_[i - 1].source_model_index + 1 != |
| 1376 drag_data_[i].source_model_index) { | 1376 drag_data_[i].source_model_index) { |
| 1377 return false; | 1377 return false; |
| 1378 } | 1378 } |
| 1379 } | 1379 } |
| 1380 return true; | 1380 return true; |
| 1381 } | 1381 } |
| OLD | NEW |