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

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: 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
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 91a0665467f7c1eae0027bceb68c91a17a36389a..698f4a7ef56bdf2d43128e23bd095a4f68250246 100644
--- a/chrome/browser/android/vr_shell/textures/url_bar_texture.cc
+++ b/chrome/browser/android/vr_shell/textures/url_bar_texture.cc
@@ -142,6 +142,19 @@ bool UrlBarTexture::HitsUrlBar(const gfx::PointF& position) const {
return rect.Contains(meters) && !HitsTransparentRegion(meters, false);
}
+gfx::PointF UrlBarTexture::SecurityIconPositionMeters() 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 {
+ gfx::RectF rect(SecurityIconPositionMeters(),
+ gfx::SizeF(kSecurityIconHeight, kSecurityIconHeight));
+ return rect.Contains(percentToMeters(position));
+}
+
bool UrlBarTexture::HitsTransparentRegion(const gfx::PointF& meters,
bool left) const {
const float radius = kHeight / 2.0f;
@@ -222,10 +235,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 = SecurityIconPositionMeters();
+ 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;
« no previous file with comments | « chrome/browser/android/vr_shell/textures/url_bar_texture.h ('k') | chrome/browser/android/vr_shell/ui_elements/exit_prompt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698