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

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

Issue 2885433003: VR: Implement Omnibox input targeting. (Closed)
Patch Set: 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..bc936a44cae4a2d3a31169f46d88ee3a8cff14f7 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,32 @@ 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(-1000, -1000));
cjgrant 2017/05/16 14:07:23 Were you okay with the numeric limits value? lowes
mthiesse 2017/05/16 18:11:02 Whoops missed this for the URL bar.
+}
+
+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 +89,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

Powered by Google App Engine
This is Rietveld 408576698