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

Unified Diff: chrome/browser/android/vr_shell/ui_elements/url_bar.cc

Issue 2885433003: VR: Implement Omnibox input targeting. (Closed)
Patch Set: rebase Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/vr_shell/ui_elements/url_bar.cc
diff --git a/chrome/browser/android/vr_shell/ui_elements/url_bar.cc b/chrome/browser/android/vr_shell/ui_elements/url_bar.cc
index 8bca9056fdc2ff98c1f8fb588d7e1d5cf61b2873..686c0388d7c2718504f2033bedaeb5a4895f5c3e 100644
--- a/chrome/browser/android/vr_shell/ui_elements/url_bar.cc
+++ b/chrome/browser/android/vr_shell/ui_elements/url_bar.cc
@@ -35,19 +35,33 @@ UiTexture* UrlBar::GetTexture() const {
}
void UrlBar::OnHoverEnter(const gfx::PointF& position) {
- if (!texture_->SetDrawFlags(UrlBarTexture::FLAG_HOVER))
- return;
- UpdateTexture();
+ OnStateUpdated(position);
}
void UrlBar::OnHoverLeave() {
- if (!texture_->SetDrawFlags(0))
- return;
- UpdateTexture();
+ OnStateUpdated(gfx::PointF(std::numeric_limits<float>::max(),
+ std::numeric_limits<float>::max()));
+}
+
+void UrlBar::OnMove(const gfx::PointF& position) {
+ OnStateUpdated(position);
+}
+
+void UrlBar::OnButtonDown(const gfx::PointF& position) {
+ if (texture_->HitsBackButton(position))
+ down_ = true;
+ OnStateUpdated(position);
}
void UrlBar::OnButtonUp(const gfx::PointF& position) {
- back_button_callback_.Run();
+ down_ = false;
+ OnStateUpdated(position);
+ if (texture_->HitsBackButton(position))
+ back_button_callback_.Run();
+}
+
+bool UrlBar::HitTest(const gfx::PointF& position) const {
+ return texture_->HitsUrlBar(position) || texture_->HitsBackButton(position);
}
void UrlBar::OnBeginFrame(const base::TimeTicks& begin_frame_time) {
@@ -76,4 +90,15 @@ void UrlBar::SetBackButtonCallback(const base::Callback<void()>& callback) {
back_button_callback_ = callback;
}
+void UrlBar::OnStateUpdated(const gfx::PointF& position) {
+ bool hitting = texture_->HitsBackButton(position);
+ bool down = hitting ? down_ : false;
+
+ int flags = hitting ? UrlBarTexture::FLAG_BACK_HOVER : 0;
+ flags |= down ? UrlBarTexture::FLAG_BACK_DOWN : 0;
+ if (!texture_->SetDrawFlags(flags))
+ return;
+ UpdateTexture();
+}
+
} // namespace vr_shell
« no previous file with comments | « chrome/browser/android/vr_shell/ui_elements/url_bar.h ('k') | chrome/browser/android/vr_shell/ui_scene_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698