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 "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/ui/browser_list.h" | 18 #include "chrome/browser/ui/browser_list.h" |
19 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
20 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
21 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" |
22 #include "chrome/browser/ui/views/frame/browser_view.h" | 22 #include "chrome/browser/ui/views/frame/browser_view.h" |
23 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" | 23 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" |
24 #include "chrome/browser/ui/views/tabs/stacked_tab_strip_layout.h" | 24 #include "chrome/browser/ui/views/tabs/stacked_tab_strip_layout.h" |
25 #include "chrome/browser/ui/views/tabs/tab.h" | 25 #include "chrome/browser/ui/views/tabs/tab.h" |
26 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 26 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
27 #include "chrome/browser/ui/views/tabs/window_finder.h" | 27 #include "chrome/browser/ui/views/tabs/window_finder.h" |
28 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
29 #include "content/public/browser/notification_source.h" | 29 #include "content/public/browser/notification_source.h" |
30 #include "content/public/browser/user_metrics.h" | |
31 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
32 #include "extensions/browser/extension_function_dispatcher.h" | 31 #include "extensions/browser/extension_function_dispatcher.h" |
33 #include "ui/display/display.h" | 32 #include "ui/display/display.h" |
34 #include "ui/display/screen.h" | 33 #include "ui/display/screen.h" |
35 #include "ui/events/event_constants.h" | 34 #include "ui/events/event_constants.h" |
36 #include "ui/events/gestures/gesture_recognizer.h" | 35 #include "ui/events/gestures/gesture_recognizer.h" |
37 #include "ui/gfx/geometry/point_conversions.h" | 36 #include "ui/gfx/geometry/point_conversions.h" |
38 #include "ui/views/event_monitor.h" | 37 #include "ui/views/event_monitor.h" |
39 #include "ui/views/focus/view_storage.h" | 38 #include "ui/views/focus/view_storage.h" |
40 #include "ui/views/widget/root_view.h" | 39 #include "ui/views/widget/root_view.h" |
41 #include "ui/views/widget/widget.h" | 40 #include "ui/views/widget/widget.h" |
42 | 41 |
43 #if defined(USE_ASH) | 42 #if defined(USE_ASH) |
44 #include "ash/common/accelerators/accelerator_commands.h" // nogncheck | 43 #include "ash/common/accelerators/accelerator_commands.h" // nogncheck |
45 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" // nogncheck | 44 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" // nogncheck |
46 #include "ash/common/wm/window_state.h" // nogncheck | 45 #include "ash/common/wm/window_state.h" // nogncheck |
47 #include "ash/shell.h" // nogncheck | 46 #include "ash/shell.h" // nogncheck |
48 #include "ash/wm/window_state_aura.h" // nogncheck | 47 #include "ash/wm/window_state_aura.h" // nogncheck |
49 #include "ui/wm/core/coordinate_conversion.h" // nogncheck | 48 #include "ui/wm/core/coordinate_conversion.h" // nogncheck |
50 #endif | 49 #endif |
51 | 50 |
52 #if defined(USE_AURA) | 51 #if defined(USE_AURA) |
53 #include "ui/aura/env.h" // nogncheck | 52 #include "ui/aura/env.h" // nogncheck |
54 #include "ui/aura/window.h" // nogncheck | 53 #include "ui/aura/window.h" // nogncheck |
55 #include "ui/wm/core/window_modality_controller.h" // nogncheck | 54 #include "ui/wm/core/window_modality_controller.h" // nogncheck |
56 #endif | 55 #endif |
57 | 56 |
58 using base::UserMetricsAction; | |
59 using content::OpenURLParams; | 57 using content::OpenURLParams; |
60 using content::WebContents; | 58 using content::WebContents; |
61 | 59 |
62 // If non-null there is a drag underway. | 60 // If non-null there is a drag underway. |
63 static TabDragController* instance_ = NULL; | 61 static TabDragController* instance_ = NULL; |
64 | 62 |
65 namespace { | 63 namespace { |
66 | 64 |
67 // Delay, in ms, during dragging before we bring a window to front. | 65 // Delay, in ms, during dragging before we bring a window to front. |
68 const int kBringToFrontDelay = 750; | 66 const int kBringToFrontDelay = 750; |
(...skipping 1725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1794 // TODO(pkotwicz): Fix this properly (crbug.com/358482) | 1792 // TODO(pkotwicz): Fix this properly (crbug.com/358482) |
1795 for (auto* browser : *BrowserList::GetInstance()) { | 1793 for (auto* browser : *BrowserList::GetInstance()) { |
1796 if (browser->tab_strip_model()->empty()) | 1794 if (browser->tab_strip_model()->empty()) |
1797 exclude.insert(browser->window()->GetNativeWindow()); | 1795 exclude.insert(browser->window()->GetNativeWindow()); |
1798 } | 1796 } |
1799 #endif | 1797 #endif |
1800 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); | 1798 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); |
1801 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); | 1799 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); |
1802 return ref ? Liveness::ALIVE : Liveness::DELETED; | 1800 return ref ? Liveness::ALIVE : Liveness::DELETED; |
1803 } | 1801 } |
OLD | NEW |