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