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 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1272 NOTIMPLEMENTED(); | 1272 NOTIMPLEMENTED(); |
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 TabGtk* selected_tab; | |
sky
2012/07/18 04:09:11
selected_tab is only needed in the loop, move it t
Cris Neckar
2012/07/18 19:35:14
Done.
| |
1282 for (size_t i = 0; i < model()->selection_model().size(); i++) { | 1283 for (size_t i = 0; i < model()->selection_model().size(); i++) { |
1283 TabGtk* tab = GetTabAt(model()->selection_model().selected_indices()[i]); | 1284 selected_tab = GetTabAt(model()->selection_model().selected_indices()[i]); |
1284 if (!tab->closing()) | 1285 if (!selected_tab->closing()) |
1285 tabs.push_back(tab); | 1286 tabs.push_back(selected_tab); |
1286 } | 1287 } |
1288 // If the tab is closing it will not have been added to the vector. | |
1289 if (selected_tab->closing()) | |
sky
2012/07/18 04:09:11
This should be remove (it's handled by 1278.
Cris Neckar
2012/07/18 19:35:14
Done.
| |
1290 return; | |
1287 | 1291 |
1288 drag_controller_.reset(new DraggedTabControllerGtk(this, tab, tabs)); | 1292 drag_controller_.reset(new DraggedTabControllerGtk(this, selected_tab, tabs)); |
sky
2012/07/18 04:09:11
This should use tab.
Cris Neckar
2012/07/18 19:35:14
Done.
| |
1289 drag_controller_->CaptureDragInfo(point); | 1293 drag_controller_->CaptureDragInfo(point); |
1290 } | 1294 } |
1291 | 1295 |
1292 void TabStripGtk::ContinueDrag(GdkDragContext* context) { | 1296 void TabStripGtk::ContinueDrag(GdkDragContext* context) { |
1293 // We can get called even if |MaybeStartDrag| wasn't called in the event of | 1297 // 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 | 1298 // 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. | 1299 // _not_ continue the drag because it can lead to weird bugs. |
1296 if (drag_controller_.get()) | 1300 if (drag_controller_.get()) |
1297 drag_controller_->Drag(); | 1301 drag_controller_->Drag(); |
1298 } | 1302 } |
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2265 } | 2269 } |
2266 | 2270 |
2267 void TabStripGtk::SetNewTabButtonBackground() { | 2271 void TabStripGtk::SetNewTabButtonBackground() { |
2268 SkColor color = theme_service_->GetColor( | 2272 SkColor color = theme_service_->GetColor( |
2269 ThemeService::COLOR_BUTTON_BACKGROUND); | 2273 ThemeService::COLOR_BUTTON_BACKGROUND); |
2270 SkBitmap* background = theme_service_->GetBitmapNamed( | 2274 SkBitmap* background = theme_service_->GetBitmapNamed( |
2271 IDR_THEME_WINDOW_CONTROL_BACKGROUND); | 2275 IDR_THEME_WINDOW_CONTROL_BACKGROUND); |
2272 SkBitmap* mask = theme_service_->GetBitmapNamed(IDR_NEWTAB_BUTTON_MASK); | 2276 SkBitmap* mask = theme_service_->GetBitmapNamed(IDR_NEWTAB_BUTTON_MASK); |
2273 newtab_button_->SetBackground(color, background, mask); | 2277 newtab_button_->SetBackground(color, background, mask); |
2274 } | 2278 } |
OLD | NEW |