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 |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a43400ef5b85c5769f7ae4af17a1584f428ce040 |
--- /dev/null |
+++ b/chrome/browser/android/vr_shell/textures/insecure_content_permanent_texture.cc |
@@ -0,0 +1,60 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/android/vr_shell/textures/insecure_content_permanent_texture.h" |
+ |
+#include "cc/paint/skia_paint_canvas.h" |
+#include "chrome/grit/generated_resources.h" |
+#include "ui/base/l10n/l10n_util.h" |
+#include "ui/gfx/canvas.h" |
+#include "ui/gfx/geometry/rect.h" |
+#include "ui/gfx/geometry/vector2d.h" |
+#include "ui/gfx/paint_vector_icon.h" |
+#include "ui/gfx/vector_icon_types.h" |
+#include "ui/vector_icons/vector_icons.h" |
+ |
+namespace vr_shell { |
+ |
+namespace { |
+ |
+const SkColor kPermanentWarningBgColor = SK_ColorWHITE; |
cjgrant
2017/04/12 20:38:53
Since this file is permanent warning specific, you
acondor_
2017/04/12 21:21:45
Done.
|
+const SkColor kPermanentWarningFgColor = 0xFF444444; |
+ |
+} // namespace |
+ |
+InsecureContentPermanentTexture::InsecureContentPermanentTexture( |
+ int texture_handle, |
+ int texture_size) |
+ : UITexture(texture_handle, texture_size) { |
+ DCHECK(texture_size_ % 4 == 0); |
+ height_ = texture_size_ / 4; |
+} |
+ |
+InsecureContentPermanentTexture::~InsecureContentPermanentTexture() = default; |
+ |
+void InsecureContentPermanentTexture::Draw(gfx::Canvas* canvas) { |
+ cc::PaintFlags flags; |
+ flags.setColor(kPermanentWarningBgColor); |
+ canvas->DrawRoundRect(gfx::Rect(texture_size_, height_), height_ * 0.1, |
+ flags); |
+ canvas->Save(); |
+ canvas->Translate({height_ * 0.1, height_ * 0.1}); |
+ PaintVectorIcon(canvas, ui::kInfoOutlineIcon, height_ * 0.8, |
+ kPermanentWarningFgColor); |
+ canvas->Restore(); |
+ canvas->Save(); |
+ canvas->Translate({height_, height_ * 0.5}); |
+ flags.setColor(kPermanentWarningFgColor); |
+ flags.setTextSize(height_ * 0.4); |
+ auto text = |
+ l10n_util::GetStringUTF8(IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_PERMANENT); |
+ DrawText(canvas, text, flags, height_ * 2.9, true); |
+ canvas->Restore(); |
+} |
+ |
+void InsecureContentPermanentTexture::SetSize() { |
+ size_.SetSize(texture_size_, height_); |
+} |
+ |
+} // namespace vr_shell |