| 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" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #if defined(USE_ASH) | 42 #if defined(USE_ASH) |
| 43 #include "ash/common/accelerators/accelerator_commands.h" | 43 #include "ash/common/accelerators/accelerator_commands.h" |
| 44 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 44 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 45 #include "ash/common/wm/window_state.h" | 45 #include "ash/common/wm/window_state.h" |
| 46 #include "ash/common/wm_shell.h" | 46 #include "ash/common/wm_shell.h" |
| 47 #include "ash/wm/window_state_aura.h" | 47 #include "ash/wm/window_state_aura.h" |
| 48 #include "ui/wm/core/coordinate_conversion.h" | 48 #include "ui/wm/core/coordinate_conversion.h" |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 #if defined(USE_AURA) | 51 #if defined(USE_AURA) |
| 52 #include "chrome/browser/ui/views/tabs/window_finder_mus.h" |
| 53 #include "content/public/common/mojo_shell_connection.h" |
| 54 #include "services/shell/runner/common/client_util.h" |
| 52 #include "ui/aura/env.h" | 55 #include "ui/aura/env.h" |
| 53 #include "ui/aura/window.h" | 56 #include "ui/aura/window.h" |
| 54 #include "ui/wm/core/window_modality_controller.h" | 57 #include "ui/wm/core/window_modality_controller.h" |
| 55 #endif | 58 #endif |
| 56 | 59 |
| 57 #if defined(MOJO_SHELL_CLIENT) | |
| 58 #include "chrome/browser/ui/views/tabs/window_finder_mus.h" | |
| 59 #include "content/public/common/mojo_shell_connection.h" | |
| 60 #include "services/shell/runner/common/client_util.h" | |
| 61 #endif | |
| 62 | |
| 63 using base::UserMetricsAction; | 60 using base::UserMetricsAction; |
| 64 using content::OpenURLParams; | 61 using content::OpenURLParams; |
| 65 using content::WebContents; | 62 using content::WebContents; |
| 66 | 63 |
| 67 // If non-null there is a drag underway. | 64 // If non-null there is a drag underway. |
| 68 static TabDragController* instance_ = NULL; | 65 static TabDragController* instance_ = NULL; |
| 69 | 66 |
| 70 namespace { | 67 namespace { |
| 71 | 68 |
| 72 // Delay, in ms, during dragging before we bring a window to front. | 69 // Delay, in ms, during dragging before we bring a window to front. |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 end_run_loop_behavior_(END_RUN_LOOP_STOP_DRAGGING), | 221 end_run_loop_behavior_(END_RUN_LOOP_STOP_DRAGGING), |
| 225 waiting_for_run_loop_to_exit_(false), | 222 waiting_for_run_loop_to_exit_(false), |
| 226 tab_strip_to_attach_to_after_exit_(NULL), | 223 tab_strip_to_attach_to_after_exit_(NULL), |
| 227 move_loop_widget_(NULL), | 224 move_loop_widget_(NULL), |
| 228 is_mutating_(false), | 225 is_mutating_(false), |
| 229 attach_x_(-1), | 226 attach_x_(-1), |
| 230 attach_index_(-1), | 227 attach_index_(-1), |
| 231 weak_factory_(this) { | 228 weak_factory_(this) { |
| 232 instance_ = this; | 229 instance_ = this; |
| 233 | 230 |
| 234 #if defined(MOJO_SHELL_CLIENT) | 231 #if defined(USE_AURA) |
| 235 content::MojoShellConnection* mojo_shell_connection = | 232 content::MojoShellConnection* mojo_shell_connection = |
| 236 content::MojoShellConnection::GetForProcess(); | 233 content::MojoShellConnection::GetForProcess(); |
| 237 if (mojo_shell_connection && shell::ShellIsRemote()) | 234 if (mojo_shell_connection && shell::ShellIsRemote()) |
| 238 window_finder_.reset(new WindowFinderMus); | 235 window_finder_.reset(new WindowFinderMus); |
| 239 else | 236 else |
| 240 #endif | 237 #endif |
| 241 window_finder_.reset(new WindowFinder); | 238 window_finder_.reset(new WindowFinder); |
| 242 } | 239 } |
| 243 | 240 |
| 244 TabDragController::~TabDragController() { | 241 TabDragController::~TabDragController() { |
| (...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1831 // TODO(pkotwicz): Fix this properly (crbug.com/358482) | 1828 // TODO(pkotwicz): Fix this properly (crbug.com/358482) |
| 1832 for (auto* browser : *BrowserList::GetInstance()) { | 1829 for (auto* browser : *BrowserList::GetInstance()) { |
| 1833 if (browser->tab_strip_model()->empty()) | 1830 if (browser->tab_strip_model()->empty()) |
| 1834 exclude.insert(browser->window()->GetNativeWindow()); | 1831 exclude.insert(browser->window()->GetNativeWindow()); |
| 1835 } | 1832 } |
| 1836 #endif | 1833 #endif |
| 1837 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); | 1834 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); |
| 1838 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); | 1835 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); |
| 1839 return ref ? Liveness::ALIVE : Liveness::DELETED; | 1836 return ref ? Liveness::ALIVE : Liveness::DELETED; |
| 1840 } | 1837 } |
| OLD | NEW |