1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48

ash / wm / default_window_resizer.h [blame]

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_WM_DEFAULT_WINDOW_RESIZER_H_
#define ASH_WM_DEFAULT_WINDOW_RESIZER_H_

#include <memory>

#include "ash/ash_export.h"
#include "ash/wm/window_resizer.h"
#include "ui/compositor/presentation_time_recorder.h"

namespace ash {

// WindowResizer is used by ToplevelWindowEventHandler to handle dragging,
// moving or resizing a window. All coordinates passed to this are in the parent
// windows coordinates.
class ASH_EXPORT DefaultWindowResizer : public WindowResizer {
 public:
  ~DefaultWindowResizer() override;

  // Creates a new DefaultWindowResizer.
  static std::unique_ptr<DefaultWindowResizer> Create(
      WindowState* window_state);

  // WindowResizer:
  void Drag(const gfx::PointF& location, int event_flags) override;
  void CompleteDrag() override;
  void RevertDrag() override;
  void FlingOrSwipe(ui::GestureEvent* event) override;

 private:
  explicit DefaultWindowResizer(WindowState* window_state);
  DefaultWindowResizer(const DefaultWindowResizer&) = delete;
  DefaultWindowResizer& operator=(const DefaultWindowResizer&) = delete;

  // Set to true once Drag() is invoked and the bounds of the window change.
  bool did_move_or_resize_ = false;

  // Presentation time recorder for resizing a specific window.
  // The name of the histogram is set via a property on the window.
  std::unique_ptr<ui::PresentationTimeRecorder> window_resize_recorder_;
};

}  // namespace ash

#endif  // ASH_WM_DEFAULT_WINDOW_RESIZER_H_