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

Side by Side Diff: chrome/browser/dom_ui/chrome_url_data_manager.cc

Issue 71005: Merge 13114 - Make the font family and the font size used in dom UI localizab... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/branches/172/src/
Patch Set: '' Created 11 years, 8 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
« no previous file with comments | « chrome/browser/dom_ui/chrome_url_data_manager.h ('k') | chrome/browser/dom_ui/downloads_ui.cc » ('j') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/dom_ui/chrome_url_data_manager.h" 5 #include "chrome/browser/dom_ui/chrome_url_data_manager.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/thread.h" 11 #include "base/thread.h"
12 #include "base/values.h"
12 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
13 #include "chrome/common/chrome_paths.h" 14 #include "chrome/common/chrome_paths.h"
15 #include "chrome/common/l10n_util.h"
14 #include "chrome/common/ref_counted_util.h" 16 #include "chrome/common/ref_counted_util.h"
15 #include "chrome/common/url_constants.h" 17 #include "chrome/common/url_constants.h"
16 #include "googleurl/src/url_util.h" 18 #include "googleurl/src/url_util.h"
17 #include "net/url_request/url_request.h" 19 #include "net/url_request/url_request.h"
18 #include "net/url_request/url_request_file_job.h" 20 #include "net/url_request/url_request_file_job.h"
19 #include "net/url_request/url_request_job.h" 21 #include "net/url_request/url_request_job.h"
20 #ifdef CHROME_PERSONALIZATION 22 #ifdef CHROME_PERSONALIZATION
21 // TODO(timsteele): Remove all CHROME_PERSONALIZATION code in this file. 23 // TODO(timsteele): Remove all CHROME_PERSONALIZATION code in this file.
22 // It is only temporarily needed to configure some personalization data sources 24 // It is only temporarily needed to configure some personalization data sources
23 // that will go away soon. 25 // that will go away soon.
24 #include "chrome/personalization/personalization.h" 26 #include "chrome/personalization/personalization.h"
25 #endif 27 #endif
26 28
29 #include "grit/locale_settings.h"
30
27 // The URL scheme used for internal chrome resources. 31 // The URL scheme used for internal chrome resources.
28 // TODO(glen): Choose a better location for this. 32 // TODO(glen): Choose a better location for this.
29 static const char kChromeURLScheme[] = "chrome-ui"; 33 static const char kChromeURLScheme[] = "chrome-ui";
30 34
31 // The single global instance of ChromeURLDataManager. 35 // The single global instance of ChromeURLDataManager.
32 ChromeURLDataManager chrome_url_data_manager; 36 ChromeURLDataManager chrome_url_data_manager;
33 37
34 // URLRequestChromeJob is a URLRequestJob that manages running chrome-internal 38 // URLRequestChromeJob is a URLRequestJob that manages running chrome-internal
35 // resource requests asynchronously. 39 // resource requests asynchronously.
36 // It hands off URL requests to ChromeURLDataManager, which asynchronously 40 // It hands off URL requests to ChromeURLDataManager, which asynchronously
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 void ChromeURLDataManager::DataSource::SendResponse( 256 void ChromeURLDataManager::DataSource::SendResponse(
253 RequestID request_id, 257 RequestID request_id,
254 RefCountedBytes* bytes) { 258 RefCountedBytes* bytes) {
255 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, 259 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
256 NewRunnableMethod(&chrome_url_data_manager, 260 NewRunnableMethod(&chrome_url_data_manager,
257 &ChromeURLDataManager::DataAvailable, 261 &ChromeURLDataManager::DataAvailable,
258 request_id, scoped_refptr<RefCountedBytes>(bytes))); 262 request_id, scoped_refptr<RefCountedBytes>(bytes)));
259 } 263 }
260 264
261 // static 265 // static
266 void ChromeURLDataManager::DataSource::SetFontAndTextDirection(
267 DictionaryValue* localized_strings) {
268 localized_strings->SetString(L"fontfamily",
269 l10n_util::GetString(IDS_WEB_FONT_FAMILY));
270 localized_strings->SetString(L"fontsize",
271 l10n_util::GetString(IDS_WEB_FONT_SIZE));
272
273 localized_strings->SetString(L"textdirection",
274 (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ?
275 L"rtl" : L"ltr");
276 }
277
262 URLRequestJob* ChromeURLDataManager::Factory(URLRequest* request, 278 URLRequestJob* ChromeURLDataManager::Factory(URLRequest* request,
263 const std::string& scheme) { 279 const std::string& scheme) {
264 // Try first with a file handler 280 // Try first with a file handler
265 std::wstring path; 281 std::wstring path;
266 if (ChromeURLDataManager::URLToFilePath(request->url(), &path)) 282 if (ChromeURLDataManager::URLToFilePath(request->url(), &path))
267 return new URLRequestChromeFileJob(request, 283 return new URLRequestChromeFileJob(request,
268 FilePath::FromWStringHack(path)); 284 FilePath::FromWStringHack(path));
269 285
270 // Fall back to using a custom handler 286 // Fall back to using a custom handler
271 return new URLRequestChromeJob(request); 287 return new URLRequestChromeJob(request);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 net::ERR_INVALID_URL)); 366 net::ERR_INVALID_URL));
351 } 367 }
352 } 368 }
353 369
354 URLRequestChromeFileJob::URLRequestChromeFileJob(URLRequest* request, 370 URLRequestChromeFileJob::URLRequestChromeFileJob(URLRequest* request,
355 const FilePath& path) 371 const FilePath& path)
356 : URLRequestFileJob(request, path) { 372 : URLRequestFileJob(request, path) {
357 } 373 }
358 374
359 URLRequestChromeFileJob::~URLRequestChromeFileJob() { } 375 URLRequestChromeFileJob::~URLRequestChromeFileJob() { }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/chrome_url_data_manager.h ('k') | chrome/browser/dom_ui/downloads_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698