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

Side by Side 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: added tests + cjgrant's comments 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_EXIT_PROMPT_TEXTURE_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_EXIT_PROMPT_TEXTURE_H_
7
8 #include "base/macros.h"
9 #include "chrome/browser/android/vr_shell/textures/ui_texture.h"
10 #include "ui/gfx/geometry/rect_f.h"
11
12 namespace gfx {
13 class PointF;
14 } // namespace gfx
15
16 namespace vr_shell {
17
18 struct ColorScheme;
19
20 class ExitPromptTexture : public UiTexture {
21 public:
22 ExitPromptTexture();
23 ~ExitPromptTexture() override;
24 gfx::Size GetPreferredTextureSize(int width) const override;
25 gfx::SizeF GetDrawnSize() const override;
26
27 void SetPrimaryButtonHovered(bool hovered);
28 void SetPrimaryButtonPressed(bool pressed);
29 void SetSecondaryButtonHovered(bool hovered);
30 void SetSecondaryButtonPressed(bool pressed);
31
32 virtual bool HitsSecondaryButton(const gfx::PointF& position) const;
33 virtual bool HitsPrimaryButton(const gfx::PointF& position) const;
34
35 private:
36 void Draw(SkCanvas* sk_canvas, const gfx::Size& texture_size) override;
37
38 SkColor GetButtonColor(bool primary) const;
39 float ToPixels(float meters) const;
40 gfx::PointF PercentToPixels(const gfx::PointF& percent) const;
41 const ColorScheme& color_scheme() const;
42
43 gfx::RectF secondary_button_rect_;
44 gfx::RectF primary_button_rect_;
45 gfx::SizeF size_;
46
47 bool primary_hovered_ = false;
48 bool primary_pressed_ = false;
49 bool secondary_hovered_ = false;
50 bool secondary_pressed_ = false;
51
52 DISALLOW_COPY_AND_ASSIGN(ExitPromptTexture);
53 };
54
55 } // namespace vr_shell
56
57 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_EXIT_PROMPT_TEXTURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698