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

Side by Side Diff: chrome/browser/printing/page_overlays.cc

Issue 60118: Implement Printer Preference Persistence (Step 1/3) (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 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 "chrome/browser/printing/page_overlays.h" 5 #include "chrome/browser/printing/page_overlays.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/printing/printed_document.h" 9 #include "chrome/browser/printing/printed_document.h"
10 #include "chrome/browser/printing/printed_page.h" 10 #include "chrome/browser/printing/printed_page.h"
11 #include "chrome/common/gfx/text_elider.h" 11 #include "chrome/common/gfx/text_elider.h"
(...skipping 65 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,
88 std::wstring& input) {
89 switch (x) {
90 case LEFT:
91 switch (y) {
92 case TOP:
93 top_left = input;
94 break;
95 case BOTTOM:
96 bottom_left = input;
97 break;
98 default:
99 NOTREACHED();
100 break;
101 }
102 break;
103 case CENTER:
104 switch (y) {
105 case TOP:
106 top_center = input;
107 break;
108 case BOTTOM:
109 bottom_center = input;
110 break;
111 default:
112 NOTREACHED();
113 break;
114 }
115 break;
116 case RIGHT:
117 switch (y) {
118 case TOP:
119 top_right = input;
120 break;
121 case BOTTOM:
122 bottom_right = input;
123 break;
124 default:
125 NOTREACHED();
126 break;
127 }
128 break;
129 default:
130 NOTREACHED();
131 break;
132 }
133 }
134
87 //static 135 //static
88 std::wstring PageOverlays::ReplaceVariables(const std::wstring& input, 136 std::wstring PageOverlays::ReplaceVariables(const std::wstring& input,
89 const PrintedDocument& document, 137 const PrintedDocument& document,
90 const PrintedPage& page) { 138 const PrintedPage& page) {
91 std::wstring output(input); 139 std::wstring output(input);
92 for (size_t offset = output.find(L'{', 0); 140 for (size_t offset = output.find(L'{', 0);
93 offset != std::wstring::npos; 141 offset != std::wstring::npos;
94 offset = output.find(L'{', offset)) { 142 offset = output.find(L'{', offset)) {
95 143
96 if (0 == output.compare(offset, 144 if (0 == output.compare(offset,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 UTF8ToWide(document.url().spec())); 197 UTF8ToWide(document.url().spec()));
150 } else { 198 } else {
151 // There is just a { in the string. 199 // There is just a { in the string.
152 ++offset; 200 ++offset;
153 } 201 }
154 } 202 }
155 return output; 203 return output;
156 } 204 }
157 205
158 } // namespace printing 206 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/page_overlays.h ('k') | chrome/browser/printing/page_overlays_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698