| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_UI_GL_VIEW_H_ | 5 #ifndef MOJO_UI_GL_VIEW_H_ |
| 6 #define MOJO_UI_GL_VIEW_H_ | 6 #define MOJO_UI_GL_VIEW_H_ |
| 7 | 7 |
| 8 #include "mojo/gpu/gl_context.h" | 8 #include "mojo/gpu/gl_context.h" |
| 9 #include "mojo/gpu/gl_context_owner.h" | 9 #include "mojo/gpu/gl_context_owner.h" |
| 10 #include "mojo/ui/base_view.h" | 10 #include "mojo/ui/base_view.h" |
| 11 #include "mojo/ui/gl_renderer.h" | 11 #include "mojo/ui/gl_renderer.h" |
| 12 | 12 |
| 13 namespace mojo { | 13 namespace mojo { |
| 14 namespace ui { | 14 namespace ui { |
| 15 | 15 |
| 16 // Abstract base implementation of the View interface for simple applications | 16 // Abstract base implementation of the View interface for simple applications |
| 17 // which use GL for rendering. Subclasses must handle layout and provide | 17 // which use GL for rendering. Subclasses must handle layout and provide |
| 18 // content for the scene. | 18 // content for the scene. |
| 19 class GLView : public BaseView { | 19 class GLView : public BaseView { |
| 20 public: | 20 public: |
| 21 GLView( | 21 GLView(mojo::ApplicationImpl* app_impl, |
| 22 mojo::ApplicationImpl* app_impl, | 22 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, |
| 23 const std::string& label, | 23 const std::string& label); |
| 24 const mojo::ui::ViewProvider::CreateViewCallback& create_view_callback); | |
| 25 | 24 |
| 26 ~GLView() override; | 25 ~GLView() override; |
| 27 | 26 |
| 28 // Gets the GL context, or null if none. | 27 // Gets the GL context, or null if none. |
| 29 const base::WeakPtr<mojo::GLContext>& gl_context() const { | 28 const base::WeakPtr<mojo::GLContext>& gl_context() const { |
| 30 return gl_context_owner_.context(); | 29 return gl_context_owner_.context(); |
| 31 } | 30 } |
| 32 | 31 |
| 33 // Gets the GL renderer. | 32 // Gets the GL renderer. |
| 34 mojo::ui::GLRenderer* gl_renderer() { return &gl_renderer_; } | 33 mojo::ui::GLRenderer* gl_renderer() { return &gl_renderer_; } |
| 35 | 34 |
| 36 private: | 35 private: |
| 37 mojo::GLContextOwner gl_context_owner_; | 36 mojo::GLContextOwner gl_context_owner_; |
| 38 mojo::ui::GLRenderer gl_renderer_; | 37 mojo::ui::GLRenderer gl_renderer_; |
| 39 | 38 |
| 40 MOJO_DISALLOW_COPY_AND_ASSIGN(GLView); | 39 MOJO_DISALLOW_COPY_AND_ASSIGN(GLView); |
| 41 }; | 40 }; |
| 42 | 41 |
| 43 } // namespace ui | 42 } // namespace ui |
| 44 } // namespace mojo | 43 } // namespace mojo |
| 45 | 44 |
| 46 #endif // MOJO_UI_GL_VIEW_H_ | 45 #endif // MOJO_UI_GL_VIEW_H_ |
| OLD | NEW |