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

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

Issue 2899393003: [vr] Exit VR mode when we encounter unsupported URLs (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
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/textures/url_bar_texture_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 966d87728cf8e76482b4187a9fd056ac32947cae..8da35627fc0eaf5b6f746f0f31e54cc50369eaa0 100644
--- a/chrome/browser/android/vr_shell/textures/url_bar_texture.cc
+++ b/chrome/browser/android/vr_shell/textures/url_bar_texture.cc
@@ -252,13 +252,26 @@ void UrlBarTexture::RenderUrl(const gfx::Size& texture_size,
std::unique_ptr<gfx::RenderText> render_text(
gfx::RenderText::CreateInstance());
- render_text->SetText(text);
render_text->SetFontList(font_list);
render_text->SetColor(SK_ColorBLACK);
render_text->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- render_text->SetDisplayRect(bounds);
render_text->SetElideBehavior(gfx::TRUNCATE);
+ base::string16 mandatory_prefix = text;
+ int length = parsed.CountCharactersBefore(url::Parsed::PORT, false);
+ if (length > 0)
+ mandatory_prefix = text.substr(0, length);
+ gfx::Rect expanded_bounds = bounds;
+ expanded_bounds.set_width(2 * bounds.width());
+ render_text->SetDisplayRect(expanded_bounds);
+ render_text->SetText(mandatory_prefix);
+
+ if (render_text->GetStringSize().width() > bounds.width()) {
+ failure_callback_.Run(UiUnsupportedMode::kCouldNotElideURL);
+ }
+
+ render_text->SetText(text);
+ render_text->SetDisplayRect(bounds);
vr_shell::RenderTextWrapper vr_render_text(render_text.get());
ApplyUrlStyling(text, parsed, security_level_, &vr_render_text);
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/textures/url_bar_texture_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698