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

Side by Side Diff: chrome/browser/android/vr_shell/textures/insecure_content_transient_texture.cc

Issue 2914543002: [vr] Bail on unhandled code points. (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/android/vr_shell/textures/insecure_content_transient_te xture.h" 5 #include "chrome/browser/android/vr_shell/textures/insecure_content_transient_te xture.h"
6 6
7 #include "cc/paint/skia_paint_canvas.h" 7 #include "cc/paint/skia_paint_canvas.h"
8 #include "components/strings/grit/components_strings.h" 8 #include "components/strings/grit/components_strings.h"
9 #include "ui/base/l10n/l10n_util.h" 9 #include "ui/base/l10n/l10n_util.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 25 matching lines...) Expand all
36 const gfx::Size& texture_size) { 36 const gfx::Size& texture_size) {
37 cc::SkiaPaintCanvas paint_canvas(sk_canvas); 37 cc::SkiaPaintCanvas paint_canvas(sk_canvas);
38 gfx::Canvas gfx_canvas(&paint_canvas, 1.0f); 38 gfx::Canvas gfx_canvas(&paint_canvas, 1.0f);
39 gfx::Canvas* canvas = &gfx_canvas; 39 gfx::Canvas* canvas = &gfx_canvas;
40 40
41 size_.set_width(texture_size.width()); 41 size_.set_width(texture_size.width());
42 SkPaint paint; 42 SkPaint paint;
43 paint.setColor(kBackgroundColor); 43 paint.setColor(kBackgroundColor);
44 auto text = 44 auto text =
45 l10n_util::GetStringUTF16(IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_TRANSIENT); 45 l10n_util::GetStringUTF16(IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_TRANSIENT);
46 auto fonts = GetFontList(size_.width() * kFontSizeFactor, text); 46 gfx::FontList fonts;
47 GetFontList(size_.width() * kFontSizeFactor, text, &fonts);
47 gfx::Rect text_size(size_.width() * kTextWidthFactor, 0); 48 gfx::Rect text_size(size_.width() * kTextWidthFactor, 0);
48 49
49 std::vector<std::unique_ptr<gfx::RenderText>> lines = 50 std::vector<std::unique_ptr<gfx::RenderText>> lines =
50 PrepareDrawStringRect(text, fonts, kForegroundColor, &text_size, 51 PrepareDrawStringRect(text, fonts, kForegroundColor, &text_size,
51 kTextAlignmentCenter, kWrappingBehaviorWrap); 52 kTextAlignmentCenter, kWrappingBehaviorWrap);
52 53
53 DCHECK_LE(text_size.height(), 54 DCHECK_LE(text_size.height(),
54 static_cast<int>((1.0 - 2 * kBorderFactor) * size_.width())); 55 static_cast<int>((1.0 - 2 * kBorderFactor) * size_.width()));
55 size_.set_height(size_.width() * 2 * kBorderFactor + text_size.height()); 56 size_.set_height(size_.width() * 2 * kBorderFactor + text_size.height());
56 float radius = size_.height() * kBorderFactor; 57 float radius = size_.height() * kBorderFactor;
(...skipping 11 matching lines...) Expand all
68 gfx::Size InsecureContentTransientTexture::GetPreferredTextureSize( 69 gfx::Size InsecureContentTransientTexture::GetPreferredTextureSize(
69 int maximum_width) const { 70 int maximum_width) const {
70 return gfx::Size(maximum_width, maximum_width); 71 return gfx::Size(maximum_width, maximum_width);
71 } 72 }
72 73
73 gfx::SizeF InsecureContentTransientTexture::GetDrawnSize() const { 74 gfx::SizeF InsecureContentTransientTexture::GetDrawnSize() const {
74 return size_; 75 return size_;
75 } 76 }
76 77
77 } // namespace vr_shell 78 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698