OLD | NEW |
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 "chrome/browser/ui/webui/chrome_url_data_manager.h" | 5 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 return message_loop_; | 148 return message_loop_; |
149 } | 149 } |
150 | 150 |
151 bool ChromeURLDataManager::DataSource::ShouldReplaceExistingSource() const { | 151 bool ChromeURLDataManager::DataSource::ShouldReplaceExistingSource() const { |
152 return true; | 152 return true; |
153 } | 153 } |
154 | 154 |
155 // static | 155 // static |
156 void ChromeURLDataManager::DataSource::SetFontAndTextDirection( | 156 void ChromeURLDataManager::DataSource::SetFontAndTextDirection( |
157 DictionaryValue* localized_strings) { | 157 DictionaryValue* localized_strings) { |
158 localized_strings->SetString("fontfamily", | 158 int web_font_family_id = IDS_WEB_FONT_FAMILY; |
159 l10n_util::GetStringUTF16(IDS_WEB_FONT_FAMILY)); | |
160 | |
161 int web_font_size_id = IDS_WEB_FONT_SIZE; | 159 int web_font_size_id = IDS_WEB_FONT_SIZE; |
162 #if defined(OS_WIN) | 160 #if defined(OS_WIN) |
163 // Some fonts used for some languages changed a lot in terms of the font | 161 // Vary font settings for Windows Vista and/or Windows XP. |
164 // metric in Vista. So, we need to use different size before Vista. | 162 if (base::win::GetVersion() == base::win::VERSION_VISTA) { |
165 if (base::win::GetVersion() < base::win::VERSION_VISTA) | 163 web_font_family_id = IDS_WEB_FONT_FAMILY_VISTA; |
| 164 } else if (base::win::GetVersion() < base::win::VERSION_VISTA) { |
| 165 web_font_family_id = IDS_WEB_FONT_FAMILY_XP; |
166 web_font_size_id = IDS_WEB_FONT_SIZE_XP; | 166 web_font_size_id = IDS_WEB_FONT_SIZE_XP; |
| 167 } |
167 #endif | 168 #endif |
| 169 localized_strings->SetString("fontfamily", |
| 170 l10n_util::GetStringUTF16(web_font_family_id)); |
168 localized_strings->SetString("fontsize", | 171 localized_strings->SetString("fontsize", |
169 l10n_util::GetStringUTF16(web_font_size_id)); | 172 l10n_util::GetStringUTF16(web_font_size_id)); |
170 | |
171 localized_strings->SetString("textdirection", | 173 localized_strings->SetString("textdirection", |
172 base::i18n::IsRTL() ? "rtl" : "ltr"); | 174 base::i18n::IsRTL() ? "rtl" : "ltr"); |
173 } | 175 } |
174 | 176 |
175 void ChromeURLDataManager::DataSource::SendResponseOnIOThread( | 177 void ChromeURLDataManager::DataSource::SendResponseOnIOThread( |
176 int request_id, | 178 int request_id, |
177 scoped_refptr<RefCountedMemory> bytes) { | 179 scoped_refptr<RefCountedMemory> bytes) { |
178 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 180 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
179 if (backend_) | 181 if (backend_) |
180 backend_->DataAvailable(request_id, bytes); | 182 backend_->DataAvailable(request_id, bytes); |
181 } | 183 } |
OLD | NEW |