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

Side by Side Diff: ui/base/webui/web_ui_util.cc

Issue 1130613002: Clean up Noto Sans UI stuff. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ui/base/webui/web_ui_util.h" 5 #include "ui/base/webui/web_ui_util.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 10 matching lines...) Expand all
21 #include "ui/gfx/font.h" 21 #include "ui/gfx/font.h"
22 #include "ui/gfx/image/image_skia.h" 22 #include "ui/gfx/image/image_skia.h"
23 #include "ui/resources/grit/webui_resources.h" 23 #include "ui/resources/grit/webui_resources.h"
24 #include "ui/strings/grit/app_locale_settings.h" 24 #include "ui/strings/grit/app_locale_settings.h"
25 #include "url/gurl.h" 25 #include "url/gurl.h"
26 26
27 #if defined(OS_WIN) 27 #if defined(OS_WIN)
28 #include "base/win/windows_version.h" 28 #include "base/win/windows_version.h"
29 #endif 29 #endif
30 30
31 #if defined(OS_CHROMEOS)
32 #include "ui/base/font_helper_chromeos.h"
33 #endif
34
35 namespace webui { 31 namespace webui {
36 32
37 std::string GetBitmapDataUrl(const SkBitmap& bitmap) { 33 std::string GetBitmapDataUrl(const SkBitmap& bitmap) {
38 TRACE_EVENT2("oobe", "GetImageDataUrl", 34 TRACE_EVENT2("oobe", "GetImageDataUrl",
39 "width", bitmap.width(), "height", bitmap.height()); 35 "width", bitmap.width(), "height", bitmap.height());
40 std::vector<unsigned char> output; 36 std::vector<unsigned char> output;
41 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &output); 37 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &output);
42 std::string str_url; 38 std::string str_url;
43 str_url.insert(str_url.end(), output.begin(), output.end()); 39 str_url.insert(str_url.end(), output.begin(), output.end());
44 40
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 157 }
162 158
163 std::string GetFontFamily() { 159 std::string GetFontFamily() {
164 std::string font_family = l10n_util::GetStringUTF8( 160 std::string font_family = l10n_util::GetStringUTF8(
165 #if defined(OS_WIN) 161 #if defined(OS_WIN)
166 base::win::GetVersion() < base::win::VERSION_VISTA ? 162 base::win::GetVersion() < base::win::VERSION_VISTA ?
167 IDS_WEB_FONT_FAMILY_XP : 163 IDS_WEB_FONT_FAMILY_XP :
168 #endif 164 #endif
169 IDS_WEB_FONT_FAMILY); 165 IDS_WEB_FONT_FAMILY);
170 166
171 #if defined(OS_CHROMEOS)
172 ui::ReplaceNotoSansWithRobotoIfEnabled(&font_family);
173 #endif
174
175 // TODO(dnicoara) Remove Ozone check when PlatformFont support is introduced 167 // TODO(dnicoara) Remove Ozone check when PlatformFont support is introduced
176 // into Ozone: crbug.com/320050 168 // into Ozone: crbug.com/320050
177 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(USE_OZONE) 169 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(USE_OZONE)
178 font_family = ui::ResourceBundle::GetSharedInstance().GetFont( 170 font_family = ui::ResourceBundle::GetSharedInstance().GetFont(
179 ui::ResourceBundle::BaseFont).GetFontName() + ", " + font_family; 171 ui::ResourceBundle::BaseFont).GetFontName() + ", " + font_family;
180 #endif 172 #endif
181 173
182 return font_family; 174 return font_family;
183 } 175 }
184 176
185 std::string GetFontSize() { 177 std::string GetFontSize() {
186 return l10n_util::GetStringUTF8( 178 return l10n_util::GetStringUTF8(
187 #if defined(OS_WIN) 179 #if defined(OS_WIN)
188 base::win::GetVersion() < base::win::VERSION_VISTA ? 180 base::win::GetVersion() < base::win::VERSION_VISTA ?
189 IDS_WEB_FONT_SIZE_XP : 181 IDS_WEB_FONT_SIZE_XP :
190 #endif 182 #endif
191 IDS_WEB_FONT_SIZE); 183 IDS_WEB_FONT_SIZE);
192 } 184 }
193 185
194 std::string GetTextDirection() { 186 std::string GetTextDirection() {
195 return base::i18n::IsRTL() ? "rtl" : "ltr"; 187 return base::i18n::IsRTL() ? "rtl" : "ltr";
196 } 188 }
197 189
198 } // namespace webui 190 } // namespace webui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698