| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 void UrlBar::UpdateTexture() { | 28 void UrlBar::UpdateTexture() { |
| 29 TexturedElement::UpdateTexture(); | 29 TexturedElement::UpdateTexture(); |
| 30 last_update_time_ = last_begin_frame_time_; | 30 last_update_time_ = last_begin_frame_time_; |
| 31 } | 31 } |
| 32 | 32 |
| 33 UiTexture* UrlBar::GetTexture() const { | 33 UiTexture* UrlBar::GetTexture() const { |
| 34 return texture_.get(); | 34 return texture_.get(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void UrlBar::OnHoverEnter(gfx::PointF position) { | 37 void UrlBar::OnHoverEnter(const gfx::PointF& position) { |
| 38 if (!texture_->SetDrawFlags(UrlBarTexture::FLAG_HOVER)) | 38 if (!texture_->SetDrawFlags(UrlBarTexture::FLAG_HOVER)) |
| 39 return; | 39 return; |
| 40 UpdateTexture(); | 40 UpdateTexture(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void UrlBar::OnHoverLeave() { | 43 void UrlBar::OnHoverLeave() { |
| 44 if (!texture_->SetDrawFlags(0)) | 44 if (!texture_->SetDrawFlags(0)) |
| 45 return; | 45 return; |
| 46 UpdateTexture(); | 46 UpdateTexture(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void UrlBar::OnButtonUp(gfx::PointF position) { | 49 void UrlBar::OnButtonUp(const gfx::PointF& position) { |
| 50 back_button_callback_.Run(); | 50 back_button_callback_.Run(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void UrlBar::OnBeginFrame(const base::TimeTicks& begin_frame_time) { | 53 void UrlBar::OnBeginFrame(const base::TimeTicks& begin_frame_time) { |
| 54 last_begin_frame_time_ = begin_frame_time; | 54 last_begin_frame_time_ = begin_frame_time; |
| 55 if (enabled_ && texture_->dirty()) { | 55 if (enabled_ && texture_->dirty()) { |
| 56 int64_t delta_ms = (begin_frame_time - last_update_time_).InMilliseconds(); | 56 int64_t delta_ms = (begin_frame_time - last_update_time_).InMilliseconds(); |
| 57 if (delta_ms > kUpdateDelayMS) | 57 if (delta_ms > kUpdateDelayMS) |
| 58 UpdateTexture(); | 58 UpdateTexture(); |
| 59 } | 59 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 70 | 70 |
| 71 void UrlBar::SetSecurityLevel(int level) { | 71 void UrlBar::SetSecurityLevel(int level) { |
| 72 texture_->SetSecurityLevel(level); | 72 texture_->SetSecurityLevel(level); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void UrlBar::SetBackButtonCallback(const base::Callback<void()>& callback) { | 75 void UrlBar::SetBackButtonCallback(const base::Callback<void()>& callback) { |
| 76 back_button_callback_ = callback; | 76 back_button_callback_ = callback; |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace vr_shell | 79 } // namespace vr_shell |
| OLD | NEW |