summaryrefslogtreecommitdiffstats
path: root/printing/printed_document.cc
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-13 19:39:19 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-13 19:39:19 +0000
commitd9d42998427a6204ddbc5929acc5e4c13c939b07 (patch)
tree48f4193243f2bb2a08ae59f474b20b38ce5c6e93 /printing/printed_document.cc
parent609706121877c28ca2a80c7810e63a47e68806e3 (diff)
downloadchromium_src-d9d42998427a6204ddbc5929acc5e4c13c939b07.zip
chromium_src-d9d42998427a6204ddbc5929acc5e4c13c939b07.tar.gz
chromium_src-d9d42998427a6204ddbc5929acc5e4c13c939b07.tar.bz2
Printing: Convert several wstrings to string16.
BUG=none TEST=none Review URL: http://codereview.chromium.org/3292019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59262 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/printed_document.cc')
-rw-r--r--printing/printed_document.cc41
1 files changed, 18 insertions, 23 deletions
diff --git a/printing/printed_document.cc b/printing/printed_document.cc
index f75a716..560f95b 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
}