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

Unified Diff: chrome/browser/android/vr_shell/textures/insecure_content_permanent_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_permanent_texture.cc
diff --git a/chrome/browser/android/vr_shell/textures/insecure_content_permanent_texture.cc b/chrome/browser/android/vr_shell/textures/insecure_content_permanent_texture.cc
index ef4c0c416195155da802af8cee21dd40de9d3e25..9999e80d8af811481e128e93add6f9f738565173 100644
--- a/chrome/browser/android/vr_shell/textures/insecure_content_permanent_texture.cc
+++ b/chrome/browser/android/vr_shell/textures/insecure_content_permanent_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,23 @@ void InsecureContentPermanentTexture::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.1});
PaintVectorIcon(canvas, ui::kInfoOutlineIcon, height_ * 0.8,
kForegroundColor);
canvas->Restore();
+
canvas->Save();
canvas->Translate({height_, height_ * 0.1});
- // TODO(acondor): Draw text IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_PERMANENT.
+ // TODO(acondor): Measure text width to remove empty space.
+ int text_flags = gfx::Canvas::TEXT_ALIGN_CENTER;
+ auto text =
+ l10n_util::GetStringUTF16(IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_PERMANENT);
+ canvas->DrawStringRectWithFlags(
+ text, GetFontList(height_ * 0.3, text), kForegroundColor,
mthiesse 2017/04/18 21:30:35 Can you make constants for the magic numbers (like
acondor_ 2017/04/18 23:48:46 Done.
+ {0, 0, 2.9 * height_, 0.8 * height_}, text_flags);
canvas->Restore();
}

Powered by Google App Engine
This is Rietveld 408576698