| 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_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_BUTTON_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_BUTTON_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_BUTTON_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 "chrome/browser/android/vr_shell/ui_elements/textured_element.h" | 12 #include "chrome/browser/android/vr_shell/ui_elements/textured_element.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class PointF; | 15 class PointF; |
| 16 } // gfx | 16 } // gfx |
| 17 | 17 |
| 18 namespace vr_shell { | 18 namespace vr_shell { |
| 19 | 19 |
| 20 class ButtonTexture; | 20 class ButtonTexture; |
| 21 | 21 |
| 22 class Button : public TexturedElement { | 22 class Button : public TexturedElement { |
| 23 public: | 23 public: |
| 24 explicit Button(base::Callback<void()> click_handler, | 24 explicit Button(int id, |
| 25 base::Callback<void()> click_handler, |
| 25 std::unique_ptr<ButtonTexture> texture); | 26 std::unique_ptr<ButtonTexture> texture); |
| 26 ~Button() override; | 27 ~Button() override; |
| 27 | 28 |
| 28 void OnHoverLeave() override; | 29 void OnHoverLeave() override; |
| 29 void OnHoverEnter(const gfx::PointF& position) override; | 30 void OnHoverEnter(const gfx::PointF& position) override; |
| 30 void OnMove(const gfx::PointF& position) override; | 31 void OnMove(const gfx::PointF& position) override; |
| 31 void OnButtonDown(const gfx::PointF& position) override; | 32 void OnButtonDown(const gfx::PointF& position) override; |
| 32 void OnButtonUp(const gfx::PointF& position) override; | 33 void OnButtonUp(const gfx::PointF& position) override; |
| 33 bool HitTest(const gfx::PointF& point) const override; | 34 bool HitTest(const gfx::PointF& point) const override; |
| 34 | 35 |
| 35 private: | 36 private: |
| 36 UiTexture* GetTexture() const override; | 37 UiTexture* GetTexture() const override; |
| 37 void OnStateUpdated(const gfx::PointF& position); | 38 void OnStateUpdated(const gfx::PointF& position); |
| 38 | 39 |
| 39 std::unique_ptr<ButtonTexture> texture_; | 40 std::unique_ptr<ButtonTexture> texture_; |
| 40 bool down_ = false; | 41 bool down_ = false; |
| 41 base::Callback<void()> click_handler_; | 42 base::Callback<void()> click_handler_; |
| 42 | 43 |
| 43 DISALLOW_COPY_AND_ASSIGN(Button); | 44 DISALLOW_COPY_AND_ASSIGN(Button); |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 } // namespace vr_shell | 47 } // namespace vr_shell |
| 47 | 48 |
| 48 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_BUTTON_H_ | 49 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_BUTTON_H_ |
| OLD | NEW |