| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 "ui/aura/env.h" | 52 #include "ui/aura/env.h" |
| 53 #include "ui/aura/window.h" | 53 #include "ui/aura/window.h" |
| 54 #include "ui/wm/core/window_modality_controller.h" | 54 #include "ui/wm/core/window_modality_controller.h" |
| 55 #endif | 55 #endif |
| 56 | 56 |
| 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 |
| 57 using base::UserMetricsAction; | 63 using base::UserMetricsAction; |
| 58 using content::OpenURLParams; | 64 using content::OpenURLParams; |
| 59 using content::WebContents; | 65 using content::WebContents; |
| 60 | 66 |
| 61 // If non-null there is a drag underway. | 67 // If non-null there is a drag underway. |
| 62 static TabDragController* instance_ = NULL; | 68 static TabDragController* instance_ = NULL; |
| 63 | 69 |
| 64 namespace { | 70 namespace { |
| 65 | 71 |
| 66 // Delay, in ms, during dragging before we bring a window to front. | 72 // Delay, in ms, during dragging before we bring a window to front. |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 was_source_maximized_(false), | 221 was_source_maximized_(false), |
| 216 was_source_fullscreen_(false), | 222 was_source_fullscreen_(false), |
| 217 did_restore_window_(false), | 223 did_restore_window_(false), |
| 218 end_run_loop_behavior_(END_RUN_LOOP_STOP_DRAGGING), | 224 end_run_loop_behavior_(END_RUN_LOOP_STOP_DRAGGING), |
| 219 waiting_for_run_loop_to_exit_(false), | 225 waiting_for_run_loop_to_exit_(false), |
| 220 tab_strip_to_attach_to_after_exit_(NULL), | 226 tab_strip_to_attach_to_after_exit_(NULL), |
| 221 move_loop_widget_(NULL), | 227 move_loop_widget_(NULL), |
| 222 is_mutating_(false), | 228 is_mutating_(false), |
| 223 attach_x_(-1), | 229 attach_x_(-1), |
| 224 attach_index_(-1), | 230 attach_index_(-1), |
| 225 window_finder_(new WindowFinder), | |
| 226 weak_factory_(this) { | 231 weak_factory_(this) { |
| 227 instance_ = this; | 232 instance_ = this; |
| 233 |
| 234 #if defined(MOJO_SHELL_CLIENT) |
| 235 content::MojoShellConnection* mojo_shell_connection = |
| 236 content::MojoShellConnection::GetForProcess(); |
| 237 if (mojo_shell_connection && shell::ShellIsRemote()) |
| 238 window_finder_.reset(new WindowFinderMus); |
| 239 else |
| 240 #endif |
| 241 window_finder_.reset(new WindowFinder); |
| 228 } | 242 } |
| 229 | 243 |
| 230 TabDragController::~TabDragController() { | 244 TabDragController::~TabDragController() { |
| 231 views::ViewStorage::GetInstance()->RemoveView(old_focused_view_id_); | 245 views::ViewStorage::GetInstance()->RemoveView(old_focused_view_id_); |
| 232 | 246 |
| 233 if (instance_ == this) | 247 if (instance_ == this) |
| 234 instance_ = NULL; | 248 instance_ = NULL; |
| 235 | 249 |
| 236 if (move_loop_widget_) { | 250 if (move_loop_widget_) { |
| 237 move_loop_widget_->RemoveObserver(this); | 251 move_loop_widget_->RemoveObserver(this); |
| (...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1807 // TODO(pkotwicz): Fix this properly (crbug.com/358482) | 1821 // TODO(pkotwicz): Fix this properly (crbug.com/358482) |
| 1808 for (auto* browser : *BrowserList::GetInstance()) { | 1822 for (auto* browser : *BrowserList::GetInstance()) { |
| 1809 if (browser->tab_strip_model()->empty()) | 1823 if (browser->tab_strip_model()->empty()) |
| 1810 exclude.insert(browser->window()->GetNativeWindow()); | 1824 exclude.insert(browser->window()->GetNativeWindow()); |
| 1811 } | 1825 } |
| 1812 #endif | 1826 #endif |
| 1813 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); | 1827 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); |
| 1814 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); | 1828 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); |
| 1815 return ref ? Liveness::ALIVE : Liveness::DELETED; | 1829 return ref ? Liveness::ALIVE : Liveness::DELETED; |
| 1816 } | 1830 } |
| OLD | NEW |