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.
5 #include "ui/ozone/platform/dri/gpu_platform_support_gbm.h"
7 #include "ipc/ipc_message_macros.h"
8 #include "ui/ozone/common/gpu/ozone_gpu_messages.h"
9 #include "ui/ozone/platform/dri/dri_surface_factory.h"
13 GpuPlatformSupportGbm::GpuPlatformSupportGbm(DriSurfaceFactory* dri)
14 : sender_(NULL), dri_(dri) {
17 GpuPlatformSupportGbm::~GpuPlatformSupportGbm() {}
19 void GpuPlatformSupportGbm::AddHandler(scoped_ptr<GpuPlatformSupport> handler) {
20 handlers_.push_back(handler.release());
23 void GpuPlatformSupportGbm::OnChannelEstablished(IPC::Sender* sender) {
26 for (size_t i = 0; i < handlers_.size(); ++i)
27 handlers_[i]->OnChannelEstablished(sender);
30 bool GpuPlatformSupportGbm::OnMessageReceived(const IPC::Message& message) {
33 IPC_BEGIN_MESSAGE_MAP(GpuPlatformSupportGbm, message)
34 IPC_MESSAGE_HANDLER(OzoneGpuMsg_CursorSet, OnCursorSet)
35 IPC_MESSAGE_HANDLER(OzoneGpuMsg_CursorMove, OnCursorMove)
36 IPC_MESSAGE_UNHANDLED(handled = false);
40 for (size_t i = 0; i < handlers_.size(); ++i)
41 if (handlers_[i]->OnMessageReceived(message))
47 void GpuPlatformSupportGbm::OnCursorSet(gfx::AcceleratedWidget widget,
48 const SkBitmap& bitmap,
49 const gfx::Point& location) {
50 dri_->SetHardwareCursor(widget, bitmap, location);
53 void GpuPlatformSupportGbm::OnCursorMove(gfx::AcceleratedWidget widget,
54 const gfx::Point& location) {
55 dri_->MoveHardwareCursor(widget, location);