Commit 19f53ecc authored by thestig's avatar thestig Committed by Commit bot

Cleanup: Don't bother doing no-op wide/utf16 conversions on Windows.

Review URL: https://codereview.chromium.org/879783004

Cr-Commit-Position: refs/heads/master@{#313947}
parent 4be6e487
...@@ -186,16 +186,14 @@ bool UpdateJumpList(const wchar_t* app_id, ...@@ -186,16 +186,14 @@ bool UpdateJumpList(const wchar_t* app_id,
// This update request is applied into the JumpList when we commit this // This update request is applied into the JumpList when we commit this
// transaction. // transaction.
if (!use_profiles_category && !jumplist_updater.AddCustomCategory( if (!use_profiles_category && !jumplist_updater.AddCustomCategory(
base::UTF16ToWide( l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED),
l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED)),
most_visited_pages, profiles_or_most_visited_items)) { most_visited_pages, profiles_or_most_visited_items)) {
return false; return false;
} }
// Update the "Recently Closed" category of the JumpList. // Update the "Recently Closed" category of the JumpList.
if (!jumplist_updater.AddCustomCategory( if (!jumplist_updater.AddCustomCategory(
base::UTF16ToWide( l10n_util::GetStringUTF16(IDS_NEW_TAB_RECENTLY_CLOSED),
l10n_util::GetStringUTF16(IDS_NEW_TAB_RECENTLY_CLOSED)),
recently_closed_pages, recently_closed_items)) { recently_closed_pages, recently_closed_items)) {
return false; return false;
} }
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/version_handler.h" #include "chrome/browser/ui/webui/version_handler.h"
#include "chrome/common/chrome_content_client.h" #include "chrome/common/chrome_content_client.h"
...@@ -97,8 +96,7 @@ WebUIDataSource* CreateVersionUIDataSource() { ...@@ -97,8 +96,7 @@ WebUIDataSource* CreateVersionUIDataSource() {
#if defined(OS_WIN) #if defined(OS_WIN)
html_source->AddString( html_source->AddString(
"command_line", "command_line",
base::WideToUTF16( base::CommandLine::ForCurrentProcess()->GetCommandLineString());
base::CommandLine::ForCurrentProcess()->GetCommandLineString()));
#elif defined(OS_POSIX) #elif defined(OS_POSIX)
std::string command_line; std::string command_line;
typedef std::vector<std::string> ArgvList; typedef std::vector<std::string> ArgvList;
......
...@@ -292,7 +292,7 @@ GURL ReadURLFromInternetShortcut(IUniformResourceLocator* url_locator) { ...@@ -292,7 +292,7 @@ GURL ReadURLFromInternetShortcut(IUniformResourceLocator* url_locator) {
base::win::ScopedCoMem<wchar_t> url; base::win::ScopedCoMem<wchar_t> url;
// GetURL can return S_FALSE (FAILED(S_FALSE) is false) when url == NULL. // GetURL can return S_FALSE (FAILED(S_FALSE) is false) when url == NULL.
return (FAILED(url_locator->GetURL(&url)) || !url) ? return (FAILED(url_locator->GetURL(&url)) || !url) ?
GURL() : GURL(base::WideToUTF16(url.get())); GURL() : GURL(url.get());
} }
// Reads the URL of the favicon of the internet shortcut. // Reads the URL of the favicon of the internet shortcut.
...@@ -317,7 +317,7 @@ GURL ReadFaviconURLFromInternetShortcut(IUniformResourceLocator* url_locator) { ...@@ -317,7 +317,7 @@ GURL ReadFaviconURLFromInternetShortcut(IUniformResourceLocator* url_locator) {
if (FAILED(property_storage->ReadMultiple(1, properties, output.Receive())) || if (FAILED(property_storage->ReadMultiple(1, properties, output.Receive())) ||
output.get().vt != VT_LPWSTR) output.get().vt != VT_LPWSTR)
return GURL(); return GURL();
return GURL(base::WideToUTF16(output.get().pwszVal)); return GURL(output.get().pwszVal);
} }
// Reads the favicon imaga data in an NTFS alternate data stream. This is where // Reads the favicon imaga data in an NTFS alternate data stream. This is where
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "components/crash/app/crash_reporter_client.h" #include "components/crash/app/crash_reporter_client.h"
namespace breakpad { namespace breakpad {
...@@ -95,25 +95,25 @@ CrashKeysWin::GetCustomInfo(const std::wstring& exe_path, ...@@ -95,25 +95,25 @@ CrashKeysWin::GetCustomInfo(const std::wstring& exe_path,
// We only expect this method to be called once per process. // We only expect this method to be called once per process.
// Common enties // Common enties
custom_entries_.push_back( custom_entries_.push_back(
google_breakpad::CustomInfoEntry(L"ver", google_breakpad::CustomInfoEntry(L"ver", version.c_str()));
base::UTF16ToWide(version).c_str()));
custom_entries_.push_back( custom_entries_.push_back(
google_breakpad::CustomInfoEntry(L"prod", google_breakpad::CustomInfoEntry(L"prod", product.c_str()));
base::UTF16ToWide(product).c_str()));
custom_entries_.push_back( custom_entries_.push_back(
google_breakpad::CustomInfoEntry(L"plat", L"Win32")); google_breakpad::CustomInfoEntry(L"plat", L"Win32"));
custom_entries_.push_back( custom_entries_.push_back(
google_breakpad::CustomInfoEntry(L"ptype", type.c_str())); google_breakpad::CustomInfoEntry(L"ptype", type.c_str()));
custom_entries_.push_back(google_breakpad::CustomInfoEntry( custom_entries_.push_back(
L"pid", base::StringPrintf(L"%d", ::GetCurrentProcessId()).c_str())); google_breakpad::CustomInfoEntry(
custom_entries_.push_back(google_breakpad::CustomInfoEntry( L"pid", base::IntToString16(::GetCurrentProcessId()).c_str()));
L"channel", base::UTF16ToWide(channel_name).c_str())); custom_entries_.push_back(
custom_entries_.push_back(google_breakpad::CustomInfoEntry( google_breakpad::CustomInfoEntry(L"channel", channel_name.c_str()));
L"profile-type", profile_type.c_str())); custom_entries_.push_back(
google_breakpad::CustomInfoEntry(L"profile-type", profile_type.c_str()));
if (!special_build.empty())
custom_entries_.push_back(google_breakpad::CustomInfoEntry( if (!special_build.empty()) {
L"special", base::UTF16ToWide(special_build).c_str())); custom_entries_.push_back(
google_breakpad::CustomInfoEntry(L"special", special_build.c_str()));
}
if (type == L"plugin" || type == L"ppapi") { if (type == L"plugin" || type == L"ppapi") {
std::wstring plugin_path = cmd_line->GetSwitchValueNative("plugin-path"); std::wstring plugin_path = cmd_line->GetSwitchValueNative("plugin-path");
...@@ -121,7 +121,6 @@ CrashKeysWin::GetCustomInfo(const std::wstring& exe_path, ...@@ -121,7 +121,6 @@ CrashKeysWin::GetCustomInfo(const std::wstring& exe_path,
SetPluginPath(plugin_path); SetPluginPath(plugin_path);
} }
// Check whether configuration management controls crash reporting. // Check whether configuration management controls crash reporting.
bool crash_reporting_enabled = true; bool crash_reporting_enabled = true;
bool controlled_by_policy = crash_client->ReportingIsEnforcedByPolicy( bool controlled_by_policy = crash_client->ReportingIsEnforcedByPolicy(
......
...@@ -202,8 +202,8 @@ void EnsureSafeExtension(const std::string& mime_type, ...@@ -202,8 +202,8 @@ void EnsureSafeExtension(const std::string& mime_type,
bool FilePathToString16(const base::FilePath& path, base::string16* converted) { bool FilePathToString16(const base::FilePath& path, base::string16* converted) {
#if defined(OS_WIN) #if defined(OS_WIN)
return base::WideToUTF16( *converted = path.value();
path.value().c_str(), path.value().size(), converted); return true;
#elif defined(OS_POSIX) #elif defined(OS_POSIX)
std::string component8 = path.AsUTF8Unsafe(); std::string component8 = path.AsUTF8Unsafe();
return !component8.empty() && return !component8.empty() &&
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "base/i18n/case_conversion.h" #include "base/i18n/case_conversion.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_proxy.h" #include "base/message_loop/message_loop_proxy.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "base/tuple.h" #include "base/tuple.h"
#include "base/win/registry.h" #include "base/win/registry.h"
...@@ -134,10 +133,9 @@ std::wstring FormatFilterForExtensions( ...@@ -134,10 +133,9 @@ std::wstring FormatFilterForExtensions(
// based on the unknown extension type (i.e. if the extension is .qqq, // based on the unknown extension type (i.e. if the extension is .qqq,
// the we create a description "QQQ File (.qqq)"). // the we create a description "QQQ File (.qqq)").
include_all_files = true; include_all_files = true;
desc = l10n_util::GetStringFUTF16( desc = l10n_util::GetStringFUTF16(IDS_APP_SAVEAS_EXTENSION_FORMAT,
IDS_APP_SAVEAS_EXTENSION_FORMAT, base::i18n::ToUpper(ext_name),
base::i18n::ToUpper(base::WideToUTF16(ext_name)), ext_name);
ext_name);
} }
if (desc.empty()) if (desc.empty())
desc = L"*." + ext_name; desc = L"*." + ext_name;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment