Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / views / widget / desktop_aura / x11_desktop_window_move_client.h
blob1c932711d3305e429377cb1983b5d1e013927b1f
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
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_WINDOW_MOVE_CLIENT_H_
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_WINDOW_MOVE_CLIENT_H_
8 #include <X11/Xlib.h>
10 #include "base/callback.h"
11 #include "base/compiler_specific.h"
12 #include "base/message_loop/message_loop.h"
13 #include "ui/gfx/point.h"
14 #include "ui/views/views_export.h"
15 #include "ui/views/widget/desktop_aura/x11_move_loop_delegate.h"
16 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h"
17 #include "ui/wm/public/window_move_client.h"
19 namespace aura {
20 class WindowTreeHost;
23 namespace views {
25 // When we're dragging tabs, we need to manually position our window.
26 class VIEWS_EXPORT X11DesktopWindowMoveClient :
27 public views::X11MoveLoopDelegate,
28 public aura::client::WindowMoveClient {
29 public:
30 X11DesktopWindowMoveClient();
31 virtual ~X11DesktopWindowMoveClient();
33 // Overridden from X11WholeScreenMoveLoopDelegate:
34 virtual void OnMouseMovement(XMotionEvent* event) OVERRIDE;
35 virtual void OnMouseReleased() OVERRIDE;
36 virtual void OnMoveLoopEnded() OVERRIDE;
38 // Overridden from aura::client::WindowMoveClient:
39 virtual aura::client::WindowMoveResult RunMoveLoop(
40 aura::Window* window,
41 const gfx::Vector2d& drag_offset,
42 aura::client::WindowMoveSource move_source) OVERRIDE;
43 virtual void EndMoveLoop() OVERRIDE;
45 private:
46 X11WholeScreenMoveLoop move_loop_;
48 // We need to keep track of this so we can actually move it when reacting to
49 // mouse events.
50 aura::WindowTreeHost* host_;
52 // Our cursor offset from the top left window origin when the drag
53 // started. Used to calculate the window's new bounds relative to the current
54 // location of the cursor.
55 gfx::Vector2d window_offset_;
58 } // namespace views
60 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_WINDOW_MOVE_CLIENT_H_