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

Unified Diff: chrome/browser/android/vr_shell/textures/exit_prompt_texture.h

Issue 2913633002: [vr] Clicking on the security icon should prompt the user to bail out of VR (Closed)
Patch Set: rebase Created 3 years, 6 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
Index: chrome/browser/android/vr_shell/textures/exit_prompt_texture.h
diff --git a/chrome/browser/android/vr_shell/textures/exit_prompt_texture.h b/chrome/browser/android/vr_shell/textures/exit_prompt_texture.h
new file mode 100644
index 0000000000000000000000000000000000000000..8a64040297ad799b877ed73cdc70a70198764c3f
--- /dev/null
+++ b/chrome/browser/android/vr_shell/textures/exit_prompt_texture.h
@@ -0,0 +1,55 @@
+// Copyright 2017 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 CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_EXIT_PROMPT_TEXTURE_H_
+#define CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_EXIT_PROMPT_TEXTURE_H_
+
+#include "base/macros.h"
+#include "chrome/browser/android/vr_shell/textures/ui_texture.h"
+#include "ui/gfx/geometry/rect_f.h"
+
+namespace gfx {
+class PointF;
+} // namespace gfx
+
+namespace vr_shell {
+
+class ExitPromptTexture : public UiTexture {
+ public:
+ ExitPromptTexture();
+ ~ExitPromptTexture() override;
+ gfx::Size GetPreferredTextureSize(int width) const override;
+ gfx::SizeF GetDrawnSize() const override;
+
+ void SetPrimaryButtonHovered(bool hovered);
+ void SetPrimaryButtonPressed(bool pressed);
+ void SetSecondaryButtonHovered(bool hovered);
+ void SetSecondaryButtonPressed(bool pressed);
+
+ virtual bool HitsSecondaryButton(const gfx::PointF& position) const;
+ virtual bool HitsPrimaryButton(const gfx::PointF& position) const;
+
+ private:
+ void Draw(SkCanvas* sk_canvas, const gfx::Size& texture_size) override;
+
+ SkColor GetPrimaryButtonColor() const;
+ SkColor GetSecondaryButtonColor() const;
+ float ToPixels(float meters) const;
+ gfx::PointF PercentToPixels(const gfx::PointF& percent) const;
+
+ gfx::RectF secondary_button_rect_;
+ gfx::RectF primary_button_rect_;
+ gfx::SizeF size_;
+
+ bool primary_hovered_ = false;
+ bool primary_pressed_ = false;
+ bool secondary_hovered_ = false;
+ bool secondary_pressed_ = false;
+
+ DISALLOW_COPY_AND_ASSIGN(ExitPromptTexture);
+};
+
+} // namespace vr_shell
+
+#endif // CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_EXIT_PROMPT_TEXTURE_H_
« no previous file with comments | « chrome/browser/android/vr_shell/color_scheme.cc ('k') | chrome/browser/android/vr_shell/textures/exit_prompt_texture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698