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

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

Issue 2902393002: [vr] Bail on unhandled code points. (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 3c43bf06aca9c987d7b1bc24a3dbee721ffdea18..cca0696d44f6ae2c06a104c69bc7db8dc9d55cc1 100644
--- a/chrome/browser/android/vr_shell/textures/url_bar_texture.cc
+++ b/chrome/browser/android/vr_shell/textures/url_bar_texture.cc
@@ -84,7 +84,9 @@ gfx::PointF percentToMeters(const gfx::PointF& percent) {
} // namespace
-UrlBarTexture::UrlBarTexture() : security_level_(SecurityLevel::DANGEROUS) {}
+UrlBarTexture::UrlBarTexture(const base::Callback<void()>& failure_callback)
+ : security_level_(SecurityLevel::DANGEROUS),
+ failure_callback_(failure_callback) {}
UrlBarTexture::~UrlBarTexture() = default;
@@ -210,10 +212,12 @@ void UrlBarTexture::Draw(SkCanvas* canvas, const gfx::Size& texture_size) {
float url_width = kWidth - url_x - kUrlRightMargin;
gfx::Rect text_bounds(ToPixels(url_x), 0, ToPixels(url_width),
ToPixels(kHeight));
+ base::string16 text = base::UTF8ToUTF16(gurl_.spec());
+ if (!CheckFontList(pixel_font_height, text))
+ failure_callback_.Run();
gurl_render_texts_ = PrepareDrawStringRect(
- base::UTF8ToUTF16(gurl_.spec()),
- GetDefaultFontList(pixel_font_height), SK_ColorBLACK, &text_bounds,
- kTextAlignmentLeft, kWrappingBehaviorNoWrap);
+ text, GetDefaultFontList(pixel_font_height), SK_ColorBLACK,
+ &text_bounds, kTextAlignmentLeft, kWrappingBehaviorNoWrap);
last_drawn_gurl_ = gurl_;
}
for (auto& render_text : gurl_render_texts_)

Powered by Google App Engine
This is Rietveld 408576698