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

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

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 #include "chrome/browser/android/vr_shell/ui_elements/url_bar.h" 5 #include "chrome/browser/android/vr_shell/ui_elements/url_bar.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "chrome/browser/android/vr_shell/textures/url_bar_texture.h" 8 #include "chrome/browser/android/vr_shell/textures/url_bar_texture.h"
9 9
10 namespace vr_shell { 10 namespace vr_shell {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 if (delta_ms > kUpdateDelayMS) 81 if (delta_ms > kUpdateDelayMS)
82 UpdateTexture(); 82 UpdateTexture();
83 } 83 }
84 } 84 }
85 85
86 void UrlBar::SetEnabled(bool enabled) { 86 void UrlBar::SetEnabled(bool enabled) {
87 enabled_ = enabled; 87 enabled_ = enabled;
88 set_visible(enabled); 88 set_visible(enabled);
89 } 89 }
90 90
91 void UrlBar::SetURL(const GURL& gurl) { 91 void UrlBar::SetToolbarState(const ToolbarState& state) {
92 texture_->SetURL(gurl); 92 texture_->SetToolbarState(state);
93 } 93 }
94 94
95 void UrlBar::SetHistoryButtonsEnabled(bool can_go_back) { 95 void UrlBar::SetHistoryButtonsEnabled(bool can_go_back) {
96 can_go_back_ = can_go_back; 96 can_go_back_ = can_go_back;
97 texture_->SetHistoryButtonsEnabled(can_go_back_); 97 texture_->SetHistoryButtonsEnabled(can_go_back_);
98 } 98 }
99 99
100 void UrlBar::SetSecurityInfo(security_state::SecurityLevel level,
101 bool malware) {
102 texture_->SetSecurityInfo(level, malware);
103 }
104
105 void UrlBar::OnStateUpdated(const gfx::PointF& position) { 100 void UrlBar::OnStateUpdated(const gfx::PointF& position) {
106 const bool hovered = texture_->HitsBackButton(position); 101 const bool hovered = texture_->HitsBackButton(position);
107 const bool pressed = hovered ? down_ : false; 102 const bool pressed = hovered ? down_ : false;
108 103
109 texture_->SetBackButtonHovered(hovered); 104 texture_->SetBackButtonHovered(hovered);
110 texture_->SetBackButtonPressed(pressed); 105 texture_->SetBackButtonPressed(pressed);
111 UpdateTexture(); 106 UpdateTexture();
112 } 107 }
113 108
114 } // namespace vr_shell 109 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/ui_elements/url_bar.h ('k') | chrome/browser/android/vr_shell/ui_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698