Upstream version 7.35.144.0
[platform/framework/web/crosswalk.git] / src / ui / gl / gl_surface_nsview.h
1 // Copyright (c) 2012 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_GL_GL_SURFACE_NSVIEW_H_
6 #define UI_GL_GL_SURFACE_NSVIEW_H_
7
8 #include "base/compiler_specific.h"
9 #include "ui/gfx/size.h"
10 #include "ui/gl/gl_surface.h"
11
12 namespace gfx {
13
14 class GLContextNSView;
15
16 // GLSurfaceNSView provides an implementation of the the GLSurface interface
17 // that is backed by an NSView.  This interface pairs with the GLContextNSView
18 // class, and the NSView is expected to use this context for drawing.
19 class GL_EXPORT GLSurfaceNSView : public GLSurface {
20  public:
21   explicit GLSurfaceNSView(AcceleratedWidget view);
22
23   // GLSurface:
24   virtual void Destroy() OVERRIDE;
25   virtual bool IsOffscreen() OVERRIDE;
26   virtual bool SwapBuffers() OVERRIDE;
27   virtual gfx::Size GetSize() OVERRIDE;
28   virtual void* GetHandle() OVERRIDE;
29
30   // Allow the surface to call back to context when in need of |FlushBuffer|.
31   virtual bool OnMakeCurrent(GLContext* context) OVERRIDE;
32
33  private:
34   virtual ~GLSurfaceNSView();
35
36   // Weak.  An |NSView*|.
37   AcceleratedWidget view_;
38
39   // Weak.  Associated context.
40   GLContextNSView* context_;
41
42   DISALLOW_COPY_AND_ASSIGN(GLSurfaceNSView);
43 };
44
45 }  // namespace gfx
46
47 #endif  // UI_GL_GL_SURFACE_NSVIEW_H_