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

Side by Side Diff: printing/printed_document.cc

Issue 271056: Do some cleanup of file path name handling. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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
« no previous file with comments | « net/base/net_util_unittest.cc ('k') | printing/printing_context_win.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/printed_document.h" 5 #include "printing/printed_document.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "app/gfx/font.h" 9 #include "app/gfx/font.h"
10 #include "app/gfx/text_elider.h" 10 #include "app/gfx/text_elider.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 256
257 std::wstring filename; 257 std::wstring filename;
258 filename += date(); 258 filename += date();
259 filename += L"_"; 259 filename += L"_";
260 filename += time(); 260 filename += time();
261 filename += L"_"; 261 filename += L"_";
262 filename += name(); 262 filename += name();
263 filename += L"_"; 263 filename += L"_";
264 filename += StringPrintf(L"%02d", page.page_number()); 264 filename += StringPrintf(L"%02d", page.page_number());
265 filename += L"_.emf"; 265 filename += L"_.emf";
266 file_util::ReplaceIllegalCharacters(&filename, '_'); 266 #if defined(OS_WIN)
267 file_util::ReplaceIllegalCharactersInPath(&filename, '_');
268 #else
269 std::string narrow_filename = WideToUTF8(filename);
270 file_util::ReplaceIllegalCharactersInPath(&narrow_filename, '_');
271 filename = UTF8ToWide(narrow_filename);
272 #endif
267 std::wstring path(g_debug_dump_info->debug_dump_path); 273 std::wstring path(g_debug_dump_info->debug_dump_path);
268 file_util::AppendToPath(&path, filename); 274 file_util::AppendToPath(&path, filename);
269 #if defined(OS_WIN) 275 #if defined(OS_WIN)
270 page.native_metafile()->SaveTo(path); 276 page.native_metafile()->SaveTo(path);
271 #else // OS_WIN 277 #else // OS_WIN
272 NOTIMPLEMENTED(); 278 NOTIMPLEMENTED();
273 #endif // OS_WIN 279 #endif // OS_WIN
274 } 280 }
275 281
276 void PrintedDocument::set_debug_dump_path(const std::wstring& debug_dump_path) { 282 void PrintedDocument::set_debug_dump_path(const std::wstring& debug_dump_path) {
(...skipping 28 matching lines...) Expand all
305 date_ = win_util::FormatSystemDate(systemtime, std::wstring()); 311 date_ = win_util::FormatSystemDate(systemtime, std::wstring());
306 time_ = win_util::FormatSystemTime(systemtime, std::wstring()); 312 time_ = win_util::FormatSystemTime(systemtime, std::wstring());
307 #else // OS_WIN 313 #else // OS_WIN
308 Time now = Time::Now(); 314 Time now = Time::Now();
309 date_ = base::TimeFormatShortDateNumeric(now); 315 date_ = base::TimeFormatShortDateNumeric(now);
310 time_ = base::TimeFormatTimeOfDay(now); 316 time_ = base::TimeFormatTimeOfDay(now);
311 #endif // OS_WIN 317 #endif // OS_WIN
312 } 318 }
313 319
314 } // namespace printing 320 } // namespace printing
OLDNEW
« no previous file with comments | « net/base/net_util_unittest.cc ('k') | printing/printing_context_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698