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

Unified Diff: mash/wm/frame/move_loop.h

Issue 2002243002: Gets mash to use WmToplevelWindowEventHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback Created 4 years, 7 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 | « mash/wm/frame/move_event_handler.cc ('k') | mash/wm/frame/move_loop.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mash/wm/frame/move_loop.h
diff --git a/mash/wm/frame/move_loop.h b/mash/wm/frame/move_loop.h
deleted file mode 100644
index 13e50f48650d4dc19e8f9a7a1b4dcd0c7e275032..0000000000000000000000000000000000000000
--- a/mash/wm/frame/move_loop.h
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright 2015 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 MASH_WM_FRAME_MOVE_LOOP_H_
-#define MASH_WM_FRAME_MOVE_LOOP_H_
-
-#include <stdint.h>
-
-#include <memory>
-
-#include "base/macros.h"
-#include "components/mus/public/cpp/window_observer.h"
-#include "components/mus/public/interfaces/input_events.mojom.h"
-#include "ui/gfx/geometry/point.h"
-#include "ui/gfx/geometry/rect.h"
-
-namespace ui {
-class PointerEvent;
-}
-
-namespace mash {
-namespace wm {
-
-// MoveLoop is responsible for moving/resizing windows.
-class MoveLoop : public mus::WindowObserver {
- public:
- enum MoveResult {
- // The move is still ongoing.
- CONTINUE,
-
- // The move is done and the MoveLoop should be destroyed.
- DONE,
- };
-
- enum class HorizontalLocation {
- LEFT,
- RIGHT,
- OTHER,
- };
-
- enum class VerticalLocation {
- TOP,
- BOTTOM,
- OTHER,
- };
-
- ~MoveLoop() override;
-
- // If a move/resize loop should occur for the specified parameters creates
- // and returns a new MoveLoop. All events should be funneled to the MoveLoop
- // until done (Move()). |ht_location| is one of the constants defined by
- // HitTestCompat.
- static std::unique_ptr<MoveLoop> Create(mus::Window* target,
- int ht_location,
- const ui::PointerEvent& event);
-
- // Processes an event for a move/resize loop.
- MoveResult Move(const ui::PointerEvent& event);
-
- // If possible reverts any changes made during the move loop.
- void Revert();
-
- private:
- enum class Type {
- MOVE,
- RESIZE,
- };
-
- MoveLoop(mus::Window* target,
- const ui::PointerEvent& event,
- Type type,
- HorizontalLocation h_loc,
- VerticalLocation v_loc);
-
- // Determines the type of move from the specified HitTestCompat value.
- // Returns true if a move/resize should occur.
- static bool DetermineType(int ht_location,
- Type* type,
- HorizontalLocation* h_loc,
- VerticalLocation* v_loc);
-
- // Does the actual move/resize.
- void MoveImpl(const ui::PointerEvent& event);
-
- // Cancels the loop. This sets |target_| to null and removes the observer.
- // After this the MoveLoop is still ongoing and won't stop until the
- // appropriate event is received.
- void Cancel();
-
- gfx::Rect DetermineBoundsFromDelta(const gfx::Vector2d& delta);
-
- // mus::WindowObserver:
- void OnTreeChanged(const TreeChangeParams& params) override;
- void OnWindowBoundsChanged(mus::Window* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) override;
- void OnWindowVisibilityChanged(mus::Window* window) override;
-
- // The window this MoveLoop is acting on. |target_| is set to null if the
- // window unexpectedly changes while the move is in progress.
- mus::Window* target_;
-
- const Type type_;
- const HorizontalLocation h_loc_;
- const VerticalLocation v_loc_;
-
- // The id of the pointer that triggered the move.
- const int32_t pointer_id_;
-
- // Location of the event (in screen coordinates) that triggered the move.
- const gfx::Point initial_event_screen_location_;
-
- // Original bounds of the window.
- const gfx::Rect initial_window_bounds_;
-
- const gfx::Rect initial_user_set_bounds_;
-
- // Set to true when MoveLoop changes the bounds of |target_|. The move is
- // canceled if the bounds change unexpectedly during the move.
- bool changing_bounds_;
-
- DISALLOW_COPY_AND_ASSIGN(MoveLoop);
-};
-
-} // namespace wm
-} // namespace mash
-
-#endif // MASH_WM_FRAME_MOVE_LOOP_H_
« no previous file with comments | « mash/wm/frame/move_event_handler.cc ('k') | mash/wm/frame/move_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698