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

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: rebase Created 3 years, 6 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
« no previous file with comments | « chrome/browser/android/vr_shell/ui_elements/url_bar.h ('k') | chrome/browser/android/vr_shell/ui_scene.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 34ab35382876eac9b62a4b50d5d6972f568548c7..87fe7867dc05635ed015919ebdf304552d31fd7c 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;
@@ -51,6 +55,8 @@ void UrlBar::OnMove(const gfx::PointF& position) {
void UrlBar::OnButtonDown(const gfx::PointF& position) {
if (texture_->HitsBackButton(position))
down_ = true;
+ else if (texture_->HitsSecurityIcon(position))
+ security_icon_down_ = true;
OnStateUpdated(position);
}
@@ -59,6 +65,9 @@ void UrlBar::OnButtonUp(const gfx::PointF& position) {
OnStateUpdated(position);
if (can_go_back_ && texture_->HitsBackButton(position))
back_button_callback_.Run();
+ else if (security_icon_down_ && texture_->HitsSecurityIcon(position))
+ security_icon_callback_.Run();
+ security_icon_down_ = false;
}
bool UrlBar::HitTest(const gfx::PointF& position) const {
@@ -92,10 +101,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;
« no previous file with comments | « chrome/browser/android/vr_shell/ui_elements/url_bar.h ('k') | chrome/browser/android/vr_shell/ui_scene.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698