Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

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

Issue 2449103004: Refactor WindowFinder definition (Closed)
Patch Set: no ifdefs Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
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...) Expand 10 before | Expand all | Expand 10 after
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
54 #include "services/service_manager/runner/common/client_util.h" // nogncheck
55 #include "ui/aura/env.h" // nogncheck 52 #include "ui/aura/env.h" // nogncheck
56 #include "ui/aura/window.h" // nogncheck 53 #include "ui/aura/window.h" // nogncheck
57 #include "ui/wm/core/window_modality_controller.h" // nogncheck 54 #include "ui/wm/core/window_modality_controller.h" // nogncheck
58 #endif 55 #endif
59 56
60 using base::UserMetricsAction; 57 using base::UserMetricsAction;
61 using content::OpenURLParams; 58 using content::OpenURLParams;
62 using content::WebContents; 59 using content::WebContents;
63 60
64 // If non-null there is a drag underway. 61 // If non-null there is a drag underway.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 was_source_maximized_(false), 215 was_source_maximized_(false),
219 was_source_fullscreen_(false), 216 was_source_fullscreen_(false),
220 did_restore_window_(false), 217 did_restore_window_(false),
221 end_run_loop_behavior_(END_RUN_LOOP_STOP_DRAGGING), 218 end_run_loop_behavior_(END_RUN_LOOP_STOP_DRAGGING),
222 waiting_for_run_loop_to_exit_(false), 219 waiting_for_run_loop_to_exit_(false),
223 tab_strip_to_attach_to_after_exit_(NULL), 220 tab_strip_to_attach_to_after_exit_(NULL),
224 move_loop_widget_(NULL), 221 move_loop_widget_(NULL),
225 is_mutating_(false), 222 is_mutating_(false),
226 attach_x_(-1), 223 attach_x_(-1),
227 attach_index_(-1), 224 attach_index_(-1),
225 window_finder_(new WindowFinder),
228 weak_factory_(this) { 226 weak_factory_(this) {
229 instance_ = this; 227 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 } 228 }
240 229
241 TabDragController::~TabDragController() { 230 TabDragController::~TabDragController() {
242 views::ViewStorage::GetInstance()->RemoveView(old_focused_view_id_); 231 views::ViewStorage::GetInstance()->RemoveView(old_focused_view_id_);
243 232
244 if (instance_ == this) 233 if (instance_ == this)
245 instance_ = NULL; 234 instance_ = NULL;
246 235
247 if (move_loop_widget_) { 236 if (move_loop_widget_) {
248 if (added_observer_to_move_loop_widget_) 237 if (added_observer_to_move_loop_widget_)
(...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1846 // TODO(pkotwicz): Fix this properly (crbug.com/358482) 1835 // TODO(pkotwicz): Fix this properly (crbug.com/358482)
1847 for (auto* browser : *BrowserList::GetInstance()) { 1836 for (auto* browser : *BrowserList::GetInstance()) {
1848 if (browser->tab_strip_model()->empty()) 1837 if (browser->tab_strip_model()->empty())
1849 exclude.insert(browser->window()->GetNativeWindow()); 1838 exclude.insert(browser->window()->GetNativeWindow());
1850 } 1839 }
1851 #endif 1840 #endif
1852 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); 1841 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr());
1853 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); 1842 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude);
1854 return ref ? Liveness::ALIVE : Liveness::DELETED; 1843 return ref ? Liveness::ALIVE : Liveness::DELETED;
1855 } 1844 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698