summaryrefslogtreecommitdiffstats
path: root/cloud_print/service/win
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/service/win
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/service/win')
-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
11 files changed, 73 insertions, 69 deletions
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_;