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

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

Issue 17034006: Add base namespace to more values in sync and elsewhere. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « ui/webui/web_ui_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/webui/web_ui_util.h" 5 #include "ui/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/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 scoped_refptr<base::RefCountedMemory> raw_icon(icon_data); 51 scoped_refptr<base::RefCountedMemory> raw_icon(icon_data);
52 std::string str_url; 52 std::string str_url;
53 str_url.insert(str_url.end(), 53 str_url.insert(str_url.end(),
54 raw_icon->front(), 54 raw_icon->front(),
55 raw_icon->front() + raw_icon->size()); 55 raw_icon->front() + raw_icon->size());
56 base::Base64Encode(str_url, &str_url); 56 base::Base64Encode(str_url, &str_url);
57 str_url.insert(0, "data:image/png;base64,"); 57 str_url.insert(0, "data:image/png;base64,");
58 return str_url; 58 return str_url;
59 } 59 }
60 60
61 WindowOpenDisposition GetDispositionFromClick(const ListValue* args, 61 WindowOpenDisposition GetDispositionFromClick(const base::ListValue* args,
62 int start_index) { 62 int start_index) {
63 double button = 0.0; 63 double button = 0.0;
64 bool alt_key = false; 64 bool alt_key = false;
65 bool ctrl_key = false; 65 bool ctrl_key = false;
66 bool meta_key = false; 66 bool meta_key = false;
67 bool shift_key = false; 67 bool shift_key = false;
68 68
69 CHECK(args->GetDouble(start_index++, &button)); 69 CHECK(args->GetDouble(start_index++, &button));
70 CHECK(args->GetBoolean(start_index++, &alt_key)); 70 CHECK(args->GetBoolean(start_index++, &alt_key));
71 CHECK(args->GetBoolean(start_index++, &ctrl_key)); 71 CHECK(args->GetBoolean(start_index++, &ctrl_key));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // Strip scale factor specification from path. 120 // Strip scale factor specification from path.
121 stripped_path.remove_suffix(stripped_path.length() - pos); 121 stripped_path.remove_suffix(stripped_path.length() - pos);
122 stripped_path.CopyToString(path); 122 stripped_path.CopyToString(path);
123 } 123 }
124 if (scale_factor) 124 if (scale_factor)
125 *scale_factor = factor; 125 *scale_factor = factor;
126 } 126 }
127 } 127 }
128 128
129 // static 129 // static
130 void SetFontAndTextDirection(DictionaryValue* localized_strings) { 130 void SetFontAndTextDirection(base::DictionaryValue* localized_strings) {
131 int web_font_family_id = IDS_WEB_FONT_FAMILY; 131 int web_font_family_id = IDS_WEB_FONT_FAMILY;
132 int web_font_size_id = IDS_WEB_FONT_SIZE; 132 int web_font_size_id = IDS_WEB_FONT_SIZE;
133 #if defined(OS_WIN) 133 #if defined(OS_WIN)
134 // Vary font settings for Windows XP. 134 // Vary font settings for Windows XP.
135 if (base::win::GetVersion() < base::win::VERSION_VISTA) { 135 if (base::win::GetVersion() < base::win::VERSION_VISTA) {
136 web_font_family_id = IDS_WEB_FONT_FAMILY_XP; 136 web_font_family_id = IDS_WEB_FONT_FAMILY_XP;
137 web_font_size_id = IDS_WEB_FONT_SIZE_XP; 137 web_font_size_id = IDS_WEB_FONT_SIZE_XP;
138 } 138 }
139 #endif 139 #endif
140 140
141 std::string font_family = l10n_util::GetStringUTF8(web_font_family_id); 141 std::string font_family = l10n_util::GetStringUTF8(web_font_family_id);
142 142
143 #if defined(TOOLKIT_GTK) 143 #if defined(TOOLKIT_GTK)
144 // Use the system font on Linux/GTK. Keep the hard-coded font families as 144 // Use the system font on Linux/GTK. Keep the hard-coded font families as
145 // backup in case for some crazy reason this one isn't available. 145 // backup in case for some crazy reason this one isn't available.
146 font_family = ui::ResourceBundle::GetSharedInstance().GetFont( 146 font_family = ui::ResourceBundle::GetSharedInstance().GetFont(
147 ui::ResourceBundle::BaseFont).GetFontName() + ", " + font_family; 147 ui::ResourceBundle::BaseFont).GetFontName() + ", " + font_family;
148 #endif 148 #endif
149 149
150 localized_strings->SetString("fontfamily", font_family); 150 localized_strings->SetString("fontfamily", font_family);
151 localized_strings->SetString("fontsize", 151 localized_strings->SetString("fontsize",
152 l10n_util::GetStringUTF8(web_font_size_id)); 152 l10n_util::GetStringUTF8(web_font_size_id));
153 localized_strings->SetString("textdirection", 153 localized_strings->SetString("textdirection",
154 base::i18n::IsRTL() ? "rtl" : "ltr"); 154 base::i18n::IsRTL() ? "rtl" : "ltr");
155 } 155 }
156 156
157 } // namespace webui 157 } // namespace webui
OLDNEW
« no previous file with comments | « ui/webui/web_ui_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698