summaryrefslogtreecommitdiff
path: root/chromium/ui/wm/core/default_screen_position_client.h
blob: 5d643b570ea8c725a3add527ba352b38cf839838 (plain)
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
49
// Copyright 2014 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 UI_WM_CORE_DEFAULT_SCREEN_POSITION_CLIENT_H_
#define UI_WM_CORE_DEFAULT_SCREEN_POSITION_CLIENT_H_

#include "base/memory/raw_ptr.h"
#include "ui/aura/client/screen_position_client.h"
#include "ui/wm/core/wm_core_export.h"

namespace wm {

// Client that always offsets by the toplevel RootWindow of the passed
// in child NativeWidgetAura.
class WM_CORE_EXPORT DefaultScreenPositionClient
    : public aura::client::ScreenPositionClient {
 public:
  explicit DefaultScreenPositionClient(aura::Window* root_window);

  DefaultScreenPositionClient(const DefaultScreenPositionClient&) = delete;
  DefaultScreenPositionClient& operator=(const DefaultScreenPositionClient&) =
      delete;

  ~DefaultScreenPositionClient() override;

  // aura::client::ScreenPositionClient overrides:
  void ConvertPointToScreen(const aura::Window* window,
                            gfx::PointF* point) override;
  void ConvertPointFromScreen(const aura::Window* window,
                              gfx::PointF* point) override;
  void ConvertHostPointToScreen(aura::Window* window,
                                gfx::Point* point) override;
  void SetBounds(aura::Window* window,
                 const gfx::Rect& bounds,
                 const display::Display& display) override;

 protected:
  // aura::client::ScreenPositionClient:
  gfx::Point GetRootWindowOriginInScreen(
      const aura::Window* root_window) override;

 private:
  raw_ptr<aura::Window> root_window_;
};

}  // namespace wm

#endif  // UI_WM_CORE_DEFAULT_SCREEN_POSITION_CLIENT_H_