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

Unified Diff: ash/common/wm/workspace/multi_window_resize_controller.h

Issue 2736573002: chromeos: Move files in //ash/common to //ash, part 2 (Closed)
Patch Set: Created 3 years, 9 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
Index: ash/common/wm/workspace/multi_window_resize_controller.h
diff --git a/ash/common/wm/workspace/multi_window_resize_controller.h b/ash/common/wm/workspace/multi_window_resize_controller.h
deleted file mode 100644
index 48bd35a67f3440443eadea6dc5a91e97b4181f5b..0000000000000000000000000000000000000000
--- a/ash/common/wm/workspace/multi_window_resize_controller.h
+++ /dev/null
@@ -1,180 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ASH_COMMON_WM_WORKSPACE_MULTI_WINDOW_RESIZE_CONTROLLER_H_
-#define ASH_COMMON_WM_WORKSPACE_MULTI_WINDOW_RESIZE_CONTROLLER_H_
-
-#include <memory>
-#include <vector>
-
-#include "ash/ash_export.h"
-#include "base/macros.h"
-#include "base/timer/timer.h"
-#include "ui/aura/window_observer.h"
-#include "ui/gfx/geometry/rect.h"
-#include "ui/views/mouse_watcher.h"
-
-namespace views {
-class Widget;
-}
-
-namespace ash {
-class MultiWindowResizeControllerTest;
-class WmWindow;
-class WorkspaceWindowResizer;
-
-// Two directions resizes happen in.
-enum Direction {
- TOP_BOTTOM,
- LEFT_RIGHT,
-};
-
-// MultiWindowResizeController is responsible for determining and showing a
-// widget that allows resizing multiple windows at the same time.
-// MultiWindowResizeController is driven by WorkspaceEventFilter.
-class ASH_EXPORT MultiWindowResizeController
- : public views::MouseWatcherListener,
- public aura::WindowObserver {
- public:
- MultiWindowResizeController();
- ~MultiWindowResizeController() override;
-
- // If necessary, shows the resize widget. |window| is the window the mouse
- // is over, |component| the edge and |point| the location of the mouse.
- void Show(WmWindow* window, int component, const gfx::Point& point);
-
- // Hides the resize widget.
- void Hide();
-
- // MouseWatcherListenre overrides:
- void MouseMovedOutOfHost() override;
-
- // WindowObserver overrides:
- void OnWindowDestroying(aura::Window* window) override;
-
- private:
- friend class MultiWindowResizeControllerTest;
-
- // Used to track the two resizable windows and direction.
- struct ResizeWindows {
- ResizeWindows();
- ResizeWindows(const ResizeWindows& other);
- ~ResizeWindows();
-
- // Returns true if |other| equals this ResizeWindows. This does *not*
- // consider the windows in |other_windows|.
- bool Equals(const ResizeWindows& other) const;
-
- // Returns true if this ResizeWindows is valid.
- bool is_valid() const { return window1 && window2; }
-
- // The left/top window to resize.
- WmWindow* window1;
-
- // Other window to resize.
- WmWindow* window2;
-
- // Direction
- Direction direction;
-
- // Windows after |window2| that are to be resized. Determined at the time
- // the resize starts.
- std::vector<WmWindow*> other_windows;
- };
-
- class ResizeMouseWatcherHost;
- class ResizeView;
-
- void CreateMouseWatcher();
-
- // Returns a ResizeWindows based on the specified arguments. Use is_valid()
- // to test if the return value is a valid multi window resize location.
- ResizeWindows DetermineWindows(WmWindow* window,
- int window_component,
- const gfx::Point& point) const;
-
- // Variant of DetermineWindows() that uses the current location of the mouse
- // to determine the resize windows.
- ResizeWindows DetermineWindowsFromScreenPoint(WmWindow* window) const;
-
- // Finds a window by edge (one of the constants HitTestCompat.
- WmWindow* FindWindowByEdge(WmWindow* window_to_ignore,
- int edge_want,
- int x_in_parent,
- int y_in_parent) const;
-
- // Returns the first window touching |window|.
- WmWindow* FindWindowTouching(WmWindow* window, Direction direction) const;
-
- // Places any windows touching |start| into |others|.
- void FindWindowsTouching(WmWindow* start,
- Direction direction,
- std::vector<WmWindow*>* others) const;
-
- // Shows the resizer if the mouse is still at a valid location. This is called
- // from the |show_timer_|.
- void ShowIfValidMouseLocation();
-
- // Shows the widget immediately.
- void ShowNow();
-
- // Returns true if the widget is showing.
- bool IsShowing() const;
-
- // Initiates a resize.
- void StartResize(const gfx::Point& location_in_screen);
-
- // Resizes to the new location.
- void Resize(const gfx::Point& location_in_screen, int event_flags);
-
- // Completes the resize.
- void CompleteResize();
-
- // Cancels the resize.
- void CancelResize();
-
- // Returns the bounds for the resize widget.
- gfx::Rect CalculateResizeWidgetBounds(
- const gfx::Point& location_in_parent) const;
-
- // Returns true if |location_in_screen| is over the resize widget.
- bool IsOverResizeWidget(const gfx::Point& location_in_screen) const;
-
- // Returns true if |location_in_screen| is over the resize windows
- // (or the resize widget itself).
- bool IsOverWindows(const gfx::Point& location_in_screen) const;
-
- // Returns true if |location_in_screen| is over |component| in |window|.
- bool IsOverComponent(WmWindow* window,
- const gfx::Point& location_in_screen,
- int component) const;
-
- // Windows and direction to resize.
- ResizeWindows windows_;
-
- // Timer used before showing.
- base::OneShotTimer show_timer_;
-
- std::unique_ptr<views::Widget> resize_widget_;
-
- // If non-null we're in a resize loop.
- std::unique_ptr<WorkspaceWindowResizer> window_resizer_;
-
- // Mouse coordinate passed to Show() in container's coodinates.
- gfx::Point show_location_in_parent_;
-
- // Bounds the widget was last shown at in screen coordinates.
- gfx::Rect show_bounds_in_screen_;
-
- // Used to detect whether the mouse is over the windows. While
- // |resize_widget_| is non-NULL (ie the widget is showing) we ignore calls
- // to Show().
- std::unique_ptr<views::MouseWatcher> mouse_watcher_;
-
- DISALLOW_COPY_AND_ASSIGN(MultiWindowResizeController);
-};
-
-} // namespace ash
-
-#endif // ASH_COMMON_WM_WORKSPACE_MULTI_WINDOW_RESIZE_CONTROLLER_H_
« no previous file with comments | « ash/common/wm/workspace/magnetism_matcher.cc ('k') | ash/common/wm/workspace/multi_window_resize_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698