Upstream version 11.40.271.0
[platform/framework/web/crosswalk.git] / src / ui / ozone / platform / dri / dri_gpu_platform_support.h
1 // Copyright 2014 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.
4
5 #ifndef UI_OZONE_PLATFORM_DRI_DRI_GPU_PLATFORM_SUPPORT_H_
6 #define UI_OZONE_PLATFORM_DRI_DRI_GPU_PLATFORM_SUPPORT_H_
7
8 #include "base/containers/scoped_ptr_hash_map.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/scoped_vector.h"
11 #include "ui/gfx/native_widget_types.h"
12 #include "ui/ozone/public/gpu_platform_support.h"
13
14 class SkBitmap;
15
16 namespace gfx {
17 class Point;
18 class Rect;
19 }
20
21 namespace ui {
22
23 class DriSurfaceFactory;
24 class DriWindowDelegate;
25 class DriWindowDelegateManager;
26 class NativeDisplayDelegateDri;
27 class ScreenManager;
28
29 struct DisplayMode_Params;
30 struct DisplaySnapshot_Params;
31
32 class DriGpuPlatformSupport : public GpuPlatformSupport {
33  public:
34   DriGpuPlatformSupport(DriSurfaceFactory* dri,
35                         DriWindowDelegateManager* window_manager,
36                         ScreenManager* screen_manager,
37                         scoped_ptr<NativeDisplayDelegateDri> ndd);
38   ~DriGpuPlatformSupport() override;
39
40   void AddHandler(scoped_ptr<GpuPlatformSupport> handler);
41
42   // GpuPlatformSupport:
43   void OnChannelEstablished(IPC::Sender* sender) override;
44
45   // IPC::Listener:
46   bool OnMessageReceived(const IPC::Message& message) override;
47
48  private:
49   void OnCreateWindowDelegate(gfx::AcceleratedWidget widget);
50   void OnDestroyWindowDelegate(gfx::AcceleratedWidget widget);
51   void OnWindowBoundsChanged(gfx::AcceleratedWidget widget,
52                              const gfx::Rect& bounds);
53   void OnCursorSet(gfx::AcceleratedWidget widget,
54                    const std::vector<SkBitmap>& bitmaps,
55                    const gfx::Point& location,
56                    int frame_delay_ms);
57   void OnCursorMove(gfx::AcceleratedWidget widget, const gfx::Point& location);
58
59   // Display related IPC handlers.
60   void OnForceDPMSOn();
61   void OnRefreshNativeDisplays(
62       const std::vector<DisplaySnapshot_Params>& cached_displays);
63   void OnConfigureNativeDisplay(int64_t id,
64                                 const DisplayMode_Params& mode,
65                                 const gfx::Point& origin);
66   void OnDisableNativeDisplay(int64_t id);
67   void OnTakeDisplayControl();
68   void OnRelinquishDisplayControl();
69
70   IPC::Sender* sender_;                       // Not owned.
71   DriSurfaceFactory* dri_;                    // Not owned.
72   DriWindowDelegateManager* window_manager_;  // Not owned.
73   ScreenManager* screen_manager_;             // Not owned.
74
75   scoped_ptr<NativeDisplayDelegateDri> ndd_;
76   ScopedVector<GpuPlatformSupport> handlers_;
77 };
78
79 }  // namespace ui
80
81 #endif  // UI_OZONE_PLATFORM_DRI_DRI_GPU_PLATFORM_SUPPORT_H_