| 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_UI_ELEMENTS_URL_BAR_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_URL_BAR_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_URL_BAR_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_URL_BAR_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "chrome/browser/android/vr_shell/ui_elements/textured_element.h" | 13 #include "chrome/browser/android/vr_shell/ui_elements/textured_element.h" |
| 14 #include "components/security_state/core/security_state.h" |
| 14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 15 | 16 |
| 16 namespace vr_shell { | 17 namespace vr_shell { |
| 17 | 18 |
| 18 class UrlBarTexture; | 19 class UrlBarTexture; |
| 19 | 20 |
| 20 class UrlBar : public TexturedElement { | 21 class UrlBar : public TexturedElement { |
| 21 public: | 22 public: |
| 22 explicit UrlBar(int preferred_width); | 23 explicit UrlBar(int preferred_width); |
| 23 ~UrlBar() override; | 24 ~UrlBar() override; |
| 24 | 25 |
| 25 void OnHoverEnter(const gfx::PointF& position) override; | 26 void OnHoverEnter(const gfx::PointF& position) override; |
| 26 void OnHoverLeave() override; | 27 void OnHoverLeave() override; |
| 27 void OnMove(const gfx::PointF& position) override; | 28 void OnMove(const gfx::PointF& position) override; |
| 28 void OnButtonDown(const gfx::PointF& position) override; | 29 void OnButtonDown(const gfx::PointF& position) override; |
| 29 void OnButtonUp(const gfx::PointF& position) override; | 30 void OnButtonUp(const gfx::PointF& position) override; |
| 30 bool HitTest(const gfx::PointF& point) const override; | 31 bool HitTest(const gfx::PointF& point) const override; |
| 31 | 32 |
| 32 void OnBeginFrame(const base::TimeTicks& begin_frame_time) override; | 33 void OnBeginFrame(const base::TimeTicks& begin_frame_time) override; |
| 33 void SetEnabled(bool enabled) override; | 34 void SetEnabled(bool enabled) override; |
| 34 | 35 |
| 35 void SetURL(const GURL& gurl); | 36 void SetURL(const GURL& gurl); |
| 36 void SetSecurityLevel(int level); | 37 void SetSecurityLevel(security_state::SecurityLevel level); |
| 37 void SetBackButtonCallback(const base::Callback<void()>& callback); | 38 void SetBackButtonCallback(const base::Callback<void()>& callback); |
| 38 | 39 |
| 39 private: | 40 private: |
| 40 void UpdateTexture() override; | 41 void UpdateTexture() override; |
| 41 UiTexture* GetTexture() const override; | 42 UiTexture* GetTexture() const override; |
| 42 void OnStateUpdated(const gfx::PointF& position); | 43 void OnStateUpdated(const gfx::PointF& position); |
| 43 | 44 |
| 44 std::unique_ptr<UrlBarTexture> texture_; | 45 std::unique_ptr<UrlBarTexture> texture_; |
| 45 base::Callback<void()> back_button_callback_; | 46 base::Callback<void()> back_button_callback_; |
| 46 bool enabled_ = false; | 47 bool enabled_ = false; |
| 47 bool down_ = false; | 48 bool down_ = false; |
| 48 base::TimeTicks last_begin_frame_time_; | 49 base::TimeTicks last_begin_frame_time_; |
| 49 base::TimeTicks last_update_time_; | 50 base::TimeTicks last_update_time_; |
| 50 | 51 |
| 51 DISALLOW_COPY_AND_ASSIGN(UrlBar); | 52 DISALLOW_COPY_AND_ASSIGN(UrlBar); |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 } // namespace vr_shell | 55 } // namespace vr_shell |
| 55 | 56 |
| 56 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_URL_BAR_H_ | 57 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_URL_BAR_H_ |
| OLD | NEW |