OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/gfx/text_elider.h" | 7 #include "app/gfx/text_elider.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "printing/printed_document.h" | 10 #include "printing/printed_document.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 NOTREACHED(); | 130 NOTREACHED(); |
131 break; | 131 break; |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 //static | 135 //static |
136 std::wstring PageOverlays::ReplaceVariables(const std::wstring& input, | 136 std::wstring PageOverlays::ReplaceVariables(const std::wstring& input, |
137 const PrintedDocument& document, | 137 const PrintedDocument& document, |
138 const PrintedPage& page) { | 138 const PrintedPage& page) { |
139 std::wstring output(input); | 139 std::wstring output(input); |
| 140 // Prevent references to document.page_count() on Linux until |
| 141 // printed_document.cc is included in printing.gyp. |
| 142 #if !defined(OS_LINUX) |
140 for (size_t offset = output.find(L'{', 0); | 143 for (size_t offset = output.find(L'{', 0); |
141 offset != std::wstring::npos; | 144 offset != std::wstring::npos; |
142 offset = output.find(L'{', offset)) { | 145 offset = output.find(L'{', offset)) { |
143 | 146 |
144 if (0 == output.compare(offset, | 147 if (0 == output.compare(offset, |
145 wcslen(kTitle), | 148 wcslen(kTitle), |
146 kTitle)) { | 149 kTitle)) { |
147 offset = ReplaceKey(&output, | 150 offset = ReplaceKey(&output, |
148 offset, | 151 offset, |
149 wcslen(kTitle), | 152 wcslen(kTitle), |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // TODO(maruel): http://b/1126373 gfx::ElideUrl(document.url(), ...) | 196 // TODO(maruel): http://b/1126373 gfx::ElideUrl(document.url(), ...) |
194 offset = ReplaceKey(&output, | 197 offset = ReplaceKey(&output, |
195 offset, | 198 offset, |
196 wcslen(kUrl), | 199 wcslen(kUrl), |
197 UTF8ToWide(document.url().spec())); | 200 UTF8ToWide(document.url().spec())); |
198 } else { | 201 } else { |
199 // There is just a { in the string. | 202 // There is just a { in the string. |
200 ++offset; | 203 ++offset; |
201 } | 204 } |
202 } | 205 } |
| 206 #endif // !defined(OS_LINUX) |
203 return output; | 207 return output; |
204 } | 208 } |
205 | 209 |
206 } // namespace printing | 210 } // namespace printing |
OLD | NEW |