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

Side by Side Diff: printing/page_overlays.cc

Issue 193086: Fix printing project on linux. (Closed)
Patch Set: fix git error Created 11 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 | « printing/page_overlays.h ('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) 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return top_right; 77 return top_right;
78 case BOTTOM: 78 case BOTTOM:
79 return bottom_right; 79 return bottom_right;
80 } 80 }
81 break; 81 break;
82 } 82 }
83 NOTREACHED(); 83 NOTREACHED();
84 return EmptyWString(); 84 return EmptyWString();
85 } 85 }
86 86
87 void PageOverlays::SetOverlay(HorizontalPosition x, VerticalPosition y, 87 void PageOverlays::SetOverlay(HorizontalPosition x,
88 std::wstring& input) { 88 VerticalPosition y,
89 const std::wstring& input) {
89 switch (x) { 90 switch (x) {
90 case LEFT: 91 case LEFT:
91 switch (y) { 92 switch (y) {
92 case TOP: 93 case TOP:
93 top_left = input; 94 top_left = input;
94 break; 95 break;
95 case BOTTOM: 96 case BOTTOM:
96 bottom_left = input; 97 bottom_left = input;
97 break; 98 break;
98 default: 99 default:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 NOTREACHED(); 131 NOTREACHED();
131 break; 132 break;
132 } 133 }
133 } 134 }
134 135
135 //static 136 //static
136 std::wstring PageOverlays::ReplaceVariables(const std::wstring& input, 137 std::wstring PageOverlays::ReplaceVariables(const std::wstring& input,
137 const PrintedDocument& document, 138 const PrintedDocument& document,
138 const PrintedPage& page) { 139 const PrintedPage& page) {
139 std::wstring output(input); 140 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)
143 for (size_t offset = output.find(L'{', 0); 141 for (size_t offset = output.find(L'{', 0);
144 offset != std::wstring::npos; 142 offset != std::wstring::npos;
145 offset = output.find(L'{', offset)) { 143 offset = output.find(L'{', offset)) {
146 144
147 if (0 == output.compare(offset, 145 if (0 == output.compare(offset,
148 wcslen(kTitle), 146 wcslen(kTitle),
149 kTitle)) { 147 kTitle)) {
150 offset = ReplaceKey(&output, 148 offset = ReplaceKey(&output,
151 offset, 149 offset,
152 wcslen(kTitle), 150 wcslen(kTitle),
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // TODO(maruel): http://b/1126373 gfx::ElideUrl(document.url(), ...) 194 // TODO(maruel): http://b/1126373 gfx::ElideUrl(document.url(), ...)
197 offset = ReplaceKey(&output, 195 offset = ReplaceKey(&output,
198 offset, 196 offset,
199 wcslen(kUrl), 197 wcslen(kUrl),
200 UTF8ToWide(document.url().spec())); 198 UTF8ToWide(document.url().spec()));
201 } else { 199 } else {
202 // There is just a { in the string. 200 // There is just a { in the string.
203 ++offset; 201 ++offset;
204 } 202 }
205 } 203 }
206 #endif // !defined(OS_LINUX)
207 return output; 204 return output;
208 } 205 }
209 206
210 } // namespace printing 207 } // namespace printing
OLDNEW
« no previous file with comments | « printing/page_overlays.h ('k') | printing/page_overlays_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698