| 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/debug/alias.h" |
| 12 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 15 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/browser_list.h" | 18 #include "chrome/browser/ui/browser_list.h" |
| 18 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
| 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 20 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" |
| 21 #include "chrome/browser/ui/views/frame/browser_view.h" | 22 #include "chrome/browser/ui/views/frame/browser_view.h" |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 if (!browser_view || | 853 if (!browser_view || |
| 853 !browser_view->browser()->SupportsWindowFeature( | 854 !browser_view->browser()->SupportsWindowFeature( |
| 854 Browser::FEATURE_TABSTRIP)) | 855 Browser::FEATURE_TABSTRIP)) |
| 855 return NULL; | 856 return NULL; |
| 856 | 857 |
| 857 TabStrip* other_tabstrip = browser_view->tabstrip(); | 858 TabStrip* other_tabstrip = browser_view->tabstrip(); |
| 858 TabStrip* tab_strip = | 859 TabStrip* tab_strip = |
| 859 attached_tabstrip_ ? attached_tabstrip_ : source_tabstrip_; | 860 attached_tabstrip_ ? attached_tabstrip_ : source_tabstrip_; |
| 860 DCHECK(tab_strip); | 861 DCHECK(tab_strip); |
| 861 | 862 |
| 863 CHECK(instance_); |
| 864 if (!other_tabstrip->controller() || !tab_strip->controller()) { |
| 865 base::debug::Alias(attached_tabstrip_); |
| 866 base::debug::Alias(source_tabstrip_); |
| 867 base::debug::Alias(other_tabstrip); |
| 868 CHECK(other_tabstrip->controller()); |
| 869 CHECK(tab_strip->controller()); |
| 870 } |
| 871 |
| 862 return other_tabstrip->controller()->IsCompatibleWith(tab_strip) ? | 872 return other_tabstrip->controller()->IsCompatibleWith(tab_strip) ? |
| 863 other_tabstrip : NULL; | 873 other_tabstrip : NULL; |
| 864 } | 874 } |
| 865 | 875 |
| 866 bool TabDragController::DoesTabStripContain( | 876 bool TabDragController::DoesTabStripContain( |
| 867 TabStrip* tabstrip, | 877 TabStrip* tabstrip, |
| 868 const gfx::Point& point_in_screen) const { | 878 const gfx::Point& point_in_screen) const { |
| 869 // Make sure the specified screen point is actually within the bounds of the | 879 // Make sure the specified screen point is actually within the bounds of the |
| 870 // specified tabstrip... | 880 // specified tabstrip... |
| 871 gfx::Rect tabstrip_bounds = GetViewScreenBounds(tabstrip); | 881 gfx::Rect tabstrip_bounds = GetViewScreenBounds(tabstrip); |
| (...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 // window which was used for dragging is not hidden once all of its tabs are | 1807 // window which was used for dragging is not hidden once all of its tabs are |
| 1798 // attached to another browser window in DragBrowserToNewTabStrip(). | 1808 // attached to another browser window in DragBrowserToNewTabStrip(). |
| 1799 // TODO(pkotwicz): Fix this properly (crbug.com/358482) | 1809 // TODO(pkotwicz): Fix this properly (crbug.com/358482) |
| 1800 for (auto* browser : *BrowserList::GetInstance()) { | 1810 for (auto* browser : *BrowserList::GetInstance()) { |
| 1801 if (browser->tab_strip_model()->empty()) | 1811 if (browser->tab_strip_model()->empty()) |
| 1802 exclude.insert(browser->window()->GetNativeWindow()); | 1812 exclude.insert(browser->window()->GetNativeWindow()); |
| 1803 } | 1813 } |
| 1804 #endif | 1814 #endif |
| 1805 return GetLocalProcessWindowAtPoint(screen_point, exclude); | 1815 return GetLocalProcessWindowAtPoint(screen_point, exclude); |
| 1806 } | 1816 } |
| OLD | NEW |