Chromium Code Reviews

Side by Side Diff: chrome/browser/ui/views/tabs/tab_drag_controller.cc

Issue 2449103004: Refactor WindowFinder definition (Closed)
Patch Set: fixed the unittests build Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
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...)
42 #if defined(USE_ASH) 42 #if defined(USE_ASH)
43 #include "ash/common/accelerators/accelerator_commands.h" // nogncheck 43 #include "ash/common/accelerators/accelerator_commands.h" // nogncheck
44 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" // nogncheck 44 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" // nogncheck
45 #include "ash/common/wm/window_state.h" // nogncheck 45 #include "ash/common/wm/window_state.h" // nogncheck
46 #include "ash/common/wm_shell.h" // nogncheck 46 #include "ash/common/wm_shell.h" // nogncheck
47 #include "ash/wm/window_state_aura.h" // nogncheck 47 #include "ash/wm/window_state_aura.h" // nogncheck
48 #include "ui/wm/core/coordinate_conversion.h" // nogncheck 48 #include "ui/wm/core/coordinate_conversion.h" // nogncheck
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" // nogncheck
53 #include "content/public/common/service_manager_connection.h" // nogncheck 52 #include "content/public/common/service_manager_connection.h" // nogncheck
54 #include "services/service_manager/runner/common/client_util.h" // nogncheck 53 #include "services/service_manager/runner/common/client_util.h" // nogncheck
55 #include "ui/aura/env.h" // nogncheck 54 #include "ui/aura/env.h" // nogncheck
56 #include "ui/aura/window.h" // nogncheck 55 #include "ui/aura/window.h" // nogncheck
57 #include "ui/wm/core/window_modality_controller.h" // nogncheck 56 #include "ui/wm/core/window_modality_controller.h" // nogncheck
58 #endif 57 #endif
59 58
60 using base::UserMetricsAction; 59 using base::UserMetricsAction;
61 using content::OpenURLParams; 60 using content::OpenURLParams;
62 using content::WebContents; 61 using content::WebContents;
(...skipping 155 matching lines...)
218 was_source_maximized_(false), 217 was_source_maximized_(false),
219 was_source_fullscreen_(false), 218 was_source_fullscreen_(false),
220 did_restore_window_(false), 219 did_restore_window_(false),
221 end_run_loop_behavior_(END_RUN_LOOP_STOP_DRAGGING), 220 end_run_loop_behavior_(END_RUN_LOOP_STOP_DRAGGING),
222 waiting_for_run_loop_to_exit_(false), 221 waiting_for_run_loop_to_exit_(false),
223 tab_strip_to_attach_to_after_exit_(NULL), 222 tab_strip_to_attach_to_after_exit_(NULL),
224 move_loop_widget_(NULL), 223 move_loop_widget_(NULL),
225 is_mutating_(false), 224 is_mutating_(false),
226 attach_x_(-1), 225 attach_x_(-1),
227 attach_index_(-1), 226 attach_index_(-1),
227 window_finder_(new WindowFinder),
228 weak_factory_(this) { 228 weak_factory_(this) {
229 instance_ = this; 229 instance_ = this;
230
231 #if defined(USE_AURA)
232 content::ServiceManagerConnection* service_manager_connection =
233 content::ServiceManagerConnection::GetForProcess();
234 if (service_manager_connection && service_manager::ServiceManagerIsRemote())
235 window_finder_.reset(new WindowFinderMus);
236 else
237 #endif
238 window_finder_.reset(new WindowFinder);
239 } 230 }
240 231
241 TabDragController::~TabDragController() { 232 TabDragController::~TabDragController() {
242 views::ViewStorage::GetInstance()->RemoveView(old_focused_view_id_); 233 views::ViewStorage::GetInstance()->RemoveView(old_focused_view_id_);
243 234
244 if (instance_ == this) 235 if (instance_ == this)
245 instance_ = NULL; 236 instance_ = NULL;
246 237
247 if (move_loop_widget_) { 238 if (move_loop_widget_) {
248 if (added_observer_to_move_loop_widget_) 239 if (added_observer_to_move_loop_widget_)
(...skipping 1597 matching lines...)
1846 // TODO(pkotwicz): Fix this properly (crbug.com/358482) 1837 // TODO(pkotwicz): Fix this properly (crbug.com/358482)
1847 for (auto* browser : *BrowserList::GetInstance()) { 1838 for (auto* browser : *BrowserList::GetInstance()) {
1848 if (browser->tab_strip_model()->empty()) 1839 if (browser->tab_strip_model()->empty())
1849 exclude.insert(browser->window()->GetNativeWindow()); 1840 exclude.insert(browser->window()->GetNativeWindow());
1850 } 1841 }
1851 #endif 1842 #endif
1852 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); 1843 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr());
1853 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); 1844 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude);
1854 return ref ? Liveness::ALIVE : Liveness::DELETED; 1845 return ref ? Liveness::ALIVE : Liveness::DELETED;
1855 } 1846 }
OLDNEW

Powered by Google App Engine