Index: ui/gfx/hud_font.cc |
diff --git a/ui/gfx/hud_font.cc b/ui/gfx/hud_font.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6e0bbb2f5ddd059fad762bec961c5dd650c87ae9 |
--- /dev/null |
+++ b/ui/gfx/hud_font.cc |
@@ -0,0 +1,32 @@ |
+// Copyright 2015 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 "ui/gfx/hud_font.h" |
+ |
+#include "base/lazy_instance.h" |
+#include "third_party/skia/include/core/SkTypeface.h" |
+ |
+namespace ui { |
+ |
+namespace { |
+base::LazyInstance<skia::RefPtr<SkTypeface>> g_hud_typeface; |
+} // namespace |
+ |
+void SetHudTypeface(skia::RefPtr<SkTypeface> typeface) { |
+ g_hud_typeface.Get() = typeface; |
+} |
+ |
+skia::RefPtr<SkTypeface> GetHudTypeface() { |
+#if !defined(OS_WIN) |
danakj
2015/02/05 22:56:13
can we do like
#if defined(OS_WIN)
DCHECK(g_hud_t
scottmg
2015/02/05 23:21:57
No, unfortunately not. This is used in the browser
|
+ if (!g_hud_typeface.Get()) { |
+ // This will be set pre-sandbox on Windows. On other platforms, just make |
+ // something here. |
+ SetHudTypeface(skia::AdoptRef( |
+ SkTypeface::CreateFromName("monospace", SkTypeface::kBold))); |
+ } |
+#endif // OS_WIN |
+ return g_hud_typeface.Get(); |
+} |
+ |
+} // namespace ui |