| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |