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" | |
8 #include "base/logging.h" | 7 #include "base/logging.h" |
9 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
10 #include "base/string_util.h" | 9 #include "base/string_util.h" |
11 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
12 #include "printing/printed_document.h" | 11 #include "printing/printed_document.h" |
13 #include "printing/printed_page.h" | 12 #include "printing/printed_page.h" |
14 | 13 |
15 namespace { | 14 namespace { |
16 | 15 |
17 // Replaces a subpart of a string by other value, and returns the position right | 16 // Replaces a subpart of a string by other value, and returns the position right |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 replacement = UTF8ToWide(base::IntToString(page.page_number())); | 184 replacement = UTF8ToWide(base::IntToString(page.page_number())); |
186 replacement += L"/"; | 185 replacement += L"/"; |
187 replacement += UTF8ToWide(base::IntToString(document.page_count())); | 186 replacement += UTF8ToWide(base::IntToString(document.page_count())); |
188 offset = ReplaceKey(&output, | 187 offset = ReplaceKey(&output, |
189 offset, | 188 offset, |
190 wcslen(kPageOnTotal), | 189 wcslen(kPageOnTotal), |
191 replacement); | 190 replacement); |
192 } else if (0 == output.compare(offset, | 191 } else if (0 == output.compare(offset, |
193 wcslen(kUrl), | 192 wcslen(kUrl), |
194 kUrl)) { | 193 kUrl)) { |
195 // TODO(maruel): http://b/1126373 gfx::ElideUrl(document.url(), ...) | 194 // TODO(maruel): http://b/1126373 ui::ElideUrl(document.url(), ...) |
196 offset = ReplaceKey(&output, | 195 offset = ReplaceKey(&output, |
197 offset, | 196 offset, |
198 wcslen(kUrl), | 197 wcslen(kUrl), |
199 UTF8ToWide(document.url().spec())); | 198 UTF8ToWide(document.url().spec())); |
200 } else { | 199 } else { |
201 // There is just a { in the string. | 200 // There is just a { in the string. |
202 ++offset; | 201 ++offset; |
203 } | 202 } |
204 } | 203 } |
205 return output; | 204 return output; |
206 } | 205 } |
207 | 206 |
208 } // namespace printing | 207 } // namespace printing |
OLD | NEW |