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

Unified Diff: chrome/browser/ui/views/tabs/tab_drag_controller.cc

Issue 1694333002: Remove HostDesktopType from c/b/ui/views/tabs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-27
Patch Set: rebase and linux Created 4 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_drag_controller.h ('k') | chrome/browser/ui/views/tabs/tab_strip.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/tabs/tab_drag_controller.cc
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller.cc b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
index 2b8bb77b0efb38e8ba29049cb196669f6ffdff98..eb5dd067822b015bd313fcb34c30eb42867f885c 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
@@ -198,7 +198,6 @@ TabDragController::TabDragController()
: event_source_(EVENT_SOURCE_MOUSE),
source_tabstrip_(NULL),
attached_tabstrip_(NULL),
- host_desktop_type_(chrome::HOST_DESKTOP_TYPE_NATIVE),
can_release_capture_(true),
offset_to_width_ratio_(0),
old_focused_view_id_(
@@ -262,8 +261,6 @@ void TabDragController::Init(
source_tabstrip_ = source_tabstrip;
was_source_maximized_ = source_tabstrip->GetWidget()->IsMaximized();
was_source_fullscreen_ = source_tabstrip->GetWidget()->IsFullscreen();
- host_desktop_type_ = chrome::GetHostDesktopTypeForNativeView(
- source_tabstrip->GetWidget()->GetNativeView());
// Do not release capture when transferring capture between widgets on:
// - Desktop Linux
// Mouse capture is not synchronous on desktop Linux. Chrome makes
@@ -271,11 +268,8 @@ void TabDragController::Init(
// synchronous on desktop Linux, so use that.
// - Ash
// Releasing capture on Ash cancels gestures so avoid it.
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(USE_ASH)
can_release_capture_ = false;
-#else
- can_release_capture_ =
- (host_desktop_type_ != chrome::HOST_DESKTOP_TYPE_ASH);
#endif
start_point_in_screen_ = gfx::Point(source_tab_offset, mouse_offset.y());
views::View::ConvertPointToScreen(source_tab, &start_point_in_screen_);
@@ -604,10 +598,10 @@ TabDragController::DragBrowserToNewTabStrip(
// ReleaseCapture() is going to result in calling back to us (because it
// results in a move). That'll cause all sorts of problems. Reset the
// observer so we don't get notified and process the event.
- if (host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH) {
- move_loop_widget_->RemoveObserver(this);
- move_loop_widget_ = NULL;
- }
+#if defined(USE_ASH)
+ move_loop_widget_->RemoveObserver(this);
+ move_loop_widget_ = nullptr;
+#endif // USE_ASH
views::Widget* browser_widget = GetAttachedBrowserWidget();
// Need to release the drag controller before starting the move loop as it's
// going to trigger capture lost, which cancels drag.
@@ -1541,8 +1535,7 @@ void TabDragController::CompleteDrag() {
void TabDragController::MaximizeAttachedWindow() {
GetAttachedBrowserWidget()->Maximize();
#if defined(USE_ASH)
- if (was_source_fullscreen_ &&
- host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH) {
+ if (was_source_fullscreen_) {
// In fullscreen mode it is only possible to get here if the source
// was in "immersive fullscreen" mode, so toggle it back on.
ash::accelerators::ToggleFullscreen();
@@ -1575,36 +1568,32 @@ void TabDragController::BringWindowUnderPointToFront(
return;
#if defined(USE_ASH)
- if (host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH) {
- // TODO(varkha): The code below ensures that the phantom drag widget
- // is shown on top of browser windows. The code should be moved to ash/
- // and the phantom should be able to assert its top-most state on its own.
- // One strategy would be for DragWindowController to
- // be able to observe stacking changes to the phantom drag widget's
- // siblings in order to keep it on top. One way is to implement a
- // notification that is sent to a window parent's observers when a
- // stacking order is changed among the children of that same parent.
- // Note that OnWindowStackingChanged is sent only to the child that is the
- // argument of one of the Window::StackChildX calls and not to all its
- // siblings affected by the stacking change.
- aura::Window* browser_window = widget_window->GetNativeView();
- // Find a topmost non-popup window and stack the recipient browser above
- // it in order to avoid stacking the browser window on top of the phantom
- // drag widget created by DragWindowController in a second display.
- for (aura::Window::Windows::const_reverse_iterator it =
- browser_window->parent()->children().rbegin();
- it != browser_window->parent()->children().rend(); ++it) {
- // If the iteration reached the recipient browser window then it is
- // already topmost and it is safe to return with no stacking change.
- if (*it == browser_window)
- return;
- if ((*it)->type() != ui::wm::WINDOW_TYPE_POPUP) {
- widget_window->StackAbove(*it);
- break;
- }
+ // TODO(varkha): The code below ensures that the phantom drag widget
+ // is shown on top of browser windows. The code should be moved to ash/
+ // and the phantom should be able to assert its top-most state on its own.
+ // One strategy would be for DragWindowController to
+ // be able to observe stacking changes to the phantom drag widget's
+ // siblings in order to keep it on top. One way is to implement a
+ // notification that is sent to a window parent's observers when a
+ // stacking order is changed among the children of that same parent.
+ // Note that OnWindowStackingChanged is sent only to the child that is the
+ // argument of one of the Window::StackChildX calls and not to all its
+ // siblings affected by the stacking change.
+ aura::Window* browser_window = widget_window->GetNativeView();
+ // Find a topmost non-popup window and stack the recipient browser above
+ // it in order to avoid stacking the browser window on top of the phantom
+ // drag widget created by DragWindowController in a second display.
+ for (aura::Window::Windows::const_reverse_iterator it =
+ browser_window->parent()->children().rbegin();
+ it != browser_window->parent()->children().rend(); ++it) {
+ // If the iteration reached the recipient browser window then it is
+ // already topmost and it is safe to return with no stacking change.
+ if (*it == browser_window)
+ return;
+ if ((*it)->type() != ui::wm::WINDOW_TYPE_POPUP) {
+ widget_window->StackAbove(*it);
+ break;
}
- } else {
- widget_window->StackAtTop();
}
#else
widget_window->StackAtTop();
@@ -1762,8 +1751,7 @@ Browser* TabDragController::CreateBrowserForDrag(
gfx::Point TabDragController::GetCursorScreenPoint() {
#if defined(USE_ASH)
- if (host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH &&
- event_source_ == EVENT_SOURCE_TOUCH &&
+ if (event_source_ == EVENT_SOURCE_TOUCH &&
aura::Env::GetInstance()->is_touch_down()) {
views::Widget* widget = GetAttachedBrowserWidget();
DCHECK(widget);
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_drag_controller.h ('k') | chrome/browser/ui/views/tabs/tab_strip.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698