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

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

Issue 2817663003: Rendering text on insecure-site warnings for WebVR (Closed)
Patch Set: Adding TODO for device scale factor Created 3 years, 8 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/insecure_content_transient_texture.cc
diff --git a/chrome/browser/android/vr_shell/textures/insecure_content_transient_texture.cc b/chrome/browser/android/vr_shell/textures/insecure_content_transient_texture.cc
index f215587252df04122e570355383087ba38bf306c..aa4cf789db666a1ebf13f5c593a41dee0a0f4f34 100644
--- a/chrome/browser/android/vr_shell/textures/insecure_content_transient_texture.cc
+++ b/chrome/browser/android/vr_shell/textures/insecure_content_transient_texture.cc
@@ -8,6 +8,7 @@
#include "chrome/grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/canvas.h"
+#include "ui/gfx/font_list.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/vector2d.h"
#include "ui/gfx/paint_vector_icon.h"
@@ -39,14 +40,22 @@ void InsecureContentTransientTexture::Draw(gfx::Canvas* canvas) {
flags.setColor(kBackgroundColor);
canvas->DrawRoundRect(gfx::Rect(texture_size_, height_), height_ * 0.1,
flags);
+
+ // TODO(acondor): Layout icon on the right for RTL languages.
canvas->Save();
canvas->Translate({height_ * 0.1, height_ * 0.25});
PaintVectorIcon(canvas, ui::kInfoOutlineIcon, height_ * 0.5,
kForegroundColor);
canvas->Restore();
+
canvas->Save();
canvas->Translate({height_ * 0.7, height_ * 0.1});
- // TODO(acondor): Draw text IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_TRANSIENT.
+ int text_flags = gfx::Canvas::TEXT_ALIGN_CENTER | gfx::Canvas::MULTI_LINE;
+ auto text =
+ l10n_util::GetStringUTF16(IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_TRANSIENT);
+ canvas->DrawStringRectWithFlags(
+ text, GetFontList(height_ * 0.1, text), kForegroundColor,
mthiesse 2017/04/18 21:30:35 Constants for these magic numbers too please.
acondor_ 2017/04/18 23:48:46 Done.
+ {0, 0, 1.2 * height_, 0.8 * height_}, text_flags);
canvas->Restore();
}

Powered by Google App Engine
This is Rietveld 408576698