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

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..e3d2e4f71ad057087d94f3494d34893f33801b4b 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,23 @@ 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);
+ const base::string16 mandatory_prefix = text.substr(0, parsed.host.end());
+ 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);
cjgrant 2017/05/29 15:17:13 Just checking that you still want to proceed and r
+ 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