| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_GANESH_VIEW_H_ | 5 #ifndef MOJO_UI_GANESH_VIEW_H_ |
| 6 #define MOJO_UI_GANESH_VIEW_H_ | 6 #define MOJO_UI_GANESH_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/skia/ganesh_context.h" | 10 #include "mojo/skia/ganesh_context.h" |
| 11 #include "mojo/ui/base_view.h" | 11 #include "mojo/ui/base_view.h" |
| 12 #include "mojo/ui/ganesh_renderer.h" | 12 #include "mojo/ui/ganesh_renderer.h" |
| 13 | 13 |
| 14 class SkSurface; | 14 class SkSurface; |
| 15 | 15 |
| 16 namespace mojo { | 16 namespace mojo { |
| 17 namespace ui { | 17 namespace ui { |
| 18 | 18 |
| 19 // Abstract base implementation of the View interface for simple applications | 19 // Abstract base implementation of the View interface for simple applications |
| 20 // which use Ganesh for rendering. Subclasses must handle layout and provide | 20 // which use Ganesh for rendering. Subclasses must handle layout and provide |
| 21 // content for the scene. | 21 // content for the scene. |
| 22 class GaneshView : public BaseView { | 22 class GaneshView : public BaseView { |
| 23 public: | 23 public: |
| 24 GaneshView( | 24 GaneshView(mojo::ApplicationImpl* app_impl, |
| 25 mojo::ApplicationImpl* app_impl, | 25 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, |
| 26 const std::string& label, | 26 const std::string& label); |
| 27 const mojo::ui::ViewProvider::CreateViewCallback& create_view_callback); | |
| 28 | 27 |
| 29 ~GaneshView() override; | 28 ~GaneshView() override; |
| 30 | 29 |
| 31 // Gets the GL context, or null if none. | 30 // Gets the GL context, or null if none. |
| 32 const base::WeakPtr<mojo::GLContext>& gl_context() const { | 31 const base::WeakPtr<mojo::GLContext>& gl_context() const { |
| 33 return gl_context_owner_.context(); | 32 return gl_context_owner_.context(); |
| 34 } | 33 } |
| 35 | 34 |
| 36 // Gets the Ganesh context. | 35 // Gets the Ganesh context. |
| 37 mojo::skia::GaneshContext* ganesh_context() { return &ganesh_context_; } | 36 mojo::skia::GaneshContext* ganesh_context() { return &ganesh_context_; } |
| 38 | 37 |
| 39 // Gets the Ganesh renderer. | 38 // Gets the Ganesh renderer. |
| 40 mojo::ui::GaneshRenderer* ganesh_renderer() { return &ganesh_renderer_; } | 39 mojo::ui::GaneshRenderer* ganesh_renderer() { return &ganesh_renderer_; } |
| 41 | 40 |
| 42 private: | 41 private: |
| 43 mojo::GLContextOwner gl_context_owner_; | 42 mojo::GLContextOwner gl_context_owner_; |
| 44 mojo::skia::GaneshContext ganesh_context_; | 43 mojo::skia::GaneshContext ganesh_context_; |
| 45 mojo::ui::GaneshRenderer ganesh_renderer_; | 44 mojo::ui::GaneshRenderer ganesh_renderer_; |
| 46 | 45 |
| 47 DISALLOW_COPY_AND_ASSIGN(GaneshView); | 46 DISALLOW_COPY_AND_ASSIGN(GaneshView); |
| 48 }; | 47 }; |
| 49 | 48 |
| 50 } // namespace ui | 49 } // namespace ui |
| 51 } // namespace mojo | 50 } // namespace mojo |
| 52 | 51 |
| 53 #endif // MOJO_UI_GANESH_VIEW_H_ | 52 #endif // MOJO_UI_GANESH_VIEW_H_ |
| OLD | NEW |