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/gtk/tabs/tab_strip_gtk.h" | 5 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 } | 1273 } |
1274 | 1274 |
1275 void TabStripGtk::MaybeStartDrag(TabGtk* tab, const gfx::Point& point) { | 1275 void TabStripGtk::MaybeStartDrag(TabGtk* tab, const gfx::Point& point) { |
1276 // Don't accidentally start any drag operations during animations if the | 1276 // Don't accidentally start any drag operations during animations if the |
1277 // mouse is down. | 1277 // mouse is down. |
1278 if (IsAnimating() || tab->closing() || !HasAvailableDragActions()) | 1278 if (IsAnimating() || tab->closing() || !HasAvailableDragActions()) |
1279 return; | 1279 return; |
1280 | 1280 |
1281 std::vector<TabGtk*> tabs; | 1281 std::vector<TabGtk*> tabs; |
1282 for (size_t i = 0; i < model()->selection_model().size(); i++) { | 1282 for (size_t i = 0; i < model()->selection_model().size(); i++) { |
1283 TabGtk* tab = GetTabAt(model()->selection_model().selected_indices()[i]); | 1283 TabGtk* selected_tab = |
1284 if (!tab->closing()) | 1284 GetTabAtAdjustForAnimation( |
1285 tabs.push_back(tab); | 1285 model()->selection_model().selected_indices()[i]); |
| 1286 if (!selected_tab->closing()) |
| 1287 tabs.push_back(selected_tab); |
1286 } | 1288 } |
1287 | 1289 |
1288 drag_controller_.reset(new DraggedTabControllerGtk(this, tab, tabs)); | 1290 drag_controller_.reset(new DraggedTabControllerGtk(this, tab, tabs)); |
1289 drag_controller_->CaptureDragInfo(point); | 1291 drag_controller_->CaptureDragInfo(point); |
1290 } | 1292 } |
1291 | 1293 |
1292 void TabStripGtk::ContinueDrag(GdkDragContext* context) { | 1294 void TabStripGtk::ContinueDrag(GdkDragContext* context) { |
1293 // We can get called even if |MaybeStartDrag| wasn't called in the event of | 1295 // We can get called even if |MaybeStartDrag| wasn't called in the event of |
1294 // a TabStrip animation when the mouse button is down. In this case we should | 1296 // a TabStrip animation when the mouse button is down. In this case we should |
1295 // _not_ continue the drag because it can lead to weird bugs. | 1297 // _not_ continue the drag because it can lead to weird bugs. |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2265 } | 2267 } |
2266 | 2268 |
2267 void TabStripGtk::SetNewTabButtonBackground() { | 2269 void TabStripGtk::SetNewTabButtonBackground() { |
2268 SkColor color = theme_service_->GetColor( | 2270 SkColor color = theme_service_->GetColor( |
2269 ThemeService::COLOR_BUTTON_BACKGROUND); | 2271 ThemeService::COLOR_BUTTON_BACKGROUND); |
2270 SkBitmap* background = theme_service_->GetBitmapNamed( | 2272 SkBitmap* background = theme_service_->GetBitmapNamed( |
2271 IDR_THEME_WINDOW_CONTROL_BACKGROUND); | 2273 IDR_THEME_WINDOW_CONTROL_BACKGROUND); |
2272 SkBitmap* mask = theme_service_->GetBitmapNamed(IDR_NEWTAB_BUTTON_MASK); | 2274 SkBitmap* mask = theme_service_->GetBitmapNamed(IDR_NEWTAB_BUTTON_MASK); |
2273 newtab_button_->SetBackground(color, background, mask); | 2275 newtab_button_->SetBackground(color, background, mask); |
2274 } | 2276 } |
OLD | NEW |