| 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 #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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 void UrlBar::SetEnabled(bool enabled) { | 77 void UrlBar::SetEnabled(bool enabled) { |
| 78 enabled_ = enabled; | 78 enabled_ = enabled; |
| 79 set_visible(enabled); | 79 set_visible(enabled); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void UrlBar::SetURL(const GURL& gurl) { | 82 void UrlBar::SetURL(const GURL& gurl) { |
| 83 texture_->SetURL(gurl); | 83 texture_->SetURL(gurl); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void UrlBar::SetHistoryButtonsEnabled(bool can_go_back) { |
| 87 texture_->SetHistoryButtonsEnabled(can_go_back); |
| 88 } |
| 89 |
| 86 void UrlBar::SetSecurityLevel(security_state::SecurityLevel level) { | 90 void UrlBar::SetSecurityLevel(security_state::SecurityLevel level) { |
| 87 texture_->SetSecurityLevel(level); | 91 texture_->SetSecurityLevel(level); |
| 88 } | 92 } |
| 89 | 93 |
| 90 void UrlBar::SetBackButtonCallback(const base::Callback<void()>& callback) { | 94 void UrlBar::SetBackButtonCallback(const base::Callback<void()>& callback) { |
| 91 back_button_callback_ = callback; | 95 back_button_callback_ = callback; |
| 92 } | 96 } |
| 93 | 97 |
| 94 void UrlBar::OnStateUpdated(const gfx::PointF& position) { | 98 void UrlBar::OnStateUpdated(const gfx::PointF& position) { |
| 95 const bool hovered = texture_->HitsBackButton(position); | 99 const bool hovered = texture_->HitsBackButton(position); |
| 96 const bool pressed = hovered ? down_ : false; | 100 const bool pressed = hovered ? down_ : false; |
| 97 | 101 |
| 98 texture_->SetHovered(hovered); | 102 texture_->SetHovered(hovered); |
| 99 texture_->SetPressed(pressed); | 103 texture_->SetPressed(pressed); |
| 100 UpdateTexture(); | 104 UpdateTexture(); |
| 101 } | 105 } |
| 102 | 106 |
| 103 } // namespace vr_shell | 107 } // namespace vr_shell |
| OLD | NEW |