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

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: . Created 3 years, 7 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..e94f4b1c8ff43531e372920dba4ed454d3a0e4f7
--- /dev/null
+++ b/chrome/browser/android/vr_shell/textures/exit_prompt_texture.h
@@ -0,0 +1,56 @@
+// 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 {
+
+struct ColorScheme;
+
+class ExitPromptTexture : public UiTexture {
+ public:
+ ExitPromptTexture();
+ ~ExitPromptTexture() override;
+ gfx::Size GetPreferredTextureSize(int width) const override;
+ gfx::SizeF GetDrawnSize() const override;
+
+ void SetPrimaryHovered(bool hovered);
cjgrant 2017/06/02 04:16:36 Maybe call these SetPrimaryButtonHovered, etc. to
ymalik 2017/06/02 21:14:31 Done.
+ void SetPrimaryPressed(bool pressed);
+ void SetSecondaryHovered(bool hovered);
+ void SetSecondaryPressed(bool pressed);
+
+ bool HitsSecondaryButton(const gfx::PointF& position) const;
+ bool HitsPrimaryButton(const gfx::PointF& position) const;
+
+ private:
+ void Draw(SkCanvas* sk_canvas, const gfx::Size& texture_size) override;
+
+ float ToPixels(float meters) const;
+ gfx::PointF percentToPixels(const gfx::PointF& percent) const;
+ const ColorScheme& color_scheme() 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_

Powered by Google App Engine
This is Rietveld 408576698