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

Side by Side Diff: chrome/browser/android/vr_shell/textures/url_bar_texture.h

Issue 2906403002: Disable back button when stack is empty (Closed)
Patch Set: nit 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
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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 CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_URL_BAR_TEXTURE_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_URL_BAR_TEXTURE_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_URL_BAR_TEXTURE_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_URL_BAR_TEXTURE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 21 matching lines...) Expand all
32 FLAG_BACK_DOWN = 1 << 1, 32 FLAG_BACK_DOWN = 1 << 1,
33 }; 33 };
34 34
35 explicit UrlBarTexture( 35 explicit UrlBarTexture(
36 const base::Callback<void(UiUnsupportedMode)>& failure_callback); 36 const base::Callback<void(UiUnsupportedMode)>& failure_callback);
37 ~UrlBarTexture() override; 37 ~UrlBarTexture() override;
38 gfx::Size GetPreferredTextureSize(int width) const override; 38 gfx::Size GetPreferredTextureSize(int width) const override;
39 gfx::SizeF GetDrawnSize() const override; 39 gfx::SizeF GetDrawnSize() const override;
40 40
41 void SetURL(const GURL& gurl); 41 void SetURL(const GURL& gurl);
42 void SetHistoryButtonsEnabled(bool can_go_back);
42 void SetSecurityLevel(security_state::SecurityLevel level); 43 void SetSecurityLevel(security_state::SecurityLevel level);
43 44
44 bool HitsBackButton(const gfx::PointF& position) const; 45 bool HitsBackButton(const gfx::PointF& position) const;
45 bool HitsUrlBar(const gfx::PointF& position) const; 46 bool HitsUrlBar(const gfx::PointF& position) const;
46 47
47 void SetHovered(bool hovered); 48 void SetHovered(bool hovered);
48 void SetPressed(bool pressed); 49 void SetPressed(bool pressed);
49 50
50 // Public for testability. 51 // Public for testability.
51 static void ApplyUrlStyling(const base::string16& formatted_url, 52 static void ApplyUrlStyling(const base::string16& formatted_url,
52 const url::Parsed& parsed, 53 const url::Parsed& parsed,
53 security_state::SecurityLevel security_level, 54 security_state::SecurityLevel security_level,
54 vr_shell::RenderTextWrapper* render_text, 55 vr_shell::RenderTextWrapper* render_text,
55 const ColorScheme& color_scheme); 56 const ColorScheme& color_scheme);
56 57
57 private: 58 private:
58 void Draw(SkCanvas* canvas, const gfx::Size& texture_size) override; 59 void Draw(SkCanvas* canvas, const gfx::Size& texture_size) override;
59 float ToPixels(float meters) const; 60 float ToPixels(float meters) const;
60 bool HitsTransparentRegion(const gfx::PointF& meters, bool left) const; 61 bool HitsTransparentRegion(const gfx::PointF& meters, bool left) const;
61 void RenderUrl(const gfx::Size& texture_size, const gfx::Rect& bounds); 62 void RenderUrl(const gfx::Size& texture_size, const gfx::Rect& bounds);
62 void OnSetMode() override; 63 void OnSetMode() override;
63 const ColorScheme& color_scheme() const; 64 const ColorScheme& color_scheme() const;
64 65
65 gfx::SizeF size_; 66 gfx::SizeF size_;
66 bool hovered_ = false; 67 bool hovered_ = false;
67 bool pressed_ = false; 68 bool pressed_ = false;
69 bool can_go_back_ = false;
68 70
69 GURL gurl_; 71 GURL gurl_;
70 security_state::SecurityLevel security_level_; 72 security_state::SecurityLevel security_level_;
71 73
72 std::unique_ptr<gfx::RenderText> url_render_text_; 74 std::unique_ptr<gfx::RenderText> url_render_text_;
73 GURL last_drawn_gurl_; 75 GURL last_drawn_gurl_;
74 security_state::SecurityLevel last_drawn_security_level_; 76 security_state::SecurityLevel last_drawn_security_level_;
75 base::Callback<void(UiUnsupportedMode)> failure_callback_; 77 base::Callback<void(UiUnsupportedMode)> failure_callback_;
76 78
77 DISALLOW_COPY_AND_ASSIGN(UrlBarTexture); 79 DISALLOW_COPY_AND_ASSIGN(UrlBarTexture);
78 }; 80 };
79 81
80 } // namespace vr_shell 82 } // namespace vr_shell
81 83
82 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_URL_BAR_TEXTURE_H_ 84 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_URL_BAR_TEXTURE_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/color_scheme.cc ('k') | chrome/browser/android/vr_shell/textures/url_bar_texture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698