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

Unified Diff: chrome/browser/android/vr_shell/textures/url_bar_texture.h

Issue 2902783002: VR: Add URL bar security-related coloring and emphasis. (Closed)
Patch Set: Another test case for HTTPS + not secure. 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.h
diff --git a/chrome/browser/android/vr_shell/textures/url_bar_texture.h b/chrome/browser/android/vr_shell/textures/url_bar_texture.h
index c6ebf975f196f75fa63d6693d17f01f197c58518..92e40f679864212f36e99f537d007a3828a5298a 100644
--- a/chrome/browser/android/vr_shell/textures/url_bar_texture.h
+++ b/chrome/browser/android/vr_shell/textures/url_bar_texture.h
@@ -10,6 +10,7 @@
#include "base/macros.h"
#include "chrome/browser/android/vr_shell/textures/ui_texture.h"
+#include "components/security_state/core/security_state.h"
#include "url/gurl.h"
namespace gfx {
@@ -19,6 +20,8 @@ class RenderText;
namespace vr_shell {
+class RenderTextWrapper;
+
class UrlBarTexture : public UiTexture {
public:
enum DrawFlags {
@@ -32,7 +35,7 @@ class UrlBarTexture : public UiTexture {
gfx::SizeF GetDrawnSize() const override;
void SetURL(const GURL& gurl);
- void SetSecurityLevel(int level);
+ void SetSecurityLevel(security_state::SecurityLevel level);
bool HitsBackButton(const gfx::PointF& position) const;
bool HitsUrlBar(const gfx::PointF& position) const;
@@ -40,18 +43,28 @@ class UrlBarTexture : public UiTexture {
void SetHovered(bool hovered);
void SetPressed(bool pressed);
+ // Public for testability.
+ static void ApplyUrlStyling(const base::string16& formatted_url,
+ const url::Parsed& parsed,
+ security_state::SecurityLevel security_level,
+ vr_shell::RenderTextWrapper* render_text);
+
private:
void Draw(SkCanvas* canvas, const gfx::Size& texture_size) override;
float ToPixels(float meters) const;
bool HitsTransparentRegion(const gfx::PointF& meters, bool left) const;
+ void RenderUrl(const gfx::Size& texture_size, const gfx::Rect& bounds);
gfx::SizeF size_;
- int security_level_;
bool hovered_ = false;
bool pressed_ = false;
+
GURL gurl_;
+ security_state::SecurityLevel security_level_;
+
+ std::unique_ptr<gfx::RenderText> url_render_text_;
GURL last_drawn_gurl_;
- std::vector<std::unique_ptr<gfx::RenderText>> gurl_render_texts_;
+ security_state::SecurityLevel last_drawn_security_level_;
DISALLOW_COPY_AND_ASSIGN(UrlBarTexture);
};

Powered by Google App Engine
This is Rietveld 408576698