Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: examples/ui/spinning_cube/spinning_cube_view.h

Issue 1559723002: Update the UI examples. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-14
Patch Set: address feedback Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « examples/ui/spinning_cube/spinning_cube_app.cc ('k') | examples/ui/spinning_cube/spinning_cube_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: examples/ui/spinning_cube/spinning_cube_view.h
diff --git a/examples/ui/spinning_cube/spinning_cube_view.h b/examples/ui/spinning_cube/spinning_cube_view.h
index 1a5b7fe0185870af56982c8e8234887865d6eca8..e65220c5b20c520054f429904ed842d20117a706 100644
--- a/examples/ui/spinning_cube/spinning_cube_view.h
+++ b/examples/ui/spinning_cube/spinning_cube_view.h
@@ -7,71 +7,48 @@
#include <memory>
-#include "base/bind.h"
-#include "base/memory/weak_ptr.h"
#include "examples/spinning_cube/spinning_cube.h"
-#include "mojo/gpu/gl_context.h"
-#include "mojo/gpu/gl_context_owner.h"
-#include "mojo/gpu/gl_texture.h"
-#include "mojo/gpu/texture_cache.h"
-#include "mojo/gpu/texture_uploader.h"
-#include "mojo/public/cpp/application/application_impl.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-#include "mojo/public/cpp/environment/environment.h"
-#include "mojo/public/cpp/system/core.h"
-#include "mojo/public/cpp/system/macros.h"
-#include "mojo/services/surfaces/interfaces/quads.mojom.h"
-#include "mojo/services/surfaces/interfaces/surfaces.mojom.h"
-#include "mojo/services/ui/views/interfaces/view_manager.mojom.h"
-#include "mojo/services/ui/views/interfaces/view_provider.mojom.h"
-#include "mojo/services/ui/views/interfaces/views.mojom.h"
+#include "mojo/ui/choreographer.h"
+#include "mojo/ui/gl_view.h"
+#include "mojo/ui/input_handler.h"
namespace examples {
-class SpinningCubeView : public mojo::ui::View {
+class SpinningCubeView : public mojo::ui::GLView,
+ public mojo::ui::ChoreographerDelegate,
+ public mojo::ui::InputListener {
public:
- SpinningCubeView(mojo::ApplicationImpl* app,
- const mojo::ui::ViewProvider::CreateViewCallback& callback);
+ SpinningCubeView(
+ mojo::ApplicationImpl* app_impl,
+ const mojo::ui::ViewProvider::CreateViewCallback& create_view_callback);
~SpinningCubeView() override;
private:
- // |View|:
+ // |GLView|:
void OnLayout(mojo::ui::ViewLayoutParamsPtr layout_params,
mojo::Array<uint32_t> children_needing_layout,
const OnLayoutCallback& callback) override;
- void OnChildUnavailable(uint32_t child_key,
- const OnChildUnavailableCallback& callback) override;
- void OnSurfaceIdNamespaceAvailable(uint32_t id_namespace);
+ // |ChoreographerDelegate|:
+ void OnDraw(const mojo::gfx::composition::FrameInfo& frame_info,
+ const base::TimeDelta& time_delta) override;
- void InitView();
+ // |InputListener|:
+ void OnEvent(mojo::EventPtr event, const OnEventCallback& callback) override;
- void InitCube();
- void DrawCube();
- void OnSurfaceSubmitted();
- void ScheduleDraw();
+ void DrawCubeWithGL();
- mojo::ui::ViewProvider::CreateViewCallback callback_;
- mojo::StrongBinding<mojo::ui::View> binding_;
-
- mojo::GLContextOwner context_owner_;
- mojo::ResourceReturnerPtr resource_returner_; // must be before texture cache
- mojo::TextureCache texture_cache_;
-
- mojo::SurfacePtr surfaces_;
- mojo::SurfaceIdPtr surface_id_;
- uint32_t surface_id_namespace_;
-
- mojo::ui::ViewManagerPtr view_manager_;
- mojo::ui::ViewHostPtr view_host_;
- mojo::ServiceProviderPtr view_service_provider_;
+ mojo::ui::Choreographer choreographer_;
+ mojo::ui::InputHandler input_handler_;
mojo::Size size_;
SpinningCube cube_;
- MojoTimeTicks last_draw_;
- bool draw_scheduled_;
+
+ mojo::PointF capture_point_;
+ mojo::PointF last_drag_point_;
+ MojoTimeTicks drag_start_time_ = 0u;
base::WeakPtrFactory<SpinningCubeView> weak_ptr_factory_;
« no previous file with comments | « examples/ui/spinning_cube/spinning_cube_app.cc ('k') | examples/ui/spinning_cube/spinning_cube_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698