| OLD | NEW |
| 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 26 matching lines...) Expand all Loading... |
| 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 SetHistoryButtonsEnabled(bool can_go_back); |
| 43 void SetSecurityLevel(security_state::SecurityLevel level); | 43 void SetSecurityLevel(security_state::SecurityLevel level); |
| 44 | 44 |
| 45 bool HitsBackButton(const gfx::PointF& position) const; | 45 bool HitsBackButton(const gfx::PointF& position) const; |
| 46 bool HitsUrlBar(const gfx::PointF& position) const; | 46 bool HitsUrlBar(const gfx::PointF& position) const; |
| 47 bool HitsSecurityIcon(const gfx::PointF& position) const; |
| 47 | 48 |
| 48 void SetHovered(bool hovered); | 49 void SetHovered(bool hovered); |
| 49 void SetPressed(bool pressed); | 50 void SetPressed(bool pressed); |
| 50 | 51 |
| 51 // Public for testability. | 52 // Public for testability. |
| 52 static void ApplyUrlStyling(const base::string16& formatted_url, | 53 static void ApplyUrlStyling(const base::string16& formatted_url, |
| 53 const url::Parsed& parsed, | 54 const url::Parsed& parsed, |
| 54 security_state::SecurityLevel security_level, | 55 security_state::SecurityLevel security_level, |
| 55 vr_shell::RenderTextWrapper* render_text, | 56 vr_shell::RenderTextWrapper* render_text, |
| 56 const ColorScheme& color_scheme); | 57 const ColorScheme& color_scheme); |
| 57 | 58 |
| 58 private: | 59 private: |
| 59 void Draw(SkCanvas* canvas, const gfx::Size& texture_size) override; | 60 void Draw(SkCanvas* canvas, const gfx::Size& texture_size) override; |
| 60 float ToPixels(float meters) const; | 61 float ToPixels(float meters) const; |
| 61 bool HitsTransparentRegion(const gfx::PointF& meters, bool left) const; | 62 bool HitsTransparentRegion(const gfx::PointF& meters, bool left) const; |
| 62 void RenderUrl(const gfx::Size& texture_size, const gfx::Rect& bounds); | 63 void RenderUrl(const gfx::Size& texture_size, const gfx::Rect& bounds); |
| 63 void OnSetMode() override; | 64 void OnSetMode() override; |
| 65 gfx::PointF SecurityIconPositionMeters() const; |
| 64 | 66 |
| 65 gfx::SizeF size_; | 67 gfx::SizeF size_; |
| 66 bool hovered_ = false; | 68 bool hovered_ = false; |
| 67 bool pressed_ = false; | 69 bool pressed_ = false; |
| 68 bool can_go_back_ = false; | 70 bool can_go_back_ = false; |
| 69 | 71 |
| 70 GURL gurl_; | 72 GURL gurl_; |
| 71 security_state::SecurityLevel security_level_; | 73 security_state::SecurityLevel security_level_; |
| 72 | 74 |
| 73 std::unique_ptr<gfx::RenderText> url_render_text_; | 75 std::unique_ptr<gfx::RenderText> url_render_text_; |
| 74 GURL last_drawn_gurl_; | 76 GURL last_drawn_gurl_; |
| 75 security_state::SecurityLevel last_drawn_security_level_; | 77 security_state::SecurityLevel last_drawn_security_level_; |
| 76 base::Callback<void(UiUnsupportedMode)> failure_callback_; | 78 base::Callback<void(UiUnsupportedMode)> failure_callback_; |
| 77 | 79 |
| 78 DISALLOW_COPY_AND_ASSIGN(UrlBarTexture); | 80 DISALLOW_COPY_AND_ASSIGN(UrlBarTexture); |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 } // namespace vr_shell | 83 } // namespace vr_shell |
| 82 | 84 |
| 83 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_URL_BAR_TEXTURE_H_ | 85 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_URL_BAR_TEXTURE_H_ |
| OLD | NEW |