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/default_tab_drag_controller.h" | 5 #include "chrome/browser/ui/views/tabs/default_tab_drag_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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 : source_tabstrip_(NULL), | 313 : source_tabstrip_(NULL), |
314 attached_tabstrip_(NULL), | 314 attached_tabstrip_(NULL), |
315 source_tab_offset_(0), | 315 source_tab_offset_(0), |
316 offset_to_width_ratio_(0), | 316 offset_to_width_ratio_(0), |
317 old_focused_view_(NULL), | 317 old_focused_view_(NULL), |
318 last_move_screen_loc_(0), | 318 last_move_screen_loc_(0), |
319 started_drag_(false), | 319 started_drag_(false), |
320 active_(true), | 320 active_(true), |
321 source_tab_index_(std::numeric_limits<size_t>::max()), | 321 source_tab_index_(std::numeric_limits<size_t>::max()), |
322 initial_move_(true), | 322 initial_move_(true), |
| 323 // TODO: remove. |
323 stacking_(false) { | 324 stacking_(false) { |
324 instance_ = this; | 325 instance_ = this; |
325 } | 326 } |
326 | 327 |
327 DefaultTabDragController::~DefaultTabDragController() { | 328 DefaultTabDragController::~DefaultTabDragController() { |
328 if (instance_ == this) | 329 if (instance_ == this) |
329 instance_ = NULL; | 330 instance_ = NULL; |
330 | 331 |
331 MessageLoopForUI::current()->RemoveObserver(this); | 332 MessageLoopForUI::current()->RemoveObserver(this); |
332 | 333 |
(...skipping 14 matching lines...) Expand all Loading... |
347 const std::vector<BaseTab*>& tabs, | 348 const std::vector<BaseTab*>& tabs, |
348 const gfx::Point& mouse_offset, | 349 const gfx::Point& mouse_offset, |
349 int source_tab_offset, | 350 int source_tab_offset, |
350 const TabStripSelectionModel& initial_selection_model) { | 351 const TabStripSelectionModel& initial_selection_model) { |
351 DCHECK(!tabs.empty()); | 352 DCHECK(!tabs.empty()); |
352 DCHECK(std::find(tabs.begin(), tabs.end(), source_tab) != tabs.end()); | 353 DCHECK(std::find(tabs.begin(), tabs.end(), source_tab) != tabs.end()); |
353 source_tabstrip_ = source_tabstrip; | 354 source_tabstrip_ = source_tabstrip; |
354 source_tab_offset_ = source_tab_offset; | 355 source_tab_offset_ = source_tab_offset; |
355 start_screen_point_ = GetCursorScreenPoint(); | 356 start_screen_point_ = GetCursorScreenPoint(); |
356 mouse_offset_ = mouse_offset; | 357 mouse_offset_ = mouse_offset; |
357 stacking_ = source_tabstrip->IsStacking(); | |
358 | 358 |
359 drag_data_.resize(tabs.size()); | 359 drag_data_.resize(tabs.size()); |
360 for (size_t i = 0; i < tabs.size(); ++i) | 360 for (size_t i = 0; i < tabs.size(); ++i) |
361 InitTabDragData(tabs[i], &(drag_data_[i])); | 361 InitTabDragData(tabs[i], &(drag_data_[i])); |
362 source_tab_index_ = | 362 source_tab_index_ = |
363 std::find(tabs.begin(), tabs.end(), source_tab) - tabs.begin(); | 363 std::find(tabs.begin(), tabs.end(), source_tab) - tabs.begin(); |
364 | 364 |
365 // Listen for Esc key presses. | 365 // Listen for Esc key presses. |
366 MessageLoopForUI::current()->AddObserver(this); | 366 MessageLoopForUI::current()->AddObserver(this); |
367 | 367 |
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1475 } | 1475 } |
1476 | 1476 |
1477 // static | 1477 // static |
1478 bool TabDragController::IsActive() { | 1478 bool TabDragController::IsActive() { |
1479 #if defined(USE_AURA) || defined(OS_WIN) | 1479 #if defined(USE_AURA) || defined(OS_WIN) |
1480 return TabDragController2::IsActive() || (instance_ && instance_->active()); | 1480 return TabDragController2::IsActive() || (instance_ && instance_->active()); |
1481 #else | 1481 #else |
1482 return instance_ && instance_->active(); | 1482 return instance_ && instance_->active(); |
1483 #endif | 1483 #endif |
1484 } | 1484 } |
OLD | NEW |