summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpgal.u-szeged <pgal.u-szeged@partner.samsung.com>2014-11-18 18:06:03 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-19 02:06:18 +0000
commit588a3ead6ef36c3ccb9dd51dd028c251a4fb511b (patch)
tree07deba5a66eff63e8482ae1b1e87688c209014ff
parent539d8860344b808a289bf9361da51621a57c03a4 (diff)
downloadchromium_src-588a3ead6ef36c3ccb9dd51dd028c251a4fb511b.zip
chromium_src-588a3ead6ef36c3ccb9dd51dd028c251a4fb511b.tar.gz
chromium_src-588a3ead6ef36c3ccb9dd51dd028c251a4fb511b.tar.bz2
Prefix CommandLine usage with base namespace (Part 7: cloud_print/)
Prefix all CommandLine usage in the cloud_print/ directory with the base:: namespace. R=vitalybuka@chromium.org BUG=422426 Review URL: https://codereview.chromium.org/735053002 Cr-Commit-Position: refs/heads/master@{#304744}
-rw-r--r--cloud_print/common/win/install_utils.cc4
-rw-r--r--cloud_print/gcp20/prototype/command_line_reader.cc14
-rw-r--r--cloud_print/gcp20/prototype/dns_sd_server.cc12
-rw-r--r--cloud_print/gcp20/prototype/gcp20_device.cc7
-rw-r--r--cloud_print/gcp20/prototype/print_job_handler.cc2
-rw-r--r--cloud_print/gcp20/prototype/printer.cc3
-rw-r--r--cloud_print/gcp20/prototype/privet_http_server.cc6
-rw-r--r--cloud_print/service/win/chrome_launcher.cc8
-rw-r--r--cloud_print/service/win/cloud_print_service.cc10
-rw-r--r--cloud_print/service/win/cloud_print_service_config.cc2
-rw-r--r--cloud_print/service/win/installer.cc5
-rw-r--r--cloud_print/service/win/service_controller.cc6
-rw-r--r--cloud_print/service/win/service_utils.cc4
-rw-r--r--cloud_print/virtual_driver/win/install/setup.cc11
-rw-r--r--cloud_print/virtual_driver/win/port_monitor/port_monitor.cc4
15 files changed, 55 insertions, 43 deletions
diff --git a/cloud_print/common/win/install_utils.cc b/cloud_print/common/win/install_utils.cc
index 6c421ed..d4694cf5 100644
--- a/cloud_print/common/win/install_utils.cc
+++ b/cloud_print/common/win/install_utils.cc
@@ -144,7 +144,7 @@ void CreateUninstallKey(const base::string16& uninstall_id,
base::FilePath unstall_binary;
CHECK(PathService::Get(base::FILE_EXE, &unstall_binary));
- CommandLine uninstall_command(unstall_binary);
+ base::CommandLine uninstall_command(unstall_binary);
uninstall_command.AppendSwitch(uninstall_switch);
key.WriteValue(kUninstallString,
uninstall_command.GetCommandLineString().c_str());
@@ -200,7 +200,7 @@ void DeleteProgramDir(const std::string& delete_switch) {
return;
base::CopyFile(installer_source, temp_path);
base::DeleteFileAfterReboot(temp_path);
- CommandLine command_line(temp_path);
+ base::CommandLine command_line(temp_path);
command_line.AppendSwitchPath(delete_switch, installer_source.DirName());
base::LaunchOptions options;
base::ProcessHandle process_handle;
diff --git a/cloud_print/gcp20/prototype/command_line_reader.cc b/cloud_print/gcp20/prototype/command_line_reader.cc
index ecab579..8663efa 100644
--- a/cloud_print/gcp20/prototype/command_line_reader.cc
+++ b/cloud_print/gcp20/prototype/command_line_reader.cc
@@ -15,7 +15,7 @@ uint16 ReadHttpPort(uint16 default_value) {
uint32 http_port = 0;
std::string http_port_string =
- CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kHttpPort);
if (!base::StringToUint(http_port_string, &http_port))
@@ -32,9 +32,10 @@ uint16 ReadHttpPort(uint16 default_value) {
uint32 ReadTtl(uint32 default_value) {
uint32 ttl = 0;
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (!base::StringToUint(
- CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kTtl),
+ command_line->GetSwitchValueASCII(switches::kTtl),
&ttl)) {
ttl = default_value;
}
@@ -45,7 +46,7 @@ uint32 ReadTtl(uint32 default_value) {
std::string ReadServiceNamePrefix(const std::string& default_value) {
std::string service_name =
- CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kServiceName);
return service_name.empty() ? default_value : service_name;
@@ -53,7 +54,7 @@ std::string ReadServiceNamePrefix(const std::string& default_value) {
std::string ReadDomainName(const std::string& default_value) {
std::string domain_name =
- CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kDomainName);
if (domain_name.empty())
@@ -75,8 +76,9 @@ std::string ReadDomainName(const std::string& default_value) {
}
std::string ReadStatePath(const std::string& default_value) {
- std::string filename = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kStatePath);
+ std::string filename =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kStatePath);
if (filename.empty())
return default_value;
diff --git a/cloud_print/gcp20/prototype/dns_sd_server.cc b/cloud_print/gcp20/prototype/dns_sd_server.cc
index 23280cb..a43f9f0 100644
--- a/cloud_print/gcp20/prototype/dns_sd_server.cc
+++ b/cloud_print/gcp20/prototype/dns_sd_server.cc
@@ -98,7 +98,8 @@ void DnsSdServer::UpdateMetadata(const std::vector<std::string>& metadata) {
// then send it now.
uint32 current_ttl = GetCurrentTLL();
- if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoAnnouncement)) {
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kNoAnnouncement)) {
DnsResponseBuilder builder(current_ttl);
builder.AppendTxt(serv_params_.service_name_, current_ttl, metadata_, true);
@@ -183,8 +184,8 @@ void DnsSdServer::ProcessMessage(int len, net::IOBufferWithSize* buf) {
VLOG(1) << "Current TTL for respond: " << current_ttl;
- bool unicast_respond =
- CommandLine::ForCurrentProcess()->HasSwitch(switches::kUnicastRespond);
+ bool unicast_respond = base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kUnicastRespond);
socket_->SendTo(buffer.get(), buffer.get()->size(),
unicast_respond ? recv_address_ : multicast_address_,
base::Bind(&DoNothingAfterSendToSocket));
@@ -205,7 +206,7 @@ void DnsSdServer::ProccessQuery(uint32 current_ttl, const DnsQueryRecord& query,
builder->AppendPtr(query.qname, current_ttl,
serv_params_.service_name_, true);
- if (CommandLine::ForCurrentProcess()->HasSwitch(
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kExtendedResponce)) {
builder->AppendSrv(serv_params_.service_name_, current_ttl,
kSrvPriority, kSrvWeight, serv_params_.http_port_,
@@ -280,7 +281,8 @@ void DnsSdServer::OnDatagramReceived() {
}
void DnsSdServer::SendAnnouncement(uint32 ttl) {
- if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoAnnouncement)) {
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kNoAnnouncement)) {
DnsResponseBuilder builder(ttl);
builder.AppendPtr(serv_params_.service_type_, ttl,
diff --git a/cloud_print/gcp20/prototype/gcp20_device.cc b/cloud_print/gcp20/prototype/gcp20_device.cc
index 9bb71b1..d174107 100644
--- a/cloud_print/gcp20/prototype/gcp20_device.cc
+++ b/cloud_print/gcp20/prototype/gcp20_device.cc
@@ -50,14 +50,15 @@ void OnAbort(int val) {
int main(int argc, char* argv[]) {
base::AtExitManager at_exit;
Printer printer;
- CommandLine::Init(argc, argv);
+ base::CommandLine::Init(argc, argv);
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
logging::LoggingSettings settings;
settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
logging::InitLogging(settings);
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kHelp) ||
- CommandLine::ForCurrentProcess()->HasSwitch(switches::kHelpShort)) {
+ if (command_line->HasSwitch(switches::kHelp) ||
+ command_line->HasSwitch(switches::kHelpShort)) {
switches::PrintUsage();
return 0;
}
diff --git a/cloud_print/gcp20/prototype/print_job_handler.cc b/cloud_print/gcp20/prototype/print_job_handler.cc
index 28bf21c..6897a6c 100644
--- a/cloud_print/gcp20/prototype/print_job_handler.cc
+++ b/cloud_print/gcp20/prototype/print_job_handler.cc
@@ -85,7 +85,7 @@ LocalPrintJob::CreateResult PrintJobHandler::CreatePrintJob(
return LocalPrintJob::CREATE_INVALID_TICKET;
// Let's simulate at least some errors just for testing.
- if (CommandLine::ForCurrentProcess()->HasSwitch(
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSimulatePrintingErrors)) {
if (base::RandDouble() <= kPaperJamProbability) {
*error_description = "Paper jam, try again";
diff --git a/cloud_print/gcp20/prototype/printer.cc b/cloud_print/gcp20/prototype/printer.cc
index 24866a5..9820ace 100644
--- a/cloud_print/gcp20/prototype/printer.cc
+++ b/cloud_print/gcp20/prototype/printer.cc
@@ -233,7 +233,8 @@ PrivetHttpServer::RegistrationErrorStatus Printer::RegistrationStart(
state_.user = user;
state_.registration_state = PrinterState::REGISTRATION_STARTED;
- if (CommandLine::ForCurrentProcess()->HasSwitch("disable-confirmation")) {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ "disable-confirmation")) {
state_.confirmation_state = PrinterState::CONFIRMATION_CONFIRMED;
VLOG(0) << "Registration confirmed by default.";
} else {
diff --git a/cloud_print/gcp20/prototype/privet_http_server.cc b/cloud_print/gcp20/prototype/privet_http_server.cc
index 5b4086f..c033439 100644
--- a/cloud_print/gcp20/prototype/privet_http_server.cc
+++ b/cloud_print/gcp20/prototype/privet_http_server.cc
@@ -139,7 +139,8 @@ void PrivetHttpServer::OnHttpRequest(int connection_id,
if (!ValidateRequestMethod(connection_id, url.path(), info.method))
return;
- if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableXTocken)) {
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableXTocken)) {
net::HttpServerRequestInfo::HeadersMap::const_iterator iter =
info.headers.find("x-privet-token");
if (iter == info.headers.end()) {
@@ -192,7 +193,8 @@ bool PrivetHttpServer::ValidateRequestMethod(int connection_id,
return false;
}
- if (CommandLine::ForCurrentProcess()->HasSwitch("disable-method-check"))
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ "disable-method-check"))
return true;
if ((IsGetMethod(request) && method != "GET") ||
diff --git a/cloud_print/service/win/chrome_launcher.cc b/cloud_print/service/win/chrome_launcher.cc
index 5dd876d..d63dc8f 100644
--- a/cloud_print/service/win/chrome_launcher.cc
+++ b/cloud_print/service/win/chrome_launcher.cc
@@ -67,7 +67,7 @@ void CloseChrome(HANDLE process, DWORD thread_id) {
ShutdownChrome(process, thread_id);
}
-bool LaunchProcess(const CommandLine& cmdline,
+bool LaunchProcess(const base::CommandLine& cmdline,
base::win::ScopedHandle* process_handle,
DWORD* thread_id) {
STARTUPINFO startup_info = {};
@@ -149,7 +149,7 @@ void DeleteAutorunKeys(const base::FilePath& user_data_dir) {
base::win::RegistryValueIterator value(HKEY_CURRENT_USER, kAutoRunKeyPath);
for (; value.Valid(); ++value) {
if (value.Type() == REG_SZ && value.Value()) {
- CommandLine cmd = CommandLine::FromString(value.Value());
+ base::CommandLine cmd = base::CommandLine::FromString(value.Value());
if (cmd.GetSwitchValueASCII(switches::kProcessType) ==
switches::kServiceProcess &&
cmd.HasSwitch(switches::kUserDataDir)) {
@@ -201,7 +201,7 @@ void ChromeLauncher::Run() {
base::FilePath chrome_path = chrome_launcher_support::GetAnyChromePath();
if (!chrome_path.empty()) {
- CommandLine cmd(chrome_path);
+ base::CommandLine cmd(chrome_path);
CopyChromeSwitchesFromCurrentProcess(&cmd);
// Required switches.
@@ -278,7 +278,7 @@ std::string ChromeLauncher::CreateServiceStateFile(
return std::string();
}
- CommandLine cmd(chrome_path);
+ base::CommandLine cmd(chrome_path);
CopyChromeSwitchesFromCurrentProcess(&cmd);
cmd.AppendSwitchPath(switches::kUserDataDir, temp_user_data.path());
cmd.AppendSwitchPath(switches::kCloudPrintSetupProxy, printers_file);
diff --git a/cloud_print/service/win/cloud_print_service.cc b/cloud_print/service/win/cloud_print_service.cc
index 5565269..18d9a198 100644
--- a/cloud_print/service/win/cloud_print_service.cc
+++ b/cloud_print/service/win/cloud_print_service.cc
@@ -154,7 +154,7 @@ class CloudPrintServiceModule
bool ParseCommandLine(LPCTSTR lpCmdLine, HRESULT* pnRetCode) {
CHECK(pnRetCode);
- CommandLine command_line(CommandLine::NO_PROGRAM);
+ base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
command_line.ParseFromString(lpCmdLine);
LOG(INFO) << command_line.GetCommandLineString();
@@ -198,7 +198,8 @@ class CloudPrintServiceModule
}
private:
- HRESULT ParseCommandLine(const CommandLine& command_line, bool* is_service) {
+ HRESULT ParseCommandLine(const base::CommandLine& command_line,
+ bool* is_service) {
if (!is_service)
return E_INVALIDARG;
*is_service = false;
@@ -404,7 +405,8 @@ BOOL CloudPrintServiceModule::ConsoleCtrlHandler(DWORD type) {
}
int main(int argc, char** argv) {
- CommandLine::Init(argc, argv);
+ base::CommandLine::Init(argc, argv);
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
base::AtExitManager at_exit;
logging::LoggingSettings settings;
@@ -412,7 +414,7 @@ int main(int argc, char** argv) {
logging::InitLogging(settings);
logging::SetMinLogLevel(
- CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableLogging) ?
+ command_line->HasSwitch(switches::kEnableLogging) ?
logging::LOG_INFO : logging::LOG_FATAL);
return _AtlModule.WinMain(0);
diff --git a/cloud_print/service/win/cloud_print_service_config.cc b/cloud_print/service/win/cloud_print_service_config.cc
index a1e13dba..f188f2c 100644
--- a/cloud_print/service/win/cloud_print_service_config.cc
+++ b/cloud_print/service/win/cloud_print_service_config.cc
@@ -443,7 +443,7 @@ int WINAPI WinMain(__in HINSTANCE hInstance,
__in LPSTR lpCmdLine,
__in int nCmdShow) {
base::AtExitManager at_exit;
- CommandLine::Init(0, NULL);
+ base::CommandLine::Init(0, NULL);
base::MessageLoopForUI loop;
scoped_refptr<SetupDialog> dialog(new SetupDialog());
diff --git a/cloud_print/service/win/installer.cc b/cloud_print/service/win/installer.cc
index e3ff6a4..312af6e 100644
--- a/cloud_print/service/win/installer.cc
+++ b/cloud_print/service/win/installer.cc
@@ -77,7 +77,8 @@ void DeleteShortcuts() {
} // namespace
HRESULT ProcessInstallerSwitches() {
- const CommandLine& command_line(*CommandLine::ForCurrentProcess());
+ const base::CommandLine& command_line(
+ *base::CommandLine::ForCurrentProcess());
if (command_line.HasSwitch(kInstallSwitch)) {
base::FilePath old_location =
@@ -139,6 +140,6 @@ int WINAPI WinMain(__in HINSTANCE hInstance,
__in LPSTR lpCmdLine,
__in int nCmdShow) {
base::AtExitManager at_exit;
- CommandLine::Init(0, NULL);
+ base::CommandLine::Init(0, NULL);
return ProcessInstallerSwitches();
}
diff --git a/cloud_print/service/win/service_controller.cc b/cloud_print/service/win/service_controller.cc
index 0c269b9..102e998 100644
--- a/cloud_print/service/win/service_controller.cc
+++ b/cloud_print/service/win/service_controller.cc
@@ -83,7 +83,7 @@ HRESULT OpenService(const base::string16& name, DWORD access,
ServiceController::ServiceController()
: name_(cloud_print::LoadLocalString(IDS_SERVICE_NAME)),
- command_line_(CommandLine::NO_PROGRAM) {
+ command_line_(base::CommandLine::NO_PROGRAM) {
}
ServiceController::~ServiceController() {
@@ -164,7 +164,7 @@ HRESULT ServiceController::InstallService(const base::string16& user,
base::FilePath service_path = GetBinary();
if (!base::PathExists(service_path))
return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
- CommandLine command_line(service_path);
+ base::CommandLine command_line(service_path);
command_line.AppendSwitch(run_switch);
if (!user_data_dir.empty())
command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir);
@@ -304,7 +304,7 @@ void ServiceController::UpdateState() {
return;
}
- command_line_ = CommandLine::FromString(config->lpBinaryPathName);
+ command_line_ = base::CommandLine::FromString(config->lpBinaryPathName);
if (!command_line_.HasSwitch(kServiceSwitch)) {
state_ = STATE_NOT_FOUND;
return;
diff --git a/cloud_print/service/win/service_utils.cc b/cloud_print/service/win/service_utils.cc
index b71bca2..6bced80 100644
--- a/cloud_print/service/win/service_utils.cc
+++ b/cloud_print/service/win/service_utils.cc
@@ -48,7 +48,7 @@ base::string16 GetCurrentUserName() {
return result;
}
-void CopyChromeSwitchesFromCurrentProcess(CommandLine* destination) {
+void CopyChromeSwitchesFromCurrentProcess(base::CommandLine* destination) {
static const char* const kSwitchesToCopy[] = {
switches::kCloudPrintURL,
switches::kCloudPrintXmppEndpoint,
@@ -58,7 +58,7 @@ void CopyChromeSwitchesFromCurrentProcess(CommandLine* destination) {
switches::kLsoUrl,
switches::kV,
};
- destination->CopySwitchesFrom(*CommandLine::ForCurrentProcess(),
+ destination->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(),
kSwitchesToCopy,
arraysize(kSwitchesToCopy));
}
diff --git a/cloud_print/virtual_driver/win/install/setup.cc b/cloud_print/virtual_driver/win/install/setup.cc
index 0435eb3..6597758 100644
--- a/cloud_print/virtual_driver/win/install/setup.cc
+++ b/cloud_print/virtual_driver/win/install/setup.cc
@@ -88,7 +88,7 @@ void SpoolerServiceCommand(const char* command) {
base::FilePath net_path = GetNativeSystemPath(L"net");
if (net_path.empty())
return;
- CommandLine command_line(net_path);
+ base::CommandLine command_line(net_path);
command_line.AppendArg(command);
command_line.AppendArg("spooler");
command_line.AppendArg("/y");
@@ -126,7 +126,7 @@ HRESULT RegisterPortMonitor(bool install, const base::FilePath& install_path) {
return HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND);
}
- CommandLine command_line(regsvr32_path);
+ base::CommandLine command_line(regsvr32_path);
command_line.AppendArg("/s");
if (!install) {
command_line.AppendArg("/u");
@@ -503,7 +503,8 @@ HRESULT DoInstall(const base::FilePath& install_path) {
}
HRESULT ExecuteCommands() {
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
base::FilePath exe_path;
if (FAILED(PathService::Get(base::DIR_EXE, &exe_path)) ||
@@ -537,7 +538,7 @@ int WINAPI WinMain(__in HINSTANCE hInstance,
using namespace cloud_print;
base::AtExitManager at_exit_manager;
- CommandLine::Init(0, NULL);
+ base::CommandLine::Init(0, NULL);
HRESULT retval = ExecuteCommands();
@@ -552,7 +553,7 @@ int WINAPI WinMain(__in HINSTANCE hInstance,
<< " HRESULT=0x" << std::setbase(16) << retval;
// Installer is silent by default as required by Google Update.
- if (CommandLine::ForCurrentProcess()->HasSwitch("verbose")) {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch("verbose")) {
DisplayWindowsMessage(NULL, retval, LoadLocalString(IDS_DRIVER_NAME));
}
return retval;
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 28c4a3b..0878bac 100644
--- a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
+++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
@@ -218,7 +218,7 @@ bool LaunchPrintDialog(const base::FilePath& xps_path,
return false;
}
- CommandLine command_line(chrome_path);
+ base::CommandLine command_line(chrome_path);
base::FilePath chrome_profile = GetChromeProfilePath();
if (!chrome_profile.empty())
@@ -250,7 +250,7 @@ void LaunchChromeDownloadPage() {
base::FilePath ie_path;
PathService::Get(base::DIR_PROGRAM_FILESX86, &ie_path);
ie_path = ie_path.Append(kIePath);
- CommandLine command_line(ie_path);
+ base::CommandLine command_line(ie_path);
command_line.AppendArg(kChromeInstallUrl);
base::LaunchOptions options;