| 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_drag_controller.h" | 5 #include "chrome/browser/ui/views/tabs/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/auto_reset.h" | 10 #include "base/auto_reset.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "base/stl_util.h" |
| 15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 17 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/browser_list.h" | 19 #include "chrome/browser/ui/browser_list.h" |
| 19 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
| 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 21 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" | 22 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" |
| 22 #include "chrome/browser/ui/views/frame/browser_view.h" | 23 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 23 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" | 24 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" |
| 24 #include "chrome/browser/ui/views/tabs/stacked_tab_strip_layout.h" | 25 #include "chrome/browser/ui/views/tabs/stacked_tab_strip_layout.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 void TabDragController::Init( | 241 void TabDragController::Init( |
| 241 TabStrip* source_tabstrip, | 242 TabStrip* source_tabstrip, |
| 242 Tab* source_tab, | 243 Tab* source_tab, |
| 243 const std::vector<Tab*>& tabs, | 244 const std::vector<Tab*>& tabs, |
| 244 const gfx::Point& mouse_offset, | 245 const gfx::Point& mouse_offset, |
| 245 int source_tab_offset, | 246 int source_tab_offset, |
| 246 const ui::ListSelectionModel& initial_selection_model, | 247 const ui::ListSelectionModel& initial_selection_model, |
| 247 MoveBehavior move_behavior, | 248 MoveBehavior move_behavior, |
| 248 EventSource event_source) { | 249 EventSource event_source) { |
| 249 DCHECK(!tabs.empty()); | 250 DCHECK(!tabs.empty()); |
| 250 DCHECK(std::find(tabs.begin(), tabs.end(), source_tab) != tabs.end()); | 251 DCHECK(base::ContainsValue(tabs, source_tab)); |
| 251 source_tabstrip_ = source_tabstrip; | 252 source_tabstrip_ = source_tabstrip; |
| 252 was_source_maximized_ = source_tabstrip->GetWidget()->IsMaximized(); | 253 was_source_maximized_ = source_tabstrip->GetWidget()->IsMaximized(); |
| 253 was_source_fullscreen_ = source_tabstrip->GetWidget()->IsFullscreen(); | 254 was_source_fullscreen_ = source_tabstrip->GetWidget()->IsFullscreen(); |
| 254 // Do not release capture when transferring capture between widgets on: | 255 // Do not release capture when transferring capture between widgets on: |
| 255 // - Desktop Linux | 256 // - Desktop Linux |
| 256 // Mouse capture is not synchronous on desktop Linux. Chrome makes | 257 // Mouse capture is not synchronous on desktop Linux. Chrome makes |
| 257 // transferring capture between widgets without releasing capture appear | 258 // transferring capture between widgets without releasing capture appear |
| 258 // synchronous on desktop Linux, so use that. | 259 // synchronous on desktop Linux, so use that. |
| 259 // - Ash | 260 // - Ash |
| 260 // Releasing capture on Ash cancels gestures so avoid it. | 261 // Releasing capture on Ash cancels gestures so avoid it. |
| (...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 // TODO(pkotwicz): Fix this properly (crbug.com/358482) | 1798 // TODO(pkotwicz): Fix this properly (crbug.com/358482) |
| 1798 for (auto* browser : *BrowserList::GetInstance()) { | 1799 for (auto* browser : *BrowserList::GetInstance()) { |
| 1799 if (browser->tab_strip_model()->empty()) | 1800 if (browser->tab_strip_model()->empty()) |
| 1800 exclude.insert(browser->window()->GetNativeWindow()); | 1801 exclude.insert(browser->window()->GetNativeWindow()); |
| 1801 } | 1802 } |
| 1802 #endif | 1803 #endif |
| 1803 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); | 1804 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); |
| 1804 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); | 1805 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); |
| 1805 return ref ? Liveness::ALIVE : Liveness::DELETED; | 1806 return ref ? Liveness::ALIVE : Liveness::DELETED; |
| 1806 } | 1807 } |
| OLD | NEW |