Chromium Code Reviews| 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 |
| 11 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" | 11 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" |
| 12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class PointF; | |
| 15 class RenderText; | 16 class RenderText; |
| 16 } // namespace gfx | 17 } // namespace gfx |
| 17 | 18 |
| 18 namespace vr_shell { | 19 namespace vr_shell { |
| 19 | 20 |
| 20 class UrlBarTexture : public UiTexture { | 21 class UrlBarTexture : public UiTexture { |
| 21 public: | 22 public: |
| 22 enum DrawFlags { | 23 enum DrawFlags { |
| 23 FLAG_HOVER = 1 << 0, | 24 FLAG_BACK_HOVER = 1 << 0, |
| 25 FLAG_BACK_DOWN = 1 << 1, | |
| 24 }; | 26 }; |
| 25 | 27 |
| 26 UrlBarTexture(); | 28 UrlBarTexture(); |
| 27 ~UrlBarTexture() override; | 29 ~UrlBarTexture() override; |
| 28 gfx::Size GetPreferredTextureSize(int width) const override; | 30 gfx::Size GetPreferredTextureSize(int width) const override; |
| 29 gfx::SizeF GetDrawnSize() const override; | 31 gfx::SizeF GetDrawnSize() const override; |
| 30 bool SetDrawFlags(int draw_flags) override; | 32 bool SetDrawFlags(int draw_flags) override; |
| 31 | 33 |
| 32 void SetURL(const GURL& gurl); | 34 void SetURL(const GURL& gurl); |
| 33 void SetSecurityLevel(int level); | 35 void SetSecurityLevel(int level); |
| 34 | 36 |
| 37 bool HitsBackButton(const gfx::PointF& position) const; | |
| 38 bool HitsURLBar(const gfx::PointF& position) const; | |
|
cjgrant
2017/05/16 14:07:23
HitsUrlBar (matches style guide and class name)
mthiesse
2017/05/16 18:11:02
Done.
| |
| 39 | |
| 35 private: | 40 private: |
| 36 void Draw(SkCanvas* canvas, const gfx::Size& texture_size) override; | 41 void Draw(SkCanvas* canvas, const gfx::Size& texture_size) override; |
| 37 float ToPixels(float meters) const; | 42 float ToPixels(float meters) const; |
| 43 bool HitsRightTransparentRegion(const gfx::PointF& position) const; | |
| 38 | 44 |
| 39 gfx::SizeF size_; | 45 gfx::SizeF size_; |
| 40 int security_level_; | 46 int security_level_; |
| 41 GURL gurl_; | 47 GURL gurl_; |
| 42 GURL last_drawn_gurl_; | 48 GURL last_drawn_gurl_; |
| 43 std::vector<std::unique_ptr<gfx::RenderText>> gurl_render_texts_; | 49 std::vector<std::unique_ptr<gfx::RenderText>> gurl_render_texts_; |
| 44 }; | 50 }; |
| 45 | 51 |
| 46 } // namespace vr_shell | 52 } // namespace vr_shell |
| 47 | 53 |
| 48 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_URL_BAR_TEXTURE_H_ | 54 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_URL_BAR_TEXTURE_H_ |
| OLD | NEW |