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

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

Issue 2913633002: [vr] Clicking on the security icon should prompt the user to bail out of VR (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 72dcf1c081b9628a2aace64da7ef94d1d12c7797..72f4a239aaaf3381fb21eae05e317cffeb7ba4a2 100644
--- a/chrome/browser/android/vr_shell/ui_elements/url_bar.cc
+++ b/chrome/browser/android/vr_shell/ui_elements/url_bar.cc
@@ -20,9 +20,13 @@ constexpr int64_t kUpdateDelayMS = 50;
} // namespace
UrlBar::UrlBar(int preferred_width,
+ const base::Callback<void()>& back_button_callback,
+ const base::Callback<void()>& security_icon_callback,
const base::Callback<void(UiUnsupportedMode)>& failure_callback)
: TexturedElement(preferred_width),
- texture_(base::MakeUnique<UrlBarTexture>(failure_callback)) {}
+ texture_(base::MakeUnique<UrlBarTexture>(failure_callback)),
+ back_button_callback_(back_button_callback),
+ security_icon_callback_(security_icon_callback) {}
UrlBar::~UrlBar() = default;
@@ -59,6 +63,9 @@ void UrlBar::OnButtonUp(const gfx::PointF& position) {
OnStateUpdated(position);
if (texture_->HitsBackButton(position))
back_button_callback_.Run();
+ if (texture_->HitsSecurityIcon(position)) {
cjgrant 2017/06/02 04:16:36 Same comment as earlier on down/up on the button.
+ security_icon_callback_.Run();
+ }
}
bool UrlBar::HitTest(const gfx::PointF& position) const {
@@ -91,10 +98,6 @@ void UrlBar::SetSecurityLevel(security_state::SecurityLevel level) {
texture_->SetSecurityLevel(level);
}
-void UrlBar::SetBackButtonCallback(const base::Callback<void()>& callback) {
- back_button_callback_ = callback;
-}
-
void UrlBar::OnStateUpdated(const gfx::PointF& position) {
const bool hovered = texture_->HitsBackButton(position);
const bool pressed = hovered ? down_ : false;

Powered by Google App Engine
This is Rietveld 408576698