Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: chrome/browser/android/vr_shell/ui_elements/url_bar.h

Issue 2960903002: VR: Use ToolbarModel to drive VR URL bar state. (Closed)
Patch Set: Update toolbar build file to include vector icons for Android. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/android/vr_shell/ui_unsupported_mode.h" 14 #include "chrome/browser/android/vr_shell/ui_unsupported_mode.h"
15 #include "components/security_state/core/security_state.h" 15 #include "components/security_state/core/security_state.h"
16 #include "url/gurl.h" 16 #include "url/gurl.h"
17 17
18 namespace vr_shell { 18 namespace vr_shell {
19 19
20 class UrlBarTexture; 20 class UrlBarTexture;
21 struct ToolbarState;
21 22
22 class UrlBar : public TexturedElement { 23 class UrlBar : public TexturedElement {
23 public: 24 public:
24 UrlBar(int preferred_width, 25 UrlBar(int preferred_width,
25 const base::Callback<void()>& back_button_callback, 26 const base::Callback<void()>& back_button_callback,
26 const base::Callback<void()>& security_icon_callback, 27 const base::Callback<void()>& security_icon_callback,
27 const base::Callback<void(UiUnsupportedMode)>& failure_callback); 28 const base::Callback<void(UiUnsupportedMode)>& failure_callback);
28 ~UrlBar() override; 29 ~UrlBar() override;
29 30
30 void OnHoverEnter(const gfx::PointF& position) override; 31 void OnHoverEnter(const gfx::PointF& position) override;
31 void OnHoverLeave() override; 32 void OnHoverLeave() override;
32 void OnMove(const gfx::PointF& position) override; 33 void OnMove(const gfx::PointF& position) override;
33 void OnButtonDown(const gfx::PointF& position) override; 34 void OnButtonDown(const gfx::PointF& position) override;
34 void OnButtonUp(const gfx::PointF& position) override; 35 void OnButtonUp(const gfx::PointF& position) override;
35 bool HitTest(const gfx::PointF& point) const override; 36 bool HitTest(const gfx::PointF& point) const override;
36 37
37 void OnBeginFrame(const base::TimeTicks& begin_frame_time) override; 38 void OnBeginFrame(const base::TimeTicks& begin_frame_time) override;
38 void SetEnabled(bool enabled) override; 39 void SetEnabled(bool enabled) override;
39 40
40 void SetHistoryButtonsEnabled(bool can_go_back); 41 void SetHistoryButtonsEnabled(bool can_go_back);
41 void SetURL(const GURL& gurl); 42 void SetToolbarState(const ToolbarState& state);
42 void SetSecurityInfo(security_state::SecurityLevel level, bool malware);
43 43
44 private: 44 private:
45 void UpdateTexture() override; 45 void UpdateTexture() override;
46 UiTexture* GetTexture() const override; 46 UiTexture* GetTexture() const override;
47 void OnStateUpdated(const gfx::PointF& position); 47 void OnStateUpdated(const gfx::PointF& position);
48 48
49 std::unique_ptr<UrlBarTexture> texture_; 49 std::unique_ptr<UrlBarTexture> texture_;
50 base::Callback<void()> back_button_callback_; 50 base::Callback<void()> back_button_callback_;
51 base::Callback<void()> security_icon_callback_; 51 base::Callback<void()> security_icon_callback_;
52 bool enabled_ = false; 52 bool enabled_ = false;
53 bool can_go_back_ = false; 53 bool can_go_back_ = false;
54 bool down_ = false; 54 bool down_ = false;
55 bool security_region_down_ = false; 55 bool security_region_down_ = false;
56 base::TimeTicks last_begin_frame_time_; 56 base::TimeTicks last_begin_frame_time_;
57 base::TimeTicks last_update_time_; 57 base::TimeTicks last_update_time_;
58 58
59 DISALLOW_COPY_AND_ASSIGN(UrlBar); 59 DISALLOW_COPY_AND_ASSIGN(UrlBar);
60 }; 60 };
61 61
62 } // namespace vr_shell 62 } // namespace vr_shell
63 63
64 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_URL_BAR_H_ 64 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_URL_BAR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698