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

Side by Side Diff: printing/page_overlays.cc

Issue 3292019: Printing: Convert several wstrings to string16. (Closed)
Patch Set: Review fixes. Created 10 years, 3 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/printing/print_view_manager.cc ('k') | printing/page_overlays_unittest.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "printing/page_overlays.h" 5 #include "printing/page_overlays.h"
6 6
7 #include "app/text_elider.h" 7 #include "app/text_elider.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 std::wstring output(input); 142 std::wstring output(input);
143 for (size_t offset = output.find(L'{', 0); 143 for (size_t offset = output.find(L'{', 0);
144 offset != std::wstring::npos; 144 offset != std::wstring::npos;
145 offset = output.find(L'{', offset)) { 145 offset = output.find(L'{', offset)) {
146 if (0 == output.compare(offset, 146 if (0 == output.compare(offset,
147 wcslen(kTitle), 147 wcslen(kTitle),
148 kTitle)) { 148 kTitle)) {
149 offset = ReplaceKey(&output, 149 offset = ReplaceKey(&output,
150 offset, 150 offset,
151 wcslen(kTitle), 151 wcslen(kTitle),
152 document.name()); 152 UTF16ToWideHack(document.name()));
153 } else if (0 == output.compare(offset, 153 } else if (0 == output.compare(offset,
154 wcslen(kTime), 154 wcslen(kTime),
155 kTime)) { 155 kTime)) {
156 offset = ReplaceKey(&output, 156 offset = ReplaceKey(&output,
157 offset, 157 offset,
158 wcslen(kTime), 158 wcslen(kTime),
159 document.time()); 159 UTF16ToWideHack(document.time()));
160 } else if (0 == output.compare(offset, 160 } else if (0 == output.compare(offset,
161 wcslen(kDate), 161 wcslen(kDate),
162 kDate)) { 162 kDate)) {
163 offset = ReplaceKey(&output, 163 offset = ReplaceKey(&output,
164 offset, 164 offset,
165 wcslen(kDate), 165 wcslen(kDate),
166 document.date()); 166 UTF16ToWideHack(document.date()));
167 } else if (0 == output.compare(offset, 167 } else if (0 == output.compare(offset,
168 wcslen(kPage), 168 wcslen(kPage),
169 kPage)) { 169 kPage)) {
170 offset = ReplaceKey(&output, 170 offset = ReplaceKey(&output,
171 offset, 171 offset,
172 wcslen(kPage), 172 wcslen(kPage),
173 UTF8ToWide(base::IntToString(page.page_number()))); 173 UTF8ToWide(base::IntToString(page.page_number())));
174 } else if (0 == output.compare(offset, 174 } else if (0 == output.compare(offset,
175 wcslen(kPageCount), 175 wcslen(kPageCount),
176 kPageCount)) { 176 kPageCount)) {
(...skipping 22 matching lines...) Expand all
199 UTF8ToWide(document.url().spec())); 199 UTF8ToWide(document.url().spec()));
200 } else { 200 } else {
201 // There is just a { in the string. 201 // There is just a { in the string.
202 ++offset; 202 ++offset;
203 } 203 }
204 } 204 }
205 return output; 205 return output;
206 } 206 }
207 207
208 } // namespace printing 208 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_view_manager.cc ('k') | printing/page_overlays_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698