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

Unified Diff: printing/printed_document.cc

Issue 3292019: Printing: Convert several wstrings to string16. (Closed)
Patch Set: Review fixes. Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « printing/printed_document.h ('k') | printing/printed_pages_source.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/printed_document.cc
diff --git a/printing/printed_document.cc b/printing/printed_document.cc
index f75a7169562e2050e7fd6e5e2b013ce8f910b44b..560f95bab4ef72a3cfefa892fe91dbf5c16643b7 100644
--- a/printing/printed_document.cc
+++ b/printing/printed_document.cc
@@ -10,6 +10,7 @@
#include <vector>
#include "app/text_elider.h"
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/i18n/file_util_icu.h"
#include "base/message_loop.h"
@@ -40,7 +41,7 @@ struct PrintDebugDumpPath {
}
bool enabled;
- std::wstring debug_dump_path;
+ FilePath debug_dump_path;
};
Singleton<PrintDebugDumpPath> g_debug_dump_info;
@@ -269,37 +270,29 @@ void PrintedDocument::DebugDump(const PrintedPage& page) {
if (!g_debug_dump_info->enabled)
return;
- std::wstring filename;
+ string16 filename;
filename += date();
- filename += L"_";
+ filename += ASCIIToUTF16("_");
filename += time();
- filename += L"_";
+ filename += ASCIIToUTF16("_");
filename += name();
- filename += L"_";
- filename += StringPrintf(L"%02d", page.page_number());
- filename += L"_.emf";
+ filename += ASCIIToUTF16("_");
+ filename += ASCIIToUTF16(StringPrintf("%02d", page.page_number()));
+ filename += ASCIIToUTF16("_.emf");
#if defined(OS_WIN)
- file_util::ReplaceIllegalCharactersInPath(&filename, '_');
-#else
- std::string narrow_filename = WideToUTF8(filename);
- file_util::ReplaceIllegalCharactersInPath(&narrow_filename, '_');
- filename = UTF8ToWide(narrow_filename);
-#endif
- FilePath path = FilePath::FromWStringHack(
- g_debug_dump_info->debug_dump_path);
-#if defined(OS_WIN)
- page.native_metafile()->SaveTo(path.Append(filename).ToWStringHack());
+ page.native_metafile()->SaveTo(
+ g_debug_dump_info->debug_dump_path.Append(filename).ToWStringHack());
#else // OS_WIN
NOTIMPLEMENTED();
#endif // OS_WIN
}
-void PrintedDocument::set_debug_dump_path(const std::wstring& debug_dump_path) {
+void PrintedDocument::set_debug_dump_path(const FilePath& debug_dump_path) {
g_debug_dump_info->enabled = !debug_dump_path.empty();
g_debug_dump_info->debug_dump_path = debug_dump_path;
}
-const std::wstring& PrintedDocument::debug_dump_path() {
+const FilePath& PrintedDocument::debug_dump_path() {
return g_debug_dump_info->debug_dump_path;
}
@@ -323,12 +316,14 @@ PrintedDocument::Immutable::Immutable(const PrintSettings& settings,
// On Windows, use the native time formatting for printing.
SYSTEMTIME systemtime;
GetLocalTime(&systemtime);
- date_ = win_util::FormatSystemDate(systemtime, std::wstring());
- time_ = win_util::FormatSystemTime(systemtime, std::wstring());
+ date_ =
+ WideToUTF16Hack(win_util::FormatSystemDate(systemtime, std::wstring()));
+ time_ =
+ WideToUTF16Hack(win_util::FormatSystemTime(systemtime, std::wstring()));
#else // OS_WIN
Time now = Time::Now();
- date_ = base::TimeFormatShortDateNumeric(now);
- time_ = base::TimeFormatTimeOfDay(now);
+ date_ = WideToUTF16Hack(base::TimeFormatShortDateNumeric(now));
+ time_ = WideToUTF16Hack(base::TimeFormatTimeOfDay(now));
#endif // OS_WIN
}
« no previous file with comments | « printing/printed_document.h ('k') | printing/printed_pages_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698