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

Side by Side Diff: chrome/browser/ui/webui/chrome_web_ui_data_source.cc

Issue 7256002: Multi-Profiles: New Profile Setup UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 9 years, 5 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_web_ui_data_source.h" 5 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/ref_counted_memory.h" 9 #include "base/memory/ref_counted_memory.h"
10 #include "chrome/common/jstemplate_builder.h" 10 #include "chrome/common/jstemplate_builder.h"
(...skipping 10 matching lines...) Expand all
21 void ChromeWebUIDataSource::AddString(const std::string& name, 21 void ChromeWebUIDataSource::AddString(const std::string& name,
22 const string16& value) { 22 const string16& value) {
23 localized_strings_.SetString(name, value); 23 localized_strings_.SetString(name, value);
24 } 24 }
25 25
26 void ChromeWebUIDataSource::AddLocalizedString(const std::string& name, 26 void ChromeWebUIDataSource::AddLocalizedString(const std::string& name,
27 int ids) { 27 int ids) {
28 localized_strings_.SetString(name, l10n_util::GetStringUTF16(ids)); 28 localized_strings_.SetString(name, l10n_util::GetStringUTF16(ids));
29 } 29 }
30 30
31 void ChromeWebUIDataSource::AddLocalizedString(
James Hawkins 2011/06/30 23:02:58 What's wrong with AddString()?
sail 2011/07/01 01:16:18 Oh cool, that wasn't there when I wrote this code.
32 const std::string& name,
33 const string16& localized_string) {
34 localized_strings_.SetString(name, localized_string);
35 }
36
31 void ChromeWebUIDataSource::SendLocalizedStringsAsJSON(int request_id) { 37 void ChromeWebUIDataSource::SendLocalizedStringsAsJSON(int request_id) {
32 std::string template_data; 38 std::string template_data;
33 scoped_refptr<RefCountedBytes> response(new RefCountedBytes); 39 scoped_refptr<RefCountedBytes> response(new RefCountedBytes);
34 SetFontAndTextDirection(&localized_strings_); 40 SetFontAndTextDirection(&localized_strings_);
35 jstemplate_builder::AppendJsonJS(&localized_strings_, &template_data); 41 jstemplate_builder::AppendJsonJS(&localized_strings_, &template_data);
36 response->data.resize(template_data.size()); 42 response->data.resize(template_data.size());
37 std::copy(template_data.begin(), template_data.end(),response->data.begin()); 43 std::copy(template_data.begin(), template_data.end(),response->data.begin());
38 SendResponse(request_id, response); 44 SendResponse(request_id, response);
39 } 45 }
40 46
41 void ChromeWebUIDataSource::SendFromResourceBundle(int request_id, int idr) { 47 void ChromeWebUIDataSource::SendFromResourceBundle(int request_id, int idr) {
42 scoped_refptr<RefCountedStaticMemory> response( 48 scoped_refptr<RefCountedStaticMemory> response(
43 ResourceBundle::GetSharedInstance().LoadDataResourceBytes(idr)); 49 ResourceBundle::GetSharedInstance().LoadDataResourceBytes(idr));
44 SendResponse(request_id, response); 50 SendResponse(request_id, response);
45 } 51 }
46 52
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698