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

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

Issue 2902393002: [vr] Bail on unhandled code points. (Closed)
Patch Set: histograms 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..7a29f3518169be5c25e409b4c1cd3927c0a73ead 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,10 @@ gfx::PointF percentToMeters(const gfx::PointF& percent) {
} // namespace
-UrlBarTexture::UrlBarTexture() : security_level_(SecurityLevel::DANGEROUS) {}
+UrlBarTexture::UrlBarTexture(
+ const base::Callback<void(UiUnsupportedMode)>& failure_callback)
+ : security_level_(SecurityLevel::DANGEROUS),
+ failure_callback_(failure_callback) {}
UrlBarTexture::~UrlBarTexture() = default;
@@ -210,10 +213,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(UiUnsupportedMode::kUnhandledCodePoint);
gurl_render_texts_ = PrepareDrawStringRect(
cjgrant 2017/05/26 18:52:00 This needs some non-trivial rebasing, as we don't
Ian Vollick 2017/05/26 20:20:28 Done. Also, since we're now using GetFontList, I w
- 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