summaryrefslogtreecommitdiffstats
path: root/content/browser/android/draw_delegate_impl.h
blob: 80c39c9351f3cedeef0984052379135fb0883713 (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
// Copyright (c) 2012 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 CONTENT_BROWSER_ANDROID_DRAW_DELEGATE_IMPL_H_
#define CONTENT_BROWSER_ANDROID_DRAW_DELEGATE_IMPL_H_

#include "base/callback.h"
#include "content/public/browser/android/draw_delegate.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/size.h"

namespace content {

class DrawDelegateImpl : public DrawDelegate {
 public:
  static DrawDelegateImpl* GetInstance();
  DrawDelegateImpl();
  virtual ~DrawDelegateImpl();

  // DrawDelegate implementation.
  virtual void SetUpdateCallback(
      const SurfaceUpdatedCallback& callback) OVERRIDE;
  virtual void SetBounds(const gfx::Size& size) OVERRIDE;

  void SetDrawSurface(gfx::GLSurfaceHandle handle) { handle_ = handle; }
  void OnSurfaceUpdated(uint64 texture, RenderWidgetHostView* view,
                        const SurfacePresentedCallback& present_callback);
  gfx::Size GetBounds() { return size_; }
  gfx::GLSurfaceHandle GetDrawSurface() { return handle_; }

 protected:
  SurfaceUpdatedCallback draw_callback_;
  gfx::GLSurfaceHandle handle_;
  gfx::Size size_;

  DISALLOW_COPY_AND_ASSIGN(DrawDelegateImpl);
};

}  // namespace content

#endif  // CONTENT_BROWSER_ANDROID_DRAW_DELEGATE_IMPL_H_