summaryrefslogtreecommitdiffstats
path: root/cloud_print
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-06 20:43:31 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-06 20:43:31 +0000
commitca77581c3138913ae4816043d591d1dc4e01eaad (patch)
tree5793efde9b235b339fdd99189270f1143cf1c7b7 /cloud_print
parent464cddaa575a10f5733bfebec77fb6b569dcdd17 (diff)
downloadchromium_src-ca77581c3138913ae4816043d591d1dc4e01eaad.zip
chromium_src-ca77581c3138913ae4816043d591d1dc4e01eaad.tar.gz
chromium_src-ca77581c3138913ae4816043d591d1dc4e01eaad.tar.bz2
Use base namespace for string16 in components and cloud_print.
R=scottbyer@chromium.org TBR=scottbyer Review URL: https://codereview.chromium.org/107383002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239255 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cloud_print')
-rw-r--r--cloud_print/common/win/cloud_print_utils.cc12
-rw-r--r--cloud_print/common/win/cloud_print_utils.h6
-rw-r--r--cloud_print/common/win/install_utils.cc21
-rw-r--r--cloud_print/common/win/install_utils.h17
-rw-r--r--cloud_print/service/win/chrome_launcher.cc2
-rw-r--r--cloud_print/service/win/cloud_print_service.cc21
-rw-r--r--cloud_print/service/win/cloud_print_service_config.cc31
-rw-r--r--cloud_print/service/win/local_security_policy.cc11
-rw-r--r--cloud_print/service/win/local_security_policy.h7
-rw-r--r--cloud_print/service/win/service_controller.cc18
-rw-r--r--cloud_print/service/win/service_controller.h18
-rw-r--r--cloud_print/service/win/service_utils.cc14
-rw-r--r--cloud_print/service/win/service_utils.h4
-rw-r--r--cloud_print/service/win/setup_listener.cc8
-rw-r--r--cloud_print/service/win/setup_listener.h8
-rw-r--r--cloud_print/virtual_driver/win/install/setup.cc20
-rw-r--r--cloud_print/virtual_driver/win/port_monitor/port_monitor.cc10
-rw-r--r--cloud_print/virtual_driver/win/virtual_driver_helpers.cc9
-rw-r--r--cloud_print/virtual_driver/win/virtual_driver_helpers.h5
19 files changed, 125 insertions, 117 deletions
diff --git a/cloud_print/common/win/cloud_print_utils.cc b/cloud_print/common/win/cloud_print_utils.cc
index 71c9b53..ee30964 100644
--- a/cloud_print/common/win/cloud_print_utils.cc
+++ b/cloud_print/common/win/cloud_print_utils.cc
@@ -23,7 +23,7 @@ HRESULT GetLastHResult() {
return error_code ? HRESULT_FROM_WIN32(error_code) : E_FAIL;
}
-string16 LoadLocalString(DWORD id) {
+base::string16 LoadLocalString(DWORD id) {
static wchar_t dummy = L'\0';
HMODULE module = NULL;
::GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT |
@@ -33,21 +33,21 @@ string16 LoadLocalString(DWORD id) {
// LPCWSTR* and assign pointer to read-only memory with resource.
int count = ::LoadString(module, id, reinterpret_cast<LPWSTR>(&buffer), 0);
if (!buffer)
- return string16();
- return string16(buffer, buffer + count);
+ return base::string16();
+ return base::string16(buffer, buffer + count);
}
-string16 GetErrorMessage(HRESULT hr) {
+base::string16 GetErrorMessage(HRESULT hr) {
LPWSTR buffer = NULL;
::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_ALLOCATE_BUFFER,
0, hr, 0, reinterpret_cast<LPWSTR>(&buffer), 0, NULL);
- string16 result(buffer);
+ base::string16 result(buffer);
::LocalFree(buffer);
return result;
}
-void SetGoogleUpdateUsage(const string16& product_id) {
+void SetGoogleUpdateUsage(const base::string16& product_id) {
// Set appropriate key to 1 to let Omaha record usage.
base::win::RegKey key;
if (key.Create(HKEY_CURRENT_USER,
diff --git a/cloud_print/common/win/cloud_print_utils.h b/cloud_print/common/win/cloud_print_utils.h
index 7effa1b..bc9895c 100644
--- a/cloud_print/common/win/cloud_print_utils.h
+++ b/cloud_print/common/win/cloud_print_utils.h
@@ -15,14 +15,14 @@ namespace cloud_print {
HRESULT GetLastHResult();
// Convert an HRESULT to a localized string.
-string16 GetErrorMessage(HRESULT hr);
+base::string16 GetErrorMessage(HRESULT hr);
// Retrieves a string from the string table of the module that contains the
// calling code.
-string16 LoadLocalString(DWORD id);
+base::string16 LoadLocalString(DWORD id);
// Sets registry value to notify Google Update that product was used.
-void SetGoogleUpdateUsage(const string16& product_id);
+void SetGoogleUpdateUsage(const base::string16& product_id);
} // namespace cloud_print
diff --git a/cloud_print/common/win/install_utils.cc b/cloud_print/common/win/install_utils.cc
index 98a3e0d..38113ac 100644
--- a/cloud_print/common/win/install_utils.cc
+++ b/cloud_print/common/win/install_utils.cc
@@ -43,8 +43,8 @@ const wchar_t kNoRepair[] = L"NoRepair";
} // namespace
-void SetGoogleUpdateKeys(const string16& product_id,
- const string16& product_name) {
+void SetGoogleUpdateKeys(const base::string16& product_id,
+ const base::string16& product_name) {
base::win::RegKey key;
if (key.Create(HKEY_LOCAL_MACHINE,
(cloud_print::kClientsKey + product_id).c_str(),
@@ -53,7 +53,7 @@ void SetGoogleUpdateKeys(const string16& product_id,
}
// Get the version from the resource file.
- string16 version_string;
+ base::string16 version_string;
scoped_ptr<FileVersionInfo> version_info(
FileVersionInfo::CreateFileVersionInfoForCurrentModule());
@@ -73,7 +73,8 @@ void SetGoogleUpdateKeys(const string16& product_id,
}
}
-void SetGoogleUpdateError(const string16& product_id, const string16& message) {
+void SetGoogleUpdateError(const base::string16& product_id,
+ const base::string16& message) {
LOG(ERROR) << message;
base::win::RegKey key;
if (key.Create(HKEY_LOCAL_MACHINE,
@@ -90,7 +91,7 @@ void SetGoogleUpdateError(const string16& product_id, const string16& message) {
}
}
-void DeleteGoogleUpdateKeys(const string16& product_id) {
+void DeleteGoogleUpdateKeys(const base::string16& product_id) {
base::win::RegKey key;
if (key.Open(HKEY_LOCAL_MACHINE,
(cloud_print::kClientsKey + product_id).c_str(),
@@ -103,8 +104,8 @@ void DeleteGoogleUpdateKeys(const string16& product_id) {
}
}
-void CreateUninstallKey(const string16& uninstall_id,
- const string16& product_name,
+void CreateUninstallKey(const base::string16& uninstall_id,
+ const base::string16& product_name,
const std::string& uninstall_switch) {
// Now write the Windows Uninstall entries
// Minimal error checking here since the install can continue
@@ -146,12 +147,12 @@ void CreateUninstallKey(const string16& uninstall_id,
key.WriteValue(kNoRepair, 1);
}
-void DeleteUninstallKey(const string16& uninstall_id) {
+void DeleteUninstallKey(const base::string16& uninstall_id) {
::RegDeleteKey(HKEY_LOCAL_MACHINE,
(cloud_print::kUninstallKey + uninstall_id).c_str());
}
-base::FilePath GetInstallLocation(const string16& uninstall_id) {
+base::FilePath GetInstallLocation(const base::string16& uninstall_id) {
base::win::RegKey key;
if (key.Open(HKEY_LOCAL_MACHINE,
(cloud_print::kUninstallKey + uninstall_id).c_str(),
@@ -159,7 +160,7 @@ base::FilePath GetInstallLocation(const string16& uninstall_id) {
// Not installed.
return base::FilePath();
}
- string16 install_path_value;
+ base::string16 install_path_value;
key.ReadValue(kInstallLocation, &install_path_value);
return base::FilePath(install_path_value);
}
diff --git a/cloud_print/common/win/install_utils.h b/cloud_print/common/win/install_utils.h
index 1e484cf..541b4d9 100644
--- a/cloud_print/common/win/install_utils.h
+++ b/cloud_print/common/win/install_utils.h
@@ -14,25 +14,26 @@
namespace cloud_print {
// Sets Google Update registry keys after install or update.
-void SetGoogleUpdateKeys(const string16& product_id,
- const string16& product_name);
+void SetGoogleUpdateKeys(const base::string16& product_id,
+ const base::string16& product_name);
// Sets custom error message to show by Google Update installer
-void SetGoogleUpdateError(const string16& product_id, const string16& message);
+void SetGoogleUpdateError(const base::string16& product_id,
+ const base::string16& message);
// Deletes Google Update reg keys on product uninstall.
-void DeleteGoogleUpdateKeys(const string16& product_id);
+void DeleteGoogleUpdateKeys(const base::string16& product_id);
// Creates control panel uninstall item.
-void CreateUninstallKey(const string16& uninstall_id,
- const string16& product_name,
+void CreateUninstallKey(const base::string16& uninstall_id,
+ const base::string16& product_name,
const std::string& uninstall_switch);
// Deletes control panel uninstall item.
-void DeleteUninstallKey(const string16& uninstall_id);
+void DeleteUninstallKey(const base::string16& uninstall_id);
// Returns install location retrieved from control panel uninstall key.
-base::FilePath GetInstallLocation(const string16& uninstall_id);
+base::FilePath GetInstallLocation(const base::string16& uninstall_id);
// Returns install location retrieved from control panel uninstall key.
void DeleteProgramDir(const std::string& delete_switch);
diff --git a/cloud_print/service/win/chrome_launcher.cc b/cloud_print/service/win/chrome_launcher.cc
index 35d760e..7f3717e 100644
--- a/cloud_print/service/win/chrome_launcher.cc
+++ b/cloud_print/service/win/chrome_launcher.cc
@@ -159,7 +159,7 @@ void DeleteAutorunKeys(const base::FilePath& user_data_dir) {
base::win::RegKey key(HKEY_CURRENT_USER, kAutoRunKeyPath, KEY_SET_VALUE);
if (!key.Valid())
return;
- std::vector<string16> to_delete;
+ std::vector<base::string16> to_delete;
base::FilePath abs_user_data_dir = base::MakeAbsoluteFilePath(user_data_dir);
diff --git a/cloud_print/service/win/cloud_print_service.cc b/cloud_print/service/win/cloud_print_service.cc
index 32fbe80..e0998f0c 100644
--- a/cloud_print/service/win/cloud_print_service.cc
+++ b/cloud_print/service/win/cloud_print_service.cc
@@ -80,12 +80,12 @@ void InvalidUsage() {
std::cout << "\n";
}
-string16 GetOption(int string_id, const string16& default,
+base::string16 GetOption(int string_id, const base::string16& default,
bool secure) {
- string16 prompt_format = cloud_print::LoadLocalString(string_id) ;
- std::vector<string16> substitutions(1, default);
+ base::string16 prompt_format = cloud_print::LoadLocalString(string_id);
+ std::vector<base::string16> substitutions(1, default);
std::cout << ReplaceStringPlaceholders(prompt_format, substitutions, NULL);
- string16 tmp;
+ base::string16 tmp;
if (secure) {
DWORD saved_mode = 0;
// Don't close.
@@ -110,7 +110,7 @@ HRESULT ReportError(HRESULT hr, int string_id) {
return hr;
}
-string16 StateAsString(ServiceController::State state) {
+base::string16 StateAsString(ServiceController::State state) {
DWORD string_id = 0;
switch(state) {
case ServiceController::STATE_NOT_FOUND:
@@ -123,7 +123,7 @@ string16 StateAsString(ServiceController::State state) {
string_id = IDS_SERVICE_RUNNING;
break;
}
- return string_id ? cloud_print::LoadLocalString(string_id) : string16();
+ return string_id ? cloud_print::LoadLocalString(string_id) : base::string16();
}
} // namespace
@@ -214,8 +214,8 @@ class CloudPrintServiceModule
return controller_->UninstallService();
if (command_line.HasSwitch(kInstallSwitch)) {
- string16 run_as_user;
- string16 run_as_password;
+ base::string16 run_as_user;
+ base::string16 run_as_password;
base::FilePath user_data_dir;
std::vector<std::string> printers;
HRESULT hr = SelectWindowsAccount(&run_as_user, &run_as_password,
@@ -262,7 +262,8 @@ class CloudPrintServiceModule
return S_FALSE;
}
- HRESULT SelectWindowsAccount(string16* run_as_user, string16* run_as_password,
+ HRESULT SelectWindowsAccount(base::string16* run_as_user,
+ base::string16* run_as_password,
base::FilePath* user_data_dir,
std::vector<std::string>* printers) {
*run_as_user = GetCurrentUserName();
@@ -339,7 +340,7 @@ class CloudPrintServiceModule
LOG(INFO) << file.value() << ": " << contents;
- string16 message =
+ base::string16 message =
cloud_print::LoadLocalString(IDS_ADD_PRINTERS_USING_CHROME);
std::cout << "\n" << message.c_str() << "\n" ;
std::string new_contents =
diff --git a/cloud_print/service/win/cloud_print_service_config.cc b/cloud_print/service/win/cloud_print_service_config.cc
index ce31e19..d7321f2 100644
--- a/cloud_print/service/win/cloud_print_service_config.cc
+++ b/cloud_print/service/win/cloud_print_service_config.cc
@@ -77,15 +77,15 @@ class SetupDialog : public base::RefCounted<SetupDialog>,
// Disables all controls after users actions.
void DisableControls();
// Updates state of controls after when we received service status.
- void SetState(ServiceController::State state, const string16& user,
+ void SetState(ServiceController::State state, const base::string16& user,
bool is_logging_enabled);
// Show message box with error.
- void ShowErrorMessageBox(const string16& error_message);
+ void ShowErrorMessageBox(const base::string16& error_message);
// Show use message box instructions how to deal with opened Chrome window.
void AskToCloseChrome();
- string16 GetDlgItemText(int id) const;
- string16 GetUser() const;
- string16 GetPassword() const;
+ base::string16 GetDlgItemText(int id) const;
+ base::string16 GetUser() const;
+ base::string16 GetPassword() const;
bool IsLoggingEnabled() const;
bool IsInstalled() const {
return state_ > ServiceController::STATE_NOT_FOUND;
@@ -93,7 +93,7 @@ class SetupDialog : public base::RefCounted<SetupDialog>,
// IO Calls.
// Installs service.
- void Install(const string16& user, const string16& password,
+ void Install(const base::string16& user, const base::string16& password,
bool enable_logging);
// Starts service.
void Start();
@@ -106,7 +106,7 @@ class SetupDialog : public base::RefCounted<SetupDialog>,
// Posts task to UI thread to show error using string id.
void ShowError(int string_id);
// Posts task to UI thread to show error using string.
- void ShowError(const string16& error_message);
+ void ShowError(const base::string16& error_message);
// Posts task to UI thread to show error using error code.
void ShowError(HRESULT hr);
@@ -139,7 +139,7 @@ void SetupDialog::PostIOTask(const base::Closure& task) {
io_loop_->PostTask(FROM_HERE, task);
}
-void SetupDialog::ShowErrorMessageBox(const string16& error_message) {
+void SetupDialog::ShowErrorMessageBox(const base::string16& error_message) {
DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_UI));
MessageBox(error_message.c_str(),
LoadLocalString(IDS_OPERATION_FAILED_TITLE).c_str(),
@@ -154,7 +154,7 @@ void SetupDialog::AskToCloseChrome() {
}
void SetupDialog::SetState(ServiceController::State status,
- const string16& user,
+ const base::string16& user,
bool is_logging_enabled) {
DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_UI));
state_ = status;
@@ -282,19 +282,19 @@ void SetupDialog::DisableControls() {
GetDlgItem(IDC_LOGGING).EnableWindow(FALSE);
}
-string16 SetupDialog::GetDlgItemText(int id) const {
+base::string16 SetupDialog::GetDlgItemText(int id) const {
const ATL::CWindow& item = GetDlgItem(id);
size_t length = item.GetWindowTextLength();
- string16 result(length + 1, L'\0');
+ base::string16 result(length + 1, L'\0');
result.resize(item.GetWindowText(&result[0], result.size()));
return result;
}
-string16 SetupDialog::GetUser() const {
+base::string16 SetupDialog::GetUser() const {
return GetDlgItemText(IDC_USER);
}
-string16 SetupDialog::GetPassword() const{
+base::string16 SetupDialog::GetPassword() const {
return GetDlgItemText(IDC_PASSWORD);
}
@@ -309,7 +309,7 @@ void SetupDialog::UpdateState() {
controller_.user(), controller_.is_logging_enabled()));
}
-void SetupDialog::ShowError(const string16& error_message) {
+void SetupDialog::ShowError(const base::string16& error_message) {
DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_IO));
PostUITask(base::Bind(&SetupDialog::SetState,
this,
@@ -329,7 +329,8 @@ void SetupDialog::ShowError(HRESULT hr) {
ShowError(GetErrorMessage(hr));
}
-void SetupDialog::Install(const string16& user, const string16& password,
+void SetupDialog::Install(const base::string16& user,
+ const base::string16& password,
bool enable_logging) {
// Don't forget to update state on exit.
base::ScopedClosureRunner scoped_update_status(
diff --git a/cloud_print/service/win/local_security_policy.cc b/cloud_print/service/win/local_security_policy.cc
index 44c4e95..874498d 100644
--- a/cloud_print/service/win/local_security_policy.cc
+++ b/cloud_print/service/win/local_security_policy.cc
@@ -76,8 +76,9 @@ bool LocalSecurityPolicy::Open() {
&policy_);
}
-bool LocalSecurityPolicy::IsPrivilegeSet(const string16& username,
- const string16& privilage) const {
+bool LocalSecurityPolicy::IsPrivilegeSet(
+ const base::string16& username,
+ const base::string16& privilage) const {
DCHECK(policy_);
ATL::CSid user_sid;
if (!user_sid.LoadAccount(username.c_str())) {
@@ -97,8 +98,8 @@ bool LocalSecurityPolicy::IsPrivilegeSet(const string16& username,
return false;
}
-bool LocalSecurityPolicy::SetPrivilege(const string16& username,
- const string16& privilage) {
+bool LocalSecurityPolicy::SetPrivilege(const base::string16& username,
+ const base::string16& privilage) {
DCHECK(policy_);
ATL::CSid user_sid;
if (!user_sid.LoadAccount(username.c_str())) {
@@ -106,7 +107,7 @@ bool LocalSecurityPolicy::SetPrivilege(const string16& username,
return false;
}
LSA_UNICODE_STRING privilege_string;
- string16 privilage_copy(privilage);
+ base::string16 privilage_copy(privilage);
privilege_string.Buffer = &privilage_copy[0];
privilege_string.Length = wcslen(privilege_string.Buffer) *
sizeof(privilege_string.Buffer[0]);
diff --git a/cloud_print/service/win/local_security_policy.h b/cloud_print/service/win/local_security_policy.h
index 3e800a7..a0c58a0 100644
--- a/cloud_print/service/win/local_security_policy.h
+++ b/cloud_print/service/win/local_security_policy.h
@@ -21,9 +21,10 @@ class LocalSecurityPolicy {
bool Open();
void Close();
- bool IsPrivilegeSet(const string16& username,
- const string16& privilage) const;
- bool SetPrivilege(const string16& username, const string16& privilage);
+ bool IsPrivilegeSet(const base::string16& username,
+ const base::string16& privilage) const;
+ bool SetPrivilege(const base::string16& username,
+ const base::string16& privilage);
private:
LSA_HANDLE policy_;
diff --git a/cloud_print/service/win/service_controller.cc b/cloud_print/service/win/service_controller.cc
index c4b35e4..bdfc44d 100644
--- a/cloud_print/service/win/service_controller.cc
+++ b/cloud_print/service/win/service_controller.cc
@@ -61,7 +61,7 @@ HRESULT OpenServiceManager(ServiceHandle* service_manager) {
return S_OK;
}
-HRESULT OpenService(const string16& name, DWORD access,
+HRESULT OpenService(const base::string16& name, DWORD access,
ServiceHandle* service) {
if (!service)
return E_POINTER;
@@ -129,8 +129,8 @@ base::FilePath ServiceController::GetBinary() const {
}
HRESULT ServiceController::InstallConnectorService(
- const string16& user,
- const string16& password,
+ const base::string16& user,
+ const base::string16& password,
const base::FilePath& user_data_dir,
bool enable_logging) {
return InstallService(user, password, true, kServiceSwitch, user_data_dir,
@@ -138,15 +138,15 @@ HRESULT ServiceController::InstallConnectorService(
}
HRESULT ServiceController::InstallCheckService(
- const string16& user,
- const string16& password,
+ const base::string16& user,
+ const base::string16& password,
const base::FilePath& user_data_dir) {
return InstallService(user, password, false, kRequirementsSwitch,
user_data_dir, true);
}
-HRESULT ServiceController::InstallService(const string16& user,
- const string16& password,
+HRESULT ServiceController::InstallService(const base::string16& user,
+ const base::string16& password,
bool auto_start,
const std::string& run_switch,
const base::FilePath& user_data_dir,
@@ -193,7 +193,7 @@ HRESULT ServiceController::InstallService(const string16& user,
if (FAILED(hr))
return hr;
- string16 display_name =
+ base::string16 display_name =
cloud_print::LoadLocalString(IDS_SERVICE_DISPLAY_NAME);
ServiceHandle service(
::CreateService(
@@ -209,7 +209,7 @@ HRESULT ServiceController::InstallService(const string16& user,
return cloud_print::GetLastHResult();
}
- string16 description_string =
+ base::string16 description_string =
cloud_print::LoadLocalString(IDS_SERVICE_DESCRIPTION);
SERVICE_DESCRIPTION description = {0};
description.lpDescription = const_cast<wchar_t*>(description_string.c_str());
diff --git a/cloud_print/service/win/service_controller.h b/cloud_print/service/win/service_controller.h
index 167b0c1..3b1781e 100644
--- a/cloud_print/service/win/service_controller.h
+++ b/cloud_print/service/win/service_controller.h
@@ -32,13 +32,13 @@ class ServiceController {
~ServiceController();
// Installs temporarily service to check pre-requirements.
- HRESULT InstallCheckService(const string16& user,
- const string16& password,
+ HRESULT InstallCheckService(const base::string16& user,
+ const base::string16& password,
const base::FilePath& user_data_dir);
// Installs real service that will run connector.
- HRESULT InstallConnectorService(const string16& user,
- const string16& password,
+ HRESULT InstallConnectorService(const base::string16& user,
+ const base::string16& password,
const base::FilePath& user_data_dir,
bool enable_logging);
@@ -52,22 +52,22 @@ class ServiceController {
// Query service status and options. Results accessible with getters below.
void UpdateState();
State state() const { return state_; }
- const string16& user() const { return user_; }
+ const base::string16& user() const { return user_; }
bool is_logging_enabled() const;
base::FilePath GetBinary() const;
private:
- HRESULT InstallService(const string16& user,
- const string16& password,
+ HRESULT InstallService(const base::string16& user,
+ const base::string16& password,
bool auto_start,
const std::string& run_switch,
const base::FilePath& user_data_dir,
bool enable_logging);
- const string16 name_;
+ const base::string16 name_;
State state_;
- string16 user_;
+ base::string16 user_;
bool is_logging_enabled_;
CommandLine command_line_;
};
diff --git a/cloud_print/service/win/service_utils.cc b/cloud_print/service/win/service_utils.cc
index e63f2ab..cb791ad 100644
--- a/cloud_print/service/win/service_utils.cc
+++ b/cloud_print/service/win/service_utils.cc
@@ -12,20 +12,20 @@
#include "base/strings/string_util.h"
#include "chrome/common/chrome_switches.h"
-string16 GetLocalComputerName() {
+base::string16 GetLocalComputerName() {
DWORD size = 0;
- string16 result;
+ base::string16 result;
::GetComputerName(NULL, &size);
result.resize(size);
if (result.empty())
return result;
if (!::GetComputerName(&result[0], &size))
- return string16();
+ return base::string16();
result.resize(size);
return result;
}
-string16 ReplaceLocalHostInName(const string16& user_name) {
+base::string16 ReplaceLocalHostInName(const base::string16& user_name) {
static const wchar_t kLocalDomain[] = L".\\";
if (StartsWith(user_name, kLocalDomain, true)) {
return GetLocalComputerName() +
@@ -34,15 +34,15 @@ string16 ReplaceLocalHostInName(const string16& user_name) {
return user_name;
}
-string16 GetCurrentUserName() {
+base::string16 GetCurrentUserName() {
ULONG size = 0;
- string16 result;
+ base::string16 result;
::GetUserNameEx(::NameSamCompatible, NULL, &size);
result.resize(size);
if (result.empty())
return result;
if (!::GetUserNameEx(::NameSamCompatible, &result[0], &size))
- return string16();
+ return base::string16();
result.resize(size);
return result;
}
diff --git a/cloud_print/service/win/service_utils.h b/cloud_print/service/win/service_utils.h
index 083e091..d4faa8e 100644
--- a/cloud_print/service/win/service_utils.h
+++ b/cloud_print/service/win/service_utils.h
@@ -9,8 +9,8 @@ class CommandLine;
#include "base/strings/string16.h"
-string16 ReplaceLocalHostInName(const string16& user_name);
-string16 GetCurrentUserName();
+base::string16 ReplaceLocalHostInName(const base::string16& user_name);
+base::string16 GetCurrentUserName();
void CopyChromeSwitchesFromCurrentProcess(CommandLine* destination);
#endif // CLOUD_PRINT_SERVICE_SERVICE_UTILS_H_
diff --git a/cloud_print/service/win/setup_listener.cc b/cloud_print/service/win/setup_listener.cc
index 65c6e32..dd1cb37 100644
--- a/cloud_print/service/win/setup_listener.cc
+++ b/cloud_print/service/win/setup_listener.cc
@@ -26,7 +26,7 @@ const char SetupListener::kUserNameJsonValueName[] = "user_name";
const wchar_t SetupListener::kSetupPipeName[] =
L"\\\\.\\pipe\\CloudPrintServiceSetup";
-SetupListener::SetupListener(const string16& user)
+SetupListener::SetupListener(const base::string16& user)
: done_event_(new base::WaitableEvent(true, false)),
ipc_thread_(new base::Thread("ipc_thread")),
succeded_(false),
@@ -68,11 +68,11 @@ bool SetupListener::OnMessageReceived(const IPC::Message& msg) {
dictionary->GetBoolean(kXpsAvailableJsonValueName, &is_xps_available_);
dictionary->GetString(kUserNameJsonValueName, &user_name_);
- string16 chrome_path;
+ base::string16 chrome_path;
dictionary->GetString(kChromePathJsonValueName, &chrome_path);
chrome_path_ = base::FilePath(chrome_path);
- string16 user_data_dir;
+ base::string16 user_data_dir;
dictionary->GetString(kUserDataDirJsonValueName, &user_data_dir);
user_data_dir_ = base::FilePath(user_data_dir);
@@ -94,7 +94,7 @@ void SetupListener::Disconnect() {
ipc_thread_->message_loop()->QuitWhenIdle();
}
-void SetupListener::Connect(const string16& user) {
+void SetupListener::Connect(const base::string16& user) {
ATL::CDacl dacl;
ATL::CSid user_sid;
diff --git a/cloud_print/service/win/setup_listener.h b/cloud_print/service/win/setup_listener.h
index 9745c62..80223c7 100644
--- a/cloud_print/service/win/setup_listener.h
+++ b/cloud_print/service/win/setup_listener.h
@@ -35,7 +35,7 @@ class SetupListener : public IPC::Listener {
static const char kUserNameJsonValueName[];
static const wchar_t kSetupPipeName[];
- explicit SetupListener(const string16& user);
+ explicit SetupListener(const base::string16& user);
virtual ~SetupListener();
virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
@@ -51,7 +51,7 @@ class SetupListener : public IPC::Listener {
return user_data_dir_;
}
- const string16& user_name() const {
+ const base::string16& user_name() const {
return user_name_;
}
@@ -65,11 +65,11 @@ class SetupListener : public IPC::Listener {
private:
void Disconnect();
- void Connect(const string16& user);
+ void Connect(const base::string16& user);
base::FilePath chrome_path_;
base::FilePath user_data_dir_;
- string16 user_name_;
+ base::string16 user_name_;
std::vector<std::string> printers_;
bool is_xps_available_;
bool succeded_;
diff --git a/cloud_print/virtual_driver/win/install/setup.cc b/cloud_print/virtual_driver/win/install/setup.cc
index 1c87ca2..2ac07ed 100644
--- a/cloud_print/virtual_driver/win/install/setup.cc
+++ b/cloud_print/virtual_driver/win/install/setup.cc
@@ -63,7 +63,7 @@ const char kRegisterSwitch[] = "register";
const char kUninstallSwitch[] = "uninstall";
const char kUnregisterSwitch[] = "unregister";
-base::FilePath GetSystemPath(const string16& binary) {
+base::FilePath GetSystemPath(const base::string16& binary) {
base::FilePath path;
if (!PathService::Get(base::DIR_SYSTEM, &path)) {
LOG(ERROR) << "Unable to get system path.";
@@ -72,7 +72,7 @@ base::FilePath GetSystemPath(const string16& binary) {
return path.Append(binary);
}
-base::FilePath GetNativeSystemPath(const string16& binary) {
+base::FilePath GetNativeSystemPath(const base::string16& binary) {
if (!IsSystem64Bit())
return GetSystemPath(binary);
base::FilePath path;
@@ -254,7 +254,7 @@ HRESULT InstallDriver(const base::FilePath& install_path) {
return HRESULT_FROM_WIN32(ERROR_CANNOT_MAKE);
ReadyDriverDependencies(temp_path.path());
- std::vector<string16> dependent_array;
+ std::vector<base::string16> dependent_array;
// Add all files. AddPrinterDriverEx will removes unnecessary.
for (size_t i = 0; i < arraysize(kDependencyList); ++i) {
base::FilePath file_path = temp_path.path().Append(kDependencyList[i]);
@@ -287,18 +287,18 @@ HRESULT InstallDriver(const base::FilePath& install_path) {
driver_info.pDriverPath = const_cast<LPWSTR>(xps_path.value().c_str());
driver_info.pConfigFile = const_cast<LPWSTR>(ui_path.value().c_str());
- string16 dependent_files(JoinString(dependent_array, L'\n'));
+ base::string16 dependent_files(JoinString(dependent_array, L'\n'));
dependent_files.push_back(L'\n');
std::replace(dependent_files.begin(), dependent_files.end(), L'\n', L'\0');
driver_info.pDependentFiles = &dependent_files[0];
// Set up user visible strings.
- string16 manufacturer = LoadLocalString(IDS_GOOGLE);
+ base::string16 manufacturer = LoadLocalString(IDS_GOOGLE);
driver_info.pszMfgName = const_cast<LPWSTR>(manufacturer.c_str());
driver_info.pszProvider = const_cast<LPWSTR>(manufacturer.c_str());
driver_info.pszOEMUrl = const_cast<LPWSTR>(kGcpUrl);
driver_info.dwlDriverVersion = GetVersionNumber();
- string16 driver_name = LoadLocalString(IDS_DRIVER_NAME);
+ base::string16 driver_name = LoadLocalString(IDS_DRIVER_NAME);
driver_info.pName = const_cast<LPWSTR>(driver_name.c_str());
if (!::AddPrinterDriverEx(NULL, 6, reinterpret_cast<BYTE*>(&driver_info),
@@ -311,7 +311,7 @@ HRESULT InstallDriver(const base::FilePath& install_path) {
HRESULT UninstallDriver() {
int tries = 3;
- string16 driver_name = LoadLocalString(IDS_DRIVER_NAME);
+ base::string16 driver_name = LoadLocalString(IDS_DRIVER_NAME);
while (!DeletePrinterDriverEx(NULL,
NULL,
const_cast<LPWSTR>(driver_name.c_str()),
@@ -340,12 +340,12 @@ HRESULT InstallPrinter(void) {
// None of the print API structures likes constant strings even though they
// don't modify the string. const_casting is the cleanest option.
- string16 driver_name = LoadLocalString(IDS_DRIVER_NAME);
+ base::string16 driver_name = LoadLocalString(IDS_DRIVER_NAME);
printer_info.pDriverName = const_cast<LPWSTR>(driver_name.c_str());
printer_info.pPrinterName = const_cast<LPWSTR>(driver_name.c_str());
printer_info.pComment = const_cast<LPWSTR>(driver_name.c_str());
printer_info.pLocation = const_cast<LPWSTR>(kGcpUrl);
- string16 port_name;
+ base::string16 port_name;
printer_info.pPortName = const_cast<LPWSTR>(kPortName);
printer_info.Attributes = PRINTER_ATTRIBUTE_DIRECT|PRINTER_ATTRIBUTE_LOCAL;
printer_info.pPrintProcessor = L"winprint";
@@ -363,7 +363,7 @@ HRESULT UninstallPrinter(void) {
HANDLE handle = NULL;
PRINTER_DEFAULTS printer_defaults = {0};
printer_defaults.DesiredAccess = PRINTER_ALL_ACCESS;
- string16 driver_name = LoadLocalString(IDS_DRIVER_NAME);
+ base::string16 driver_name = LoadLocalString(IDS_DRIVER_NAME);
if (!OpenPrinter(const_cast<LPWSTR>(driver_name.c_str()),
&handle,
&printer_defaults)) {
diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
index a68c29e..6171296 100644
--- a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
+++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
@@ -135,7 +135,7 @@ void DeleteLeakedFiles(const base::FilePath& dir) {
// On failure returns FALSE and title is unmodified.
bool GetJobTitle(HANDLE printer_handle,
DWORD job_id,
- string16 *title) {
+ base::string16 *title) {
DCHECK(printer_handle != NULL);
DCHECK(title != NULL);
DWORD bytes_needed = 0;
@@ -163,7 +163,7 @@ bool GetJobTitle(HANDLE printer_handle,
// Verifies that a valid parent Window exists and then just displays an
// error message to let the user know that there is no interactive
// configuration.
-void HandlePortUi(HWND hwnd, const string16& caption) {
+void HandlePortUi(HWND hwnd, const base::string16& caption) {
if (hwnd != NULL && IsWindow(hwnd)) {
DisplayWindowsMessage(hwnd, CO_E_NOT_SUPPORTED, cloud_print::kPortName);
}
@@ -196,7 +196,7 @@ bool GetUserToken(HANDLE* primary_token) {
// xps_path references a file to print.
// job_title is the title to be used for the resulting print job.
bool LaunchPrintDialog(const base::FilePath& xps_path,
- const string16& job_title) {
+ const base::string16& job_title) {
HANDLE token = NULL;
if (!GetUserToken(&token)) {
LOG(ERROR) << "Unable to get user token.";
@@ -286,7 +286,7 @@ bool ValidateCurrentUser() {
base::FilePath ReadPathFromRegistry(HKEY root, const wchar_t* path_name) {
base::win::RegKey gcp_key(HKEY_CURRENT_USER, kCloudPrintRegKey, KEY_READ);
- string16 data;
+ base::string16 data;
if (SUCCEEDED(gcp_key.ReadValue(path_name, &data)) &&
base::PathExists(base::FilePath(data))) {
return base::FilePath(data);
@@ -484,7 +484,7 @@ BOOL WINAPI Monitor2EndDocPort(HANDLE port_handle) {
int64 file_size = 0;
base::GetFileSize(port_data->file_path, &file_size);
if (file_size > 0) {
- string16 job_title;
+ base::string16 job_title;
if (port_data->printer_handle != NULL) {
GetJobTitle(port_data->printer_handle,
port_data->job_id,
diff --git a/cloud_print/virtual_driver/win/virtual_driver_helpers.cc b/cloud_print/virtual_driver/win/virtual_driver_helpers.cc
index e214529..26a2bdf 100644
--- a/cloud_print/virtual_driver/win/virtual_driver_helpers.cc
+++ b/cloud_print/virtual_driver/win/virtual_driver_helpers.cc
@@ -17,15 +17,16 @@ namespace cloud_print {
const size_t kMaxMessageLen = 100;
-void DisplayWindowsMessage(HWND hwnd, HRESULT hr, const string16 &caption) {
+void DisplayWindowsMessage(HWND hwnd, HRESULT hr,
+ const base::string16 &caption) {
::MessageBox(hwnd, GetErrorMessage(hr).c_str(), caption.c_str(), MB_OK);
}
-string16 GetPortMonitorDllName() {
+base::string16 GetPortMonitorDllName() {
if (IsSystem64Bit()) {
- return string16(L"gcp_portmon64.dll");
+ return base::string16(L"gcp_portmon64.dll");
} else {
- return string16(L"gcp_portmon.dll");
+ return base::string16(L"gcp_portmon.dll");
}
}
diff --git a/cloud_print/virtual_driver/win/virtual_driver_helpers.h b/cloud_print/virtual_driver/win/virtual_driver_helpers.h
index 7a275ac..426265f 100644
--- a/cloud_print/virtual_driver/win/virtual_driver_helpers.h
+++ b/cloud_print/virtual_driver/win/virtual_driver_helpers.h
@@ -19,10 +19,11 @@ namespace cloud_print {
bool IsSystem64Bit();
// Convert an HRESULT to a localized string and display it in a message box.
-void DisplayWindowsMessage(HWND hwnd, HRESULT hr, const string16 &caption);
+void DisplayWindowsMessage(HWND hwnd, HRESULT hr,
+ const base::string16 &caption);
// Returns the correct port monitor DLL file name for the current machine.
-string16 GetPortMonitorDllName();
+base::string16 GetPortMonitorDllName();
// Gets the standard install path for "version 3" print drivers.
HRESULT GetPrinterDriverDir(base::FilePath* path);