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

Unified Diff: chrome/browser/android/vr_shell/textures/url_bar_texture.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/textures/url_bar_texture.cc
diff --git a/chrome/browser/android/vr_shell/textures/url_bar_texture.cc b/chrome/browser/android/vr_shell/textures/url_bar_texture.cc
index b47429b79ab32d76b9ebe5b23018fd3a1be5ca9f..d3dd58fcfd57bba2dc9df1cfe975c9791a914f17 100644
--- a/chrome/browser/android/vr_shell/textures/url_bar_texture.cc
+++ b/chrome/browser/android/vr_shell/textures/url_bar_texture.cc
@@ -135,6 +135,20 @@ bool UrlBarTexture::HitsUrlBar(const gfx::PointF& position) const {
return rect.Contains(meters) && !HitsTransparentRegion(meters, false);
}
+gfx::PointF UrlBarTexture::security_icon_position() const {
+ float x = kBackButtonWidth + kSeparatorWidth + kSecurityFieldWidth / 2 -
+ kSecurityIconHeight / 2;
+ float y = kHeight / 2 - kSecurityIconHeight / 2;
+ return gfx::PointF(x, y);
+}
+
+bool UrlBarTexture::HitsSecurityIcon(const gfx::PointF& position) const {
+ const gfx::PointF& meters = percentToMeters(position);
+ gfx::RectF rect(security_icon_position(),
+ gfx::SizeF(kSecurityIconHeight, kSecurityIconHeight));
+ return rect.Contains(meters);
+}
+
bool UrlBarTexture::HitsTransparentRegion(const gfx::PointF& meters,
bool left) const {
const float radius = kHeight / 2.0f;
@@ -219,10 +233,8 @@ void UrlBarTexture::Draw(SkCanvas* canvas, const gfx::Size& texture_size) {
// Site security state icon.
if (!gurl_.is_empty()) {
canvas->save();
- canvas->translate(
- kBackButtonWidth + kSeparatorWidth + kSecurityFieldWidth / 2,
- kHeight / 2);
- canvas->translate(-kSecurityIconHeight / 2, -kSecurityIconHeight / 2);
+ gfx::PointF icon_position = security_icon_position();
+ canvas->translate(icon_position.x(), icon_position.y());
const gfx::VectorIcon& icon = getSecurityIcon(security_level_);
icon_default_height = GetDefaultSizeOfVectorIcon(icon);
icon_scale = kSecurityIconHeight / icon_default_height;

Powered by Google App Engine
This is Rietveld 408576698