Update file version info/memory details/process utils to use string16.
BUG=23581
TEST=everything still works
Review URL: http://codereview.chromium.org/5968008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70071 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/file_version_info.h b/base/file_version_info.h
index 41a97fa..481e88d 100644
--- a/base/file_version_info.h
+++ b/base/file_version_info.h
@@ -6,15 +6,23 @@
#define BASE_FILE_VERSION_INFO_H__
#pragma once
+#include "build/build_config.h"
+
#include <string>
-#include "build/build_config.h"
+#include "base/string16.h"
class FilePath;
-// Provides an interface for accessing the version information for a file.
-// This is the information you access when you select a file in the Windows
-// explorer, right-click select Properties, then click the Version tab.
+// Provides an interface for accessing the version information for a file. This
+// is the information you access when you select a file in the Windows Explorer,
+// right-click select Properties, then click the Version tab, and on the Mac
+// when you select a file in the Finder and do a Get Info.
+//
+// This list of properties is straight out of Win32's VerQueryValue
+// <http://msdn.microsoft.com/en-us/library/ms647464.aspx> and the Mac
+// version returns values from the Info.plist as appropriate. TODO(avi): make
+// this a less-obvious Windows-ism.
class FileVersionInfo {
public:
@@ -26,33 +34,27 @@
static FileVersionInfo* CreateFileVersionInfo(const FilePath& file_path);
#endif // OS_WIN || OS_MACOSX
-#if defined(OS_WIN)
- // This version, taking a wstring, is deprecated and only kept around
- // until we can fix all callers.
- static FileVersionInfo* CreateFileVersionInfo(const std::wstring& file_path);
-#endif // OS_WIN
-
// Creates a FileVersionInfo for the current module. Returns NULL in case
// of error. The returned object should be deleted when you are done with it.
static FileVersionInfo* CreateFileVersionInfoForCurrentModule();
// Accessors to the different version properties.
// Returns an empty string if the property is not found.
- virtual std::wstring company_name() = 0;
- virtual std::wstring company_short_name() = 0;
- virtual std::wstring product_name() = 0;
- virtual std::wstring product_short_name() = 0;
- virtual std::wstring internal_name() = 0;
- virtual std::wstring product_version() = 0;
- virtual std::wstring private_build() = 0;
- virtual std::wstring special_build() = 0;
- virtual std::wstring comments() = 0;
- virtual std::wstring original_filename() = 0;
- virtual std::wstring file_description() = 0;
- virtual std::wstring file_version() = 0;
- virtual std::wstring legal_copyright() = 0;
- virtual std::wstring legal_trademarks() = 0;
- virtual std::wstring last_change() = 0;
+ virtual string16 company_name() = 0;
+ virtual string16 company_short_name() = 0;
+ virtual string16 product_name() = 0;
+ virtual string16 product_short_name() = 0;
+ virtual string16 internal_name() = 0;
+ virtual string16 product_version() = 0;
+ virtual string16 private_build() = 0;
+ virtual string16 special_build() = 0;
+ virtual string16 comments() = 0;
+ virtual string16 original_filename() = 0;
+ virtual string16 file_description() = 0;
+ virtual string16 file_version() = 0;
+ virtual string16 legal_copyright() = 0;
+ virtual string16 legal_trademarks() = 0;
+ virtual string16 last_change() = 0;
virtual bool is_official_build() = 0;
};
diff --git a/base/file_version_info_mac.h b/base/file_version_info_mac.h
index 36cb538..879edb3 100644
--- a/base/file_version_info_mac.h
+++ b/base/file_version_info_mac.h
@@ -17,39 +17,35 @@
class NSBundle;
#endif
-// Provides a way to access the version information for a file.
-// This is the information you access when you select a file in the Windows
-// explorer, right-click select Properties, then click the Version tab.
-
class FileVersionInfoMac : public FileVersionInfo {
public:
explicit FileVersionInfoMac(NSBundle *bundle);
// Accessors to the different version properties.
// Returns an empty string if the property is not found.
- virtual std::wstring company_name();
- virtual std::wstring company_short_name();
- virtual std::wstring product_name();
- virtual std::wstring product_short_name();
- virtual std::wstring internal_name();
- virtual std::wstring product_version();
- virtual std::wstring private_build();
- virtual std::wstring special_build();
- virtual std::wstring comments();
- virtual std::wstring original_filename();
- virtual std::wstring file_description();
- virtual std::wstring file_version();
- virtual std::wstring legal_copyright();
- virtual std::wstring legal_trademarks();
- virtual std::wstring last_change();
+ virtual string16 company_name();
+ virtual string16 company_short_name();
+ virtual string16 product_name();
+ virtual string16 product_short_name();
+ virtual string16 internal_name();
+ virtual string16 product_version();
+ virtual string16 private_build();
+ virtual string16 special_build();
+ virtual string16 comments();
+ virtual string16 original_filename();
+ virtual string16 file_description();
+ virtual string16 file_version();
+ virtual string16 legal_copyright();
+ virtual string16 legal_trademarks();
+ virtual string16 last_change();
virtual bool is_official_build();
private:
- // Returns a wstring value for a property name.
+ // Returns a string16 value for a property name.
// Returns the empty string if the property does not exist.
- std::wstring GetWStringValue(CFStringRef name);
+ string16 GetString16Value(CFStringRef name);
scoped_nsobject<NSBundle> bundle_;
diff --git a/base/file_version_info_mac.mm b/base/file_version_info_mac.mm
index 6c6dd22..fa97df81 100644
--- a/base/file_version_info_mac.mm
+++ b/base/file_version_info_mac.mm
@@ -27,64 +27,64 @@
return new FileVersionInfoMac(bundle);
}
-std::wstring FileVersionInfoMac::company_name() {
- return std::wstring();
+string16 FileVersionInfoMac::company_name() {
+ return string16();
}
-std::wstring FileVersionInfoMac::company_short_name() {
- return std::wstring();
+string16 FileVersionInfoMac::company_short_name() {
+ return string16();
}
-std::wstring FileVersionInfoMac::internal_name() {
- return std::wstring();
+string16 FileVersionInfoMac::internal_name() {
+ return string16();
}
-std::wstring FileVersionInfoMac::product_name() {
- return GetWStringValue(kCFBundleNameKey);
+string16 FileVersionInfoMac::product_name() {
+ return GetString16Value(kCFBundleNameKey);
}
-std::wstring FileVersionInfoMac::product_short_name() {
- return GetWStringValue(kCFBundleNameKey);
+string16 FileVersionInfoMac::product_short_name() {
+ return GetString16Value(kCFBundleNameKey);
}
-std::wstring FileVersionInfoMac::comments() {
- return std::wstring();
+string16 FileVersionInfoMac::comments() {
+ return string16();
}
-std::wstring FileVersionInfoMac::legal_copyright() {
- return GetWStringValue(CFSTR("CFBundleGetInfoString"));
+string16 FileVersionInfoMac::legal_copyright() {
+ return GetString16Value(CFSTR("CFBundleGetInfoString"));
}
-std::wstring FileVersionInfoMac::product_version() {
- return GetWStringValue(CFSTR("CFBundleShortVersionString"));
+string16 FileVersionInfoMac::product_version() {
+ return GetString16Value(CFSTR("CFBundleShortVersionString"));
}
-std::wstring FileVersionInfoMac::file_description() {
- return std::wstring();
+string16 FileVersionInfoMac::file_description() {
+ return string16();
}
-std::wstring FileVersionInfoMac::legal_trademarks() {
- return std::wstring();
+string16 FileVersionInfoMac::legal_trademarks() {
+ return string16();
}
-std::wstring FileVersionInfoMac::private_build() {
- return std::wstring();
+string16 FileVersionInfoMac::private_build() {
+ return string16();
}
-std::wstring FileVersionInfoMac::file_version() {
+string16 FileVersionInfoMac::file_version() {
return product_version();
}
-std::wstring FileVersionInfoMac::original_filename() {
- return GetWStringValue(kCFBundleNameKey);
+string16 FileVersionInfoMac::original_filename() {
+ return GetString16Value(kCFBundleNameKey);
}
-std::wstring FileVersionInfoMac::special_build() {
- return std::wstring();
+string16 FileVersionInfoMac::special_build() {
+ return string16();
}
-std::wstring FileVersionInfoMac::last_change() {
- return GetWStringValue(CFSTR("SVNRevision"));
+string16 FileVersionInfoMac::last_change() {
+ return GetString16Value(CFSTR("SVNRevision"));
}
bool FileVersionInfoMac::is_official_build() {
@@ -95,13 +95,13 @@
#endif
}
-std::wstring FileVersionInfoMac::GetWStringValue(CFStringRef name) {
+string16 FileVersionInfoMac::GetString16Value(CFStringRef name) {
if (bundle_) {
NSString *ns_name = mac_util::CFToNSCast(name);
NSString* value = [bundle_ objectForInfoDictionaryKey:ns_name];
if (value) {
- return base::SysNSStringToWide(value);
+ return base::SysNSStringToUTF16(value);
}
}
- return std::wstring();
+ return string16();
}
diff --git a/base/file_version_info_win.cc b/base/file_version_info_win.cc
index 6c69708..e2bc84bb 100644
--- a/base/file_version_info_win.cc
+++ b/base/file_version_info_win.cc
@@ -77,70 +77,63 @@
}
}
-// static
-FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
- const std::wstring& file_path) {
- FilePath file_path_fp = FilePath::FromWStringHack(file_path);
- return CreateFileVersionInfo(file_path_fp);
-}
-
-std::wstring FileVersionInfoWin::company_name() {
+string16 FileVersionInfoWin::company_name() {
return GetStringValue(L"CompanyName");
}
-std::wstring FileVersionInfoWin::company_short_name() {
+string16 FileVersionInfoWin::company_short_name() {
return GetStringValue(L"CompanyShortName");
}
-std::wstring FileVersionInfoWin::internal_name() {
+string16 FileVersionInfoWin::internal_name() {
return GetStringValue(L"InternalName");
}
-std::wstring FileVersionInfoWin::product_name() {
+string16 FileVersionInfoWin::product_name() {
return GetStringValue(L"ProductName");
}
-std::wstring FileVersionInfoWin::product_short_name() {
+string16 FileVersionInfoWin::product_short_name() {
return GetStringValue(L"ProductShortName");
}
-std::wstring FileVersionInfoWin::comments() {
+string16 FileVersionInfoWin::comments() {
return GetStringValue(L"Comments");
}
-std::wstring FileVersionInfoWin::legal_copyright() {
+string16 FileVersionInfoWin::legal_copyright() {
return GetStringValue(L"LegalCopyright");
}
-std::wstring FileVersionInfoWin::product_version() {
+string16 FileVersionInfoWin::product_version() {
return GetStringValue(L"ProductVersion");
}
-std::wstring FileVersionInfoWin::file_description() {
+string16 FileVersionInfoWin::file_description() {
return GetStringValue(L"FileDescription");
}
-std::wstring FileVersionInfoWin::legal_trademarks() {
+string16 FileVersionInfoWin::legal_trademarks() {
return GetStringValue(L"LegalTrademarks");
}
-std::wstring FileVersionInfoWin::private_build() {
+string16 FileVersionInfoWin::private_build() {
return GetStringValue(L"PrivateBuild");
}
-std::wstring FileVersionInfoWin::file_version() {
+string16 FileVersionInfoWin::file_version() {
return GetStringValue(L"FileVersion");
}
-std::wstring FileVersionInfoWin::original_filename() {
+string16 FileVersionInfoWin::original_filename() {
return GetStringValue(L"OriginalFilename");
}
-std::wstring FileVersionInfoWin::special_build() {
+string16 FileVersionInfoWin::special_build() {
return GetStringValue(L"SpecialBuild");
}
-std::wstring FileVersionInfoWin::last_change() {
+string16 FileVersionInfoWin::last_change() {
return GetStringValue(L"LastChange");
}
diff --git a/base/file_version_info_win.h b/base/file_version_info_win.h
index 3d60d69..4a49314 100644
--- a/base/file_version_info_win.h
+++ b/base/file_version_info_win.h
@@ -15,10 +15,6 @@
struct tagVS_FIXEDFILEINFO;
typedef tagVS_FIXEDFILEINFO VS_FIXEDFILEINFO;
-// Provides a way to access the version information for a file.
-// This is the information you access when you select a file in the Windows
-// explorer, right-click select Properties, then click the Version tab.
-
class FileVersionInfoWin : public FileVersionInfo {
public:
FileVersionInfoWin(void* data, int language, int code_page);
@@ -26,21 +22,21 @@
// Accessors to the different version properties.
// Returns an empty string if the property is not found.
- virtual std::wstring company_name();
- virtual std::wstring company_short_name();
- virtual std::wstring product_name();
- virtual std::wstring product_short_name();
- virtual std::wstring internal_name();
- virtual std::wstring product_version();
- virtual std::wstring private_build();
- virtual std::wstring special_build();
- virtual std::wstring comments();
- virtual std::wstring original_filename();
- virtual std::wstring file_description();
- virtual std::wstring file_version();
- virtual std::wstring legal_copyright();
- virtual std::wstring legal_trademarks();
- virtual std::wstring last_change();
+ virtual string16 company_name();
+ virtual string16 company_short_name();
+ virtual string16 product_name();
+ virtual string16 product_short_name();
+ virtual string16 internal_name();
+ virtual string16 product_version();
+ virtual string16 private_build();
+ virtual string16 special_build();
+ virtual string16 comments();
+ virtual string16 original_filename();
+ virtual string16 file_description();
+ virtual string16 file_version();
+ virtual string16 legal_copyright();
+ virtual string16 legal_trademarks();
+ virtual string16 last_change();
virtual bool is_official_build();
// Lets you access other properties not covered above.
diff --git a/base/process_util.cc b/base/process_util.cc
index 6293740..7b2935d 100644
--- a/base/process_util.cc
+++ b/base/process_util.cc
@@ -11,7 +11,7 @@
ProcessEntry::~ProcessEntry() {}
#endif
-int GetProcessCount(const std::wstring& executable_name,
+int GetProcessCount(const FilePath::StringType& executable_name,
const ProcessFilter* filter) {
int count = 0;
NamedProcessIterator iter(executable_name, filter);
@@ -20,7 +20,7 @@
return count;
}
-bool KillProcesses(const std::wstring& executable_name, int exit_code,
+bool KillProcesses(const FilePath::StringType& executable_name, int exit_code,
const ProcessFilter* filter) {
bool result = true;
NamedProcessIterator iter(executable_name, filter);
@@ -56,10 +56,10 @@
return found;
}
-NamedProcessIterator::NamedProcessIterator(const std::wstring& executable_name,
- const ProcessFilter* filter)
- : ProcessIterator(filter),
- executable_name_(executable_name) {
+NamedProcessIterator::NamedProcessIterator(
+ const FilePath::StringType& executable_name,
+ const ProcessFilter* filter) : ProcessIterator(filter),
+ executable_name_(executable_name) {
}
NamedProcessIterator::~NamedProcessIterator() {
diff --git a/base/process_util.h b/base/process_util.h
index ccbb687..ce4b0bb1 100644
--- a/base/process_util.h
+++ b/base/process_util.h
@@ -34,10 +34,10 @@
#include <vector>
#include "base/file_descriptor_shuffle.h"
+#include "base/file_path.h"
#include "base/process.h"
class CommandLine;
-class FilePath;
namespace base {
@@ -322,7 +322,7 @@
// Returns the number of processes on the machine that are running from the
// given executable name. If filter is non-null, then only processes selected
// by the filter will be counted.
-int GetProcessCount(const std::wstring& executable_name,
+int GetProcessCount(const FilePath::StringType& executable_name,
const ProcessFilter* filter);
// Attempts to kill all the processes on the current machine that were launched
@@ -330,7 +330,7 @@
// filter is non-null, then only processes selected by the filter are killed.
// Returns true if all processes were able to be killed off, false if at least
// one couldn't be killed.
-bool KillProcesses(const std::wstring& executable_name, int exit_code,
+bool KillProcesses(const FilePath::StringType& executable_name, int exit_code,
const ProcessFilter* filter);
// Attempts to kill the process identified by the given process
@@ -377,7 +377,7 @@
// is non-null, then only processes selected by the filter are waited on.
// Returns after all processes have exited or wait_milliseconds have expired.
// Returns true if all the processes exited, false otherwise.
-bool WaitForProcessesToExit(const std::wstring& executable_name,
+bool WaitForProcessesToExit(const FilePath::StringType& executable_name,
int64 wait_milliseconds,
const ProcessFilter* filter);
@@ -396,7 +396,7 @@
// on. Killed processes are ended with the given exit code. Returns false if
// any processes needed to be killed, true if they all exited cleanly within
// the wait_milliseconds delay.
-bool CleanupProcesses(const std::wstring& executable_name,
+bool CleanupProcesses(const FilePath::StringType& executable_name,
int64 wait_milliseconds,
int exit_code,
const ProcessFilter* filter);
@@ -457,7 +457,7 @@
// until it returns false.
class NamedProcessIterator : public ProcessIterator {
public:
- NamedProcessIterator(const std::wstring& executable_name,
+ NamedProcessIterator(const FilePath::StringType& executable_name,
const ProcessFilter* filter);
virtual ~NamedProcessIterator();
@@ -465,7 +465,7 @@
virtual bool IncludeEntry();
private:
- std::wstring executable_name_;
+ FilePath::StringType executable_name_;
DISALLOW_COPY_AND_ASSIGN(NamedProcessIterator);
};
diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc
index ff5e9316..670de6a 100644
--- a/base/process_util_linux.cc
+++ b/base/process_util_linux.cc
@@ -220,8 +220,7 @@
}
bool NamedProcessIterator::IncludeEntry() {
- // TODO(port): make this also work for non-ASCII filenames
- if (WideToASCII(executable_name_) != entry().exe_file())
+ if (executable_name_ != entry().exe_file())
return false;
return ProcessIterator::IncludeEntry();
}
diff --git a/base/process_util_mac.mm b/base/process_util_mac.mm
index d210670..aa0f14d 100644
--- a/base/process_util_mac.mm
+++ b/base/process_util_mac.mm
@@ -169,7 +169,7 @@
}
bool NamedProcessIterator::IncludeEntry() {
- return (SysWideToUTF8(executable_name_) == entry().exe_file() &&
+ return (executable_name_ == entry().exe_file() &&
ProcessIterator::IncludeEntry());
}
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc
index 3d296748..cd2eedd4 100644
--- a/base/process_util_posix.cc
+++ b/base/process_util_posix.cc
@@ -877,7 +877,7 @@
return GetAppOutputInternal(cl, &empty_environ, output, max_output, false);
}
-bool WaitForProcessesToExit(const std::wstring& executable_name,
+bool WaitForProcessesToExit(const FilePath::StringType& executable_name,
int64 wait_milliseconds,
const ProcessFilter* filter) {
bool result = false;
@@ -899,7 +899,7 @@
return result;
}
-bool CleanupProcesses(const std::wstring& executable_name,
+bool CleanupProcesses(const FilePath::StringType& executable_name,
int64 wait_milliseconds,
int exit_code,
const ProcessFilter* filter) {
diff --git a/chrome/app/breakpad_win.cc b/chrome/app/breakpad_win.cc
index 863dda6..017e61d 100644
--- a/chrome/app/breakpad_win.cc
+++ b/chrome/app/breakpad_win.cc
@@ -92,7 +92,7 @@
google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& dll_path,
const std::wstring& type) {
scoped_ptr<FileVersionInfo>
- version_info(FileVersionInfo::CreateFileVersionInfo(dll_path));
+ version_info(FileVersionInfo::CreateFileVersionInfo(FilePath(dll_path)));
std::wstring version, product;
if (version_info.get()) {
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index 9d5c3e6..9ecc0ef2 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -2339,11 +2339,11 @@
DictionaryValue* properties = new DictionaryValue;
properties->SetString("ChromeVersion", chrome::kChromeVersion);
properties->SetString("BrowserProcessExecutableName",
- WideToUTF16Hack(chrome::kBrowserProcessExecutableName));
+ chrome::kBrowserProcessExecutableName);
properties->SetString("HelperProcessExecutableName",
- WideToUTF16Hack(chrome::kHelperProcessExecutableName));
+ chrome::kHelperProcessExecutableName);
properties->SetString("BrowserProcessExecutablePath",
- WideToUTF16Hack(chrome::kBrowserProcessExecutablePath));
+ chrome::kBrowserProcessExecutablePath);
properties->SetString("HelperProcessExecutablePath",
chrome::kHelperProcessExecutablePath);
properties->SetString("command_line_string",
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc
index af18da1..715f460 100644
--- a/chrome/browser/browser_about_handler.cc
+++ b/chrome/browser/browser_about_handler.cc
@@ -836,7 +836,7 @@
data->SetInteger("comm_map", static_cast<int>(info->committed.mapped));
data->SetInteger("comm_image", static_cast<int>(info->committed.image));
data->SetInteger("pid", info->pid);
- data->SetString("version", WideToUTF16Hack(info->version));
+ data->SetString("version", info->version);
data->SetInteger("processes", info->num_processes);
}
@@ -858,7 +858,7 @@
ListValue* titles = new ListValue();
child->Set("titles", titles);
for (size_t i = 0; i < info->titles.size(); ++i)
- titles->Append(new StringValue(WideToUTF16Hack(info->titles[i])));
+ titles->Append(new StringValue(info->titles[i]));
}
@@ -897,15 +897,14 @@
}
DictionaryValue* browser_data = new DictionaryValue();
browsers->Append(browser_data);
- browser_data->SetString("name",
- WideToUTF16Hack(browser_processes[index].name));
+ browser_data->SetString("name", browser_processes[index].name);
BindProcessMetrics(browser_data, &aggregate);
// We log memory info as we record it.
if (log_string.length() > 0)
log_string.append(L", ");
- log_string.append(browser_processes[index].name);
+ log_string.append(UTF16ToWide(browser_processes[index].name));
log_string.append(L", ");
log_string.append(UTF8ToWide(
base::Int64ToString(aggregate.working_set.priv)));
@@ -926,7 +925,7 @@
root.Set("child_data", child_data);
ProcessData process = browser_processes[0]; // Chrome is the first browser.
- root.SetString("current_browser_name", WideToUTF16Hack(process.name));
+ root.SetString("current_browser_name", process.name);
for (size_t index = 0; index < process.processes.size(); index++) {
if (process.processes[index].type == ChildProcessInfo::BROWSER_PROCESS)
diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc
index cd72b25..6f83083a 100644
--- a/chrome/browser/memory_details.cc
+++ b/chrome/browser/memory_details.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/memory_details.h"
+#include "app/l10n_util.h"
#include "base/file_version_info.h"
#include "base/metrics/histogram.h"
#include "base/process_util.h"
@@ -18,6 +19,7 @@
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/url_constants.h"
#include "grit/chromium_strings.h"
+#include "grit/generated_resources.h"
#if defined(OS_LINUX)
#include "chrome/browser/zygote_host_linux.h"
@@ -88,7 +90,7 @@
continue;
info.type = iter->type();
- info.titles.push_back(iter->name());
+ info.titles.push_back(WideToUTF16Hack(iter->name()));
child_info.push_back(info);
}
@@ -149,9 +151,9 @@
contents = host->delegate()->GetAsTabContents();
if (!contents)
continue;
- std::wstring title = UTF16ToWideHack(contents->GetTitle());
+ string16 title = contents->GetTitle();
if (!title.length())
- title = L"Untitled";
+ title = l10n_util::GetStringUTF16(IDS_DEFAULT_TAB_TITLE);
process.titles.push_back(title);
// We need to check the pending entry as well as the virtual_url to
diff --git a/chrome/browser/memory_details.h b/chrome/browser/memory_details.h
index 2b152b6..b39a1a6 100644
--- a/chrome/browser/memory_details.h
+++ b/chrome/browser/memory_details.h
@@ -10,6 +10,7 @@
#include "base/process_util.h"
#include "base/ref_counted.h"
+#include "base/string16.h"
#include "chrome/common/child_process_info.h"
// We collect data about each browser process. A browser may
@@ -26,9 +27,9 @@
// The committed bytes.
base::CommittedKBytes committed;
// The process version
- std::wstring version;
+ string16 version;
// The process product name.
- std::wstring product_name;
+ string16 product_name;
// The number of processes which this memory represents.
int num_processes;
// A process is a diagnostics process if it is rendering
@@ -37,7 +38,7 @@
// If this is a child process of Chrome, what type (i.e. plugin) it is.
ChildProcessInfo::ProcessType type;
// A collection of titles used, i.e. for a tab it'll show all the page titles.
- std::vector<std::wstring> titles;
+ std::vector<string16> titles;
};
typedef std::vector<ProcessMemoryInformation> ProcessMemoryInformationList;
@@ -49,8 +50,8 @@
~ProcessData();
ProcessData& operator=(const ProcessData& rhs);
- std::wstring name;
- std::wstring process_name;
+ string16 name;
+ string16 process_name;
ProcessMemoryInformationList processes;
};
diff --git a/chrome/browser/memory_details_linux.cc b/chrome/browser/memory_details_linux.cc
index 14506c3..a5e58b8 100644
--- a/chrome/browser/memory_details_linux.cc
+++ b/chrome/browser/memory_details_linux.cc
@@ -240,8 +240,8 @@
GetAllChildren(processes, getpid(), zygote, ¤t_browser_processes);
ProcessData current_browser;
GetProcessDataMemoryInformation(current_browser_processes, ¤t_browser);
- current_browser.name = chrome::kBrowserAppName;
- current_browser.process_name = L"chrome";
+ current_browser.name = WideToUTF16(chrome::kBrowserAppName);
+ current_browser.process_name = ASCIIToUTF16("chrome");
process_data_.push_back(current_browser);
// For each browser process, collect a list of its children and get the
@@ -258,7 +258,7 @@
if (j->pid == *i) {
BrowserType type = GetBrowserType(j->name);
if (type != MAX_BROWSERS)
- browser.name = ASCIIToWide(kBrowserPrettyNames[type]);
+ browser.name = ASCIIToUTF16(kBrowserPrettyNames[type]);
break;
}
}
diff --git a/chrome/browser/memory_details_mac.cc b/chrome/browser/memory_details_mac.cc
index b17d25f..09a298f 100644
--- a/chrome/browser/memory_details_mac.cc
+++ b/chrome/browser/memory_details_mac.cc
@@ -51,8 +51,8 @@
MemoryDetails::MemoryDetails() {
- static const std::wstring google_browser_name =
- l10n_util::GetString(IDS_PRODUCT_NAME);
+ static const std::string google_browser_name =
+ l10n_util::GetStringUTF8(IDS_PRODUCT_NAME);
// (Human and process) names of browsers; should match the ordering for
// |BrowserProcess| (i.e., |BrowserType|).
// TODO(viettrungluu): The current setup means that we can't detect both
@@ -60,21 +60,21 @@
// TODO(viettrungluu): Get localized browser names for other browsers
// (crbug.com/25779).
struct {
- const wchar_t* name;
- const wchar_t* process_name;
+ const char* name;
+ const char* process_name;
} process_template[MAX_BROWSERS] = {
{ google_browser_name.c_str(), chrome::kBrowserProcessExecutableName, },
- { L"Safari", L"Safari", },
- { L"Firefox", L"firefox-bin", },
- { L"Camino", L"Camino", },
- { L"Opera", L"Opera", },
- { L"OmniWeb", L"OmniWeb", },
+ { "Safari", "Safari", },
+ { "Firefox", "firefox-bin", },
+ { "Camino", "Camino", },
+ { "Opera", "Opera", },
+ { "OmniWeb", "OmniWeb", },
};
for (size_t index = 0; index < MAX_BROWSERS; ++index) {
ProcessData process;
- process.name = process_template[index].name;
- process.process_name = process_template[index].process_name;
+ process.name = UTF8ToUTF16(process_template[index].name);
+ process.process_name = UTF8ToUTF16(process_template[index].process_name);
process_data_.push_back(process);
}
}
@@ -104,8 +104,8 @@
std::vector<base::ProcessId> pids_by_browser[MAX_BROWSERS];
std::vector<base::ProcessId> all_pids;
for (size_t index = CHROME_BROWSER; index < MAX_BROWSERS; index++) {
- base::NamedProcessIterator process_it(process_data_[index].process_name,
- NULL);
+ base::NamedProcessIterator process_it(
+ UTF16ToUTF8(process_data_[index].process_name), NULL);
while (const base::ProcessEntry* entry = process_it.NextProcessEntry()) {
pids_by_browser[index].push_back(entry->pid());
@@ -158,7 +158,7 @@
info.version = version_info->product_version();
} else {
info.product_name = process_data_[index].name;
- info.version = L"";
+ info.version = string16();
}
// Memory info.
@@ -202,11 +202,11 @@
chrome::VersionInfo version_info;
if (version_info.is_valid()) {
- info.product_name = ASCIIToWide(version_info.Name());
- info.version = ASCIIToWide(version_info.Version());
+ info.product_name = ASCIIToUTF16(version_info.Name());
+ info.version = ASCIIToUTF16(version_info.Version());
} else {
info.product_name = process_data_[CHROME_BROWSER].name;
- info.version = L"";
+ info.version = string16();
}
// Check if this is one of the child processes whose data we collected
diff --git a/chrome/browser/memory_details_win.cc b/chrome/browser/memory_details_win.cc
index 959cebd..91f0b6d 100644
--- a/chrome/browser/memory_details_win.cc
+++ b/chrome/browser/memory_details_win.cc
@@ -6,6 +6,7 @@
#include <psapi.h>
#include "app/l10n_util.h"
+#include "base/file_path.h"
#include "base/file_version_info.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -135,7 +136,7 @@
} else if (GetModuleFileNameEx(handle, NULL, name, MAX_PATH - 1)) {
std::wstring str_name(name);
scoped_ptr<FileVersionInfo> version_info(
- FileVersionInfo::CreateFileVersionInfo(str_name));
+ FileVersionInfo::CreateFileVersionInfo(FilePath(str_name)));
if (version_info != NULL) {
info.version = version_info->product_version();
info.product_name = version_info->product_name();
diff --git a/chrome/browser/process_singleton_linux.cc b/chrome/browser/process_singleton_linux.cc
index 8418ee96..a95d668 100644
--- a/chrome/browser/process_singleton_linux.cc
+++ b/chrome/browser/process_singleton_linux.cc
@@ -315,7 +315,7 @@
FilePath other_chrome_path(base::GetProcessExecutablePath(pid));
return (!other_chrome_path.empty() &&
other_chrome_path.BaseName() ==
- FilePath::FromWStringHack(chrome::kBrowserProcessExecutableName));
+ FilePath(chrome::kBrowserProcessExecutableName));
}
// Return true if the given pid is one of our child processes.
diff --git a/chrome/browser/process_singleton_uitest.cc b/chrome/browser/process_singleton_uitest.cc
index 57656c2..f04b29f 100644
--- a/chrome/browser/process_singleton_uitest.cc
+++ b/chrome/browser/process_singleton_uitest.cc
@@ -61,7 +61,7 @@
FilePath browser_directory;
PathService::Get(chrome::DIR_APP, &browser_directory);
CommandLine command_line(browser_directory.Append(
- FilePath::FromWStringHack(chrome::kBrowserProcessExecutablePath)));
+ chrome::kBrowserProcessExecutablePath));
command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir_);
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc
index 8c0a8c4..b74df15 100644
--- a/chrome/browser/shell_integration_linux.cc
+++ b/chrome/browser/shell_integration_linux.cc
@@ -293,7 +293,7 @@
FilePath ShellIntegration::GetDesktopShortcutFilename(const GURL& url) {
// Use a prefix, because xdg-desktop-menu requires it.
std::string filename =
- WideToUTF8(chrome::kBrowserProcessExecutableName) + "-" + url.spec();
+ std::string(chrome::kBrowserProcessExecutableName) + "-" + url.spec();
file_util::ReplaceIllegalCharactersInPath(&filename, '_');
FilePath desktop_path;
diff --git a/chrome/browser/shell_integration_unittest.cc b/chrome/browser/shell_integration_unittest.cc
index c832b74..9b9a218c 100644
--- a/chrome/browser/shell_integration_unittest.cc
+++ b/chrome/browser/shell_integration_unittest.cc
@@ -150,7 +150,7 @@
{ FPL("http___.._.desktop"), "http://../../../../" },
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); i++) {
- EXPECT_EQ(WideToASCII(chrome::kBrowserProcessExecutableName) + "-" +
+ EXPECT_EQ(std::string(chrome::kBrowserProcessExecutableName) + "-" +
test_cases[i].path,
ShellIntegration::GetDesktopShortcutFilename(
GURL(test_cases[i].url)).value()) <<
diff --git a/chrome/common/chrome_constants.cc b/chrome/common/chrome_constants.cc
index 61edf54..97bb58e2 100644
--- a/chrome/common/chrome_constants.cc
+++ b/chrome/common/chrome_constants.cc
@@ -11,10 +11,8 @@
#if defined(OS_MACOSX)
#if defined(GOOGLE_CHROME_BUILD)
#define PRODUCT_STRING "Google Chrome"
-#define PRODUCT_STRING_W L"Google Chrome"
#elif defined(CHROMIUM_BUILD)
#define PRODUCT_STRING "Chromium"
-#define PRODUCT_STRING_W L"Chromium"
#else
#error Unknown branding
#endif
@@ -27,26 +25,27 @@
// The following should not be used for UI strings; they are meant
// for system strings only. UI changes should be made in the GRD.
#if defined(OS_WIN)
-const wchar_t kBrowserProcessExecutableName[] = L"chrome.exe";
-const wchar_t kHelperProcessExecutableName[] = L"chrome.exe";
+const FilePath::CharType kBrowserProcessExecutableName[] = FPL("chrome.exe");
+const FilePath::CharType kHelperProcessExecutableName[] = FPL("chrome.exe");
#elif defined(OS_LINUX)
-const wchar_t kBrowserProcessExecutableName[] = L"chrome";
+const FilePath::CharType kBrowserProcessExecutableName[] = FPL("chrome");
// Helper processes end up with a name of "exe" due to execing via
// /proc/self/exe. See bug 22703.
-const wchar_t kHelperProcessExecutableName[] = L"exe";
+const FilePath::CharType kHelperProcessExecutableName[] = FPL("exe");
#elif defined(OS_MACOSX)
-const wchar_t kBrowserProcessExecutableName[] = PRODUCT_STRING_W;
-const wchar_t kHelperProcessExecutableName[] = PRODUCT_STRING_W L" Helper";
+const FilePath::CharType kBrowserProcessExecutableName[] = FPL(PRODUCT_STRING);
+const FilePath::CharType kHelperProcessExecutableName[] =
+ FPL(PRODUCT_STRING " Helper");
#endif // OS_*
#if defined(OS_WIN)
-const wchar_t kBrowserProcessExecutablePath[] = L"chrome.exe";
+const FilePath::CharType kBrowserProcessExecutablePath[] = FPL("chrome.exe");
const FilePath::CharType kHelperProcessExecutablePath[] = FPL("chrome.exe");
#elif defined(OS_LINUX)
-const wchar_t kBrowserProcessExecutablePath[] = L"chrome";
+const FilePath::CharType kBrowserProcessExecutablePath[] = FPL("chrome");
const FilePath::CharType kHelperProcessExecutablePath[] = FPL("chrome");
#elif defined(OS_MACOSX)
-const wchar_t kBrowserProcessExecutablePath[] =
- PRODUCT_STRING_W L".app/Contents/MacOS/" PRODUCT_STRING_W;
+const FilePath::CharType kBrowserProcessExecutablePath[] =
+ FPL(PRODUCT_STRING ".app/Contents/MacOS/" PRODUCT_STRING);
const FilePath::CharType kHelperProcessExecutablePath[] =
FPL(PRODUCT_STRING " Helper.app/Contents/MacOS/" PRODUCT_STRING " Helper");
#endif // OS_*
diff --git a/chrome/common/chrome_constants.h b/chrome/common/chrome_constants.h
index 57e48a86..56be2f8 100644
--- a/chrome/common/chrome_constants.h
+++ b/chrome/common/chrome_constants.h
@@ -16,9 +16,9 @@
extern const char kChromeVersionEnvVar[];
-extern const wchar_t kBrowserProcessExecutableName[];
-extern const wchar_t kHelperProcessExecutableName[];
-extern const wchar_t kBrowserProcessExecutablePath[];
+extern const FilePath::CharType kBrowserProcessExecutableName[];
+extern const FilePath::CharType kHelperProcessExecutableName[];
+extern const FilePath::CharType kBrowserProcessExecutablePath[];
extern const FilePath::CharType kHelperProcessExecutablePath[];
#if defined(OS_MACOSX)
extern const FilePath::CharType kFrameworkName[];
diff --git a/chrome/common/chrome_version_info.cc b/chrome/common/chrome_version_info.cc
index 5157c4a4e..7bca883d 100644
--- a/chrome/common/chrome_version_info.cc
+++ b/chrome/common/chrome_version_info.cc
@@ -32,19 +32,19 @@
std::string VersionInfo::Name() const {
if (!is_valid())
return std::string();
- return WideToASCII(version_info_->product_name());
+ return UTF16ToASCII(version_info_->product_name());
}
std::string VersionInfo::Version() const {
if (!is_valid())
return std::string();
- return WideToASCII(version_info_->product_version());
+ return UTF16ToASCII(version_info_->product_version());
}
std::string VersionInfo::LastChange() const {
if (!is_valid())
return std::string();
- return WideToASCII(version_info_->last_change());
+ return UTF16ToASCII(version_info_->last_change());
}
bool VersionInfo::IsOfficialBuild() const {
diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc
index 39e8524..a90b265 100644
--- a/chrome/test/in_process_browser_test.cc
+++ b/chrome/test/in_process_browser_test.cc
@@ -88,12 +88,7 @@
FilePath chrome_path;
CHECK(PathService::Get(base::FILE_EXE, &chrome_path));
chrome_path = chrome_path.DirName();
-#if defined(OS_WIN)
chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath);
-#elif defined(OS_POSIX)
- chrome_path = chrome_path.Append(
- WideToASCII(chrome::kBrowserProcessExecutablePath));
-#endif
CHECK(PathService::Override(base::FILE_EXE, chrome_path));
test_server_.reset(new net::TestServer(
diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc
index 24bf087..ffa6190 100644
--- a/chrome/test/reliability/page_load_test.cc
+++ b/chrome/test/reliability/page_load_test.cc
@@ -163,7 +163,8 @@
#if defined(OS_WIN)
// Check file version info for chrome dll.
scoped_ptr<FileVersionInfo> file_info;
- file_info.reset(FileVersionInfo::CreateFileVersionInfo(kChromeDll));
+ file_info.reset(
+ FileVersionInfo::CreateFileVersionInfo(FilePath(kChromeDll)));
last_change = WideToASCII(file_info->last_change());
#elif defined(OS_LINUX) || defined(OS_MACOSX)
// TODO(fmeawad): On Mac, the version retrieved here belongs to the test
diff --git a/chrome/test/startup/startup_test.cc b/chrome/test/startup/startup_test.cc
index 5cbdc10..e78083f 100644
--- a/chrome/test/startup/startup_test.cc
+++ b/chrome/test/startup/startup_test.cc
@@ -135,7 +135,7 @@
ASSERT_TRUE(PathService::Get(chrome::DIR_APP, &dir_app));
FilePath chrome_exe(dir_app.Append(
- FilePath::FromWStringHack(chrome::kBrowserProcessExecutablePath)));
+ chrome::kBrowserProcessExecutablePath));
ASSERT_TRUE(EvictFileFromSystemCacheWrapper(chrome_exe));
#if defined(OS_WIN)
// chrome.dll is windows specific.
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index f8c723b..ebc285ad 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -756,7 +756,7 @@
bool wait,
base::ProcessHandle* process) {
FilePath command = browser_directory_.Append(
- FilePath::FromWStringHack(chrome::kBrowserProcessExecutablePath));
+ chrome::kBrowserProcessExecutablePath);
CommandLine command_line(command);
diff --git a/chrome_frame/crash_reporting/minidump_test.cc b/chrome_frame/crash_reporting/minidump_test.cc
index 3fa6653..9b4ef22 100644
--- a/chrome_frame/crash_reporting/minidump_test.cc
+++ b/chrome_frame/crash_reporting/minidump_test.cc
@@ -298,7 +298,7 @@
dbg_help_file,
arraysize(dbg_help_file)));
scoped_ptr<FileVersionInfo> file_info(
- FileVersionInfo::CreateFileVersionInfo(dbg_help_file));
+ FileVersionInfo::CreateFileVersionInfo(FilePath(dbg_help_file)));
ASSERT_TRUE(file_info != NULL);
VLOG(1) << "DbgHelp.dll version: " << file_info->file_version();
diff --git a/chrome_frame/test/reliability/page_load_test.cc b/chrome_frame/test/reliability/page_load_test.cc
index 3afdadf..adc681e 100644
--- a/chrome_frame/test/reliability/page_load_test.cc
+++ b/chrome_frame/test/reliability/page_load_test.cc
@@ -158,7 +158,8 @@
// Check file version info for chrome dll.
scoped_ptr<FileVersionInfo> file_info;
#if defined(OS_WIN)
- file_info.reset(FileVersionInfo::CreateFileVersionInfo(kChromeDll));
+ file_info.reset(
+ FileVersionInfo::CreateFileVersionInfo(FilePath(kChromeDll)));
#elif defined(OS_LINUX) || defined(OS_MACOSX)
// TODO(fmeawad): the version retrieved here belongs to the test module and
// not the chrome binary, need to be changed to chrome binary instead.
diff --git a/chrome_frame/test/util_unittests.cc b/chrome_frame/test/util_unittests.cc
index ac4bccf..9cdf9f6c2 100644
--- a/chrome_frame/test/util_unittests.cc
+++ b/chrome_frame/test/util_unittests.cc
@@ -58,7 +58,7 @@
// Use the method that goes to disk
scoped_ptr<FileVersionInfo> base_info(
- FileVersionInfo::CreateFileVersionInfo(path));
+ FileVersionInfo::CreateFileVersionInfo(FilePath(path)));
EXPECT_TRUE(base_info.get() != NULL);
// Use the method that doesn't go to disk
diff --git a/net/test/test_server_posix.cc b/net/test/test_server_posix.cc
index d14561e..de42fb3 100644
--- a/net/test/test_server_posix.cc
+++ b/net/test/test_server_posix.cc
@@ -118,7 +118,7 @@
// Try to kill any orphaned testserver processes that may be running.
OrphanedTestServerFilter filter(testserver_path.value(),
base::IntToString(host_port_pair_.port()));
- if (!base::KillProcesses(L"python", -1, &filter)) {
+ if (!base::KillProcesses("python", -1, &filter)) {
LOG(WARNING) << "Failed to clean up older orphaned testserver instances.";
}
diff --git a/webkit/plugins/npapi/plugin_lib_win.cc b/webkit/plugins/npapi/plugin_lib_win.cc
index 6132d45..29d014f0 100644
--- a/webkit/plugins/npapi/plugin_lib_win.cc
+++ b/webkit/plugins/npapi/plugin_lib_win.cc
@@ -22,7 +22,7 @@
// For example:
// video/quicktime|audio/aiff|image/jpeg
scoped_ptr<FileVersionInfo> version_info(
- FileVersionInfo::CreateFileVersionInfo(filename.value()));
+ FileVersionInfo::CreateFileVersionInfo(filename));
if (!version_info.get()) {
LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "Could not get version info for plugin "