summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-13 23:41:22 +0000
committermsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-13 23:41:22 +0000
commit75f1c78e253686c71e4294a48b744375d0fe8560 (patch)
tree37bcb158f88c33e0e13cb26010ea7b35ae8e118c
parent8e63df81baee6cc66979255525cd900e00977969 (diff)
downloadchromium_src-75f1c78e253686c71e4294a48b744375d0fe8560.zip
chromium_src-75f1c78e253686c71e4294a48b744375d0fe8560.tar.gz
chromium_src-75f1c78e253686c71e4294a48b744375d0fe8560.tar.bz2
Rename CommandLine::GetArgs(), update callers.
BUG=73195 TEST=none Review URL: http://codereview.chromium.org/7352006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92448 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/command_line.cc2
-rw-r--r--base/command_line.h3
-rw-r--r--base/command_line_unittest.cc8
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.cc12
-rw-r--r--chrome/browser/ui/browser_init.cc2
-rw-r--r--chrome/tools/profiles/generate_profile.cc7
-rw-r--r--courgette/courgette_tool.cc7
-rw-r--r--media/test/ffmpeg_tests/ffmpeg_tests.cc2
-rw-r--r--media/tools/media_bench/media_bench.cc2
-rw-r--r--media/tools/player_wtl/player_wtl.cc4
-rw-r--r--media/tools/scaler_bench/scaler_bench.cc2
-rw-r--r--media/tools/wav_ola_test/wav_ola_test.cc2
-rw-r--r--remoting/protocol/protocol_test_client.cc2
-rw-r--r--tools/imagediff/image_diff.cc2
-rw-r--r--webkit/tools/test_shell/test_shell_main.cc2
15 files changed, 31 insertions, 28 deletions
diff --git a/base/command_line.cc b/base/command_line.cc
index ff89e1a..8121aca 100644
--- a/base/command_line.cc
+++ b/base/command_line.cc
@@ -336,7 +336,7 @@ void CommandLine::CopySwitchesFrom(const CommandLine& source,
}
}
-CommandLine::StringVector CommandLine::args() const {
+CommandLine::StringVector CommandLine::GetArgs() const {
// Gather all arguments after the last switch (may include kSwitchTerminator).
StringVector args(argv_.begin() + begin_args_, argv_.end());
// Erase only the first kSwitchTerminator (maybe "--" is a legitimate page?)
diff --git a/base/command_line.h b/base/command_line.h
index 4b40133..802fa0f 100644
--- a/base/command_line.h
+++ b/base/command_line.h
@@ -118,8 +118,7 @@ class BASE_API CommandLine {
size_t count);
// Get the remaining arguments to the command.
- // TODO(msw): Rename GetArgs.
- StringVector args() const;
+ StringVector GetArgs() const;
// Append an argument to the command line. Note that the argument is quoted
// properly such that it is interpreted as one argument to the target command.
diff --git a/base/command_line_unittest.cc b/base/command_line_unittest.cc
index c2bfd11..3f949e5 100644
--- a/base/command_line_unittest.cc
+++ b/base/command_line_unittest.cc
@@ -73,7 +73,7 @@ TEST(CommandLineTest, CommandLineConstructor) {
"other-switches"));
EXPECT_EQ("45--output-rotation", cl.GetSwitchValueASCII("input-translation"));
- const std::vector<CommandLine::StringType>& args = cl.args();
+ const CommandLine::StringVector& args = cl.GetArgs();
ASSERT_EQ(6U, args.size());
std::vector<CommandLine::StringType>::const_iterator iter = args.begin();
@@ -134,7 +134,7 @@ TEST(CommandLineTest, CommandLineFromString) {
EXPECT_EQ("45--output-rotation", cl.GetSwitchValueASCII("input-translation"));
EXPECT_EQ(kTricky, cl.GetSwitchValueNative("quotes"));
- const std::vector<CommandLine::StringType>& args = cl.args();
+ const CommandLine::StringVector& args = cl.GetArgs();
ASSERT_EQ(5U, args.size());
std::vector<CommandLine::StringType>::const_iterator iter = args.begin();
@@ -163,13 +163,13 @@ TEST(CommandLineTest, EmptyString) {
EXPECT_TRUE(cl_from_string.command_line_string().empty());
EXPECT_TRUE(cl_from_string.GetProgram().empty());
EXPECT_EQ(1U, cl_from_string.argv().size());
- EXPECT_TRUE(cl_from_string.args().empty());
+ EXPECT_TRUE(cl_from_string.GetArgs().empty());
#endif
CommandLine cl_from_argv(0, NULL);
EXPECT_TRUE(cl_from_argv.command_line_string().empty());
EXPECT_TRUE(cl_from_argv.GetProgram().empty());
EXPECT_EQ(1U, cl_from_argv.argv().size());
- EXPECT_TRUE(cl_from_argv.args().empty());
+ EXPECT_TRUE(cl_from_argv.GetArgs().empty());
}
// Test methods for appending switches to a command line.
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index 2333556..96f406c 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -202,16 +202,18 @@ chromeos::RegistrationScreen* WizardController::GetRegistrationScreen() {
chromeos::HTMLPageScreen* WizardController::GetHTMLPageScreen() {
if (!html_page_screen_.get()) {
- CommandLine* command_line = CommandLine::ForCurrentProcess();
+ const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
+ const CommandLine::StringVector& args = cmd_line->GetArgs();
+
std::string url;
// It's strange but args may contains empty strings.
- for (size_t i = 0; i < command_line->args().size(); i++) {
- if (!command_line->args()[i].empty()) {
+ for (size_t i = 0; i < args.size(); i++) {
+ if (!args[i].empty()) {
DCHECK(url.empty()) << "More than one URL in command line";
- url = command_line->args()[i];
+ url = args[i];
}
}
- DCHECK(!url.empty()) << "No URL in commane line";
+ DCHECK(!url.empty()) << "No URL in command line";
html_page_screen_.reset(
new chromeos::HTMLPageScreen(
oobe_display_->GetHTMLPageScreenActor(), url));
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc
index e91aac0..2484bd6 100644
--- a/chrome/browser/ui/browser_init.cc
+++ b/chrome/browser/ui/browser_init.cc
@@ -1244,7 +1244,7 @@ std::vector<GURL> BrowserInit::GetURLsFromCommandLine(
const FilePath& cur_dir,
Profile* profile) {
std::vector<GURL> urls;
- CommandLine::StringVector params = command_line.args();
+ const CommandLine::StringVector& params = command_line.GetArgs();
for (size_t i = 0; i < params.size(); ++i) {
FilePath param = FilePath(params[i]);
diff --git a/chrome/tools/profiles/generate_profile.cc b/chrome/tools/profiles/generate_profile.cc
index f392137..f7a2dce 100644
--- a/chrome/tools/profiles/generate_profile.cc
+++ b/chrome/tools/profiles/generate_profile.cc
@@ -207,7 +207,8 @@ int main(int argc, const char* argv[]) {
types |= FULL_TEXT;
// We require two arguments: urlcount and profiledir.
- if (cl->args().size() < 2) {
+ const CommandLine::StringVector& args = cl->GetArgs();
+ if (args.size() < 2) {
printf("usage: %s [--top-sites] [--full-text] <urlcount> "
"<profiledir>\n", argv[0]);
printf("\n --top-sites Generate thumbnails\n");
@@ -216,8 +217,8 @@ int main(int argc, const char* argv[]) {
}
int url_count = 0;
- base::StringToInt(WideToUTF8(cl->args()[0]), &url_count);
- FilePath dst_dir(cl->args()[1]);
+ base::StringToInt(WideToUTF8(args[0]), &url_count);
+ FilePath dst_dir(args[1]);
if (!dst_dir.IsAbsolute()) {
FilePath current_dir;
file_util::GetCurrentDirectory(&current_dir);
diff --git a/courgette/courgette_tool.cc b/courgette/courgette_tool.cc
index fe08204..d36f4f1 100644
--- a/courgette/courgette_tool.cc
+++ b/courgette/courgette_tool.cc
@@ -419,11 +419,12 @@ int main(int argc, const char* argv[]) {
// TODO(evanm): this whole file should use FilePaths instead of wstrings.
std::vector<std::wstring> values;
- for (size_t i = 0; i < command_line.args().size(); ++i) {
+ const CommandLine::StringVector& args = command_line.GetArgs();
+ for (size_t i = 0; i < args.size(); ++i) {
#if defined(OS_WIN)
- values.push_back(command_line.args()[i]);
+ values.push_back(args[i]);
#else
- values.push_back(ASCIIToWide(command_line.args()[i]));
+ values.push_back(ASCIIToWide(args[i]));
#endif
}
diff --git a/media/test/ffmpeg_tests/ffmpeg_tests.cc b/media/test/ffmpeg_tests/ffmpeg_tests.cc
index 45e4d31..4bdc6ba 100644
--- a/media/test/ffmpeg_tests/ffmpeg_tests.cc
+++ b/media/test/ffmpeg_tests/ffmpeg_tests.cc
@@ -71,7 +71,7 @@ int main(int argc, const char** argv) {
CommandLine::Init(argc, argv);
const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
- const std::vector<CommandLine::StringType>& filenames = cmd_line->args();
+ const CommandLine::StringVector& filenames = cmd_line->GetArgs();
if (filenames.empty()) {
std::cerr << "Usage: " << argv[0] << " MEDIAFILE" << std::endl;
diff --git a/media/tools/media_bench/media_bench.cc b/media/tools/media_bench/media_bench.cc
index beeed6f..1bf45bc 100644
--- a/media/tools/media_bench/media_bench.cc
+++ b/media/tools/media_bench/media_bench.cc
@@ -91,7 +91,7 @@ int main(int argc, const char** argv) {
CommandLine::Init(argc, argv);
const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
- const std::vector<CommandLine::StringType>& filenames = cmd_line->args();
+ const CommandLine::StringVector& filenames = cmd_line->GetArgs();
if (filenames.empty()) {
std::cerr << "Usage: " << argv[0] << " [OPTIONS] FILE [DUMPFILE]\n"
<< " --stream=[audio|video] "
diff --git a/media/tools/player_wtl/player_wtl.cc b/media/tools/player_wtl/player_wtl.cc
index b1dbabc..72ba193 100644
--- a/media/tools/player_wtl/player_wtl.cc
+++ b/media/tools/player_wtl/player_wtl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -31,7 +31,7 @@ int Run(wchar_t* win_cmd_line, int cmd_show) {
CommandLine::Init(0, NULL);
const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
- const std::vector<std::wstring>& filenames = cmd_line->args();
+ const CommandLine::StringVector& filenames = cmd_line->GetArgs();
CMessageLoop the_loop;
g_module.AddMessageLoop(&the_loop);
diff --git a/media/tools/scaler_bench/scaler_bench.cc b/media/tools/scaler_bench/scaler_bench.cc
index d56cb23..5a5e093 100644
--- a/media/tools/scaler_bench/scaler_bench.cc
+++ b/media/tools/scaler_bench/scaler_bench.cc
@@ -160,7 +160,7 @@ int main(int argc, const char** argv) {
CommandLine::Init(argc, argv);
const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
- if (!cmd_line->args().empty()) {
+ if (!cmd_line->GetArgs().empty()) {
std::cerr << "Usage: " << argv[0] << " [OPTIONS]\n"
<< " --frames=N "
<< "Number of frames\n"
diff --git a/media/tools/wav_ola_test/wav_ola_test.cc b/media/tools/wav_ola_test/wav_ola_test.cc
index 2561baf5..d3a59a8 100644
--- a/media/tools/wav_ola_test/wav_ola_test.cc
+++ b/media/tools/wav_ola_test/wav_ola_test.cc
@@ -73,7 +73,7 @@ int main(int argc, const char** argv) {
CommandLine::Init(argc, argv);
const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
- const std::vector<CommandLine::StringType>& filenames = cmd_line->args();
+ const CommandLine::StringVector& filenames = cmd_line->GetArgs();
if (filenames.empty()) {
std::cerr << "Usage: " << argv[0] << " RATE INFILE OUTFILE\n"
<< std::endl;
diff --git a/remoting/protocol/protocol_test_client.cc b/remoting/protocol/protocol_test_client.cc
index 9f7b6d3..39c3e9e 100644
--- a/remoting/protocol/protocol_test_client.cc
+++ b/remoting/protocol/protocol_test_client.cc
@@ -328,7 +328,7 @@ int main(int argc, char** argv) {
CommandLine::Init(argc, argv);
const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
- if (!cmd_line->args().empty() || cmd_line->HasSwitch("help"))
+ if (!cmd_line->GetArgs().empty() || cmd_line->HasSwitch("help"))
usage(argv[0]);
base::AtExitManager exit_manager;
diff --git a/tools/imagediff/image_diff.cc b/tools/imagediff/image_diff.cc
index 294e2e3..19d5df9 100644
--- a/tools/imagediff/image_diff.cc
+++ b/tools/imagediff/image_diff.cc
@@ -366,7 +366,7 @@ int main(int argc, const char* argv[]) {
return 0;
}
- const std::vector<CommandLine::StringType>& args = parsed_command_line.args();
+ const CommandLine::StringVector& args = parsed_command_line.GetArgs();
if (parsed_command_line.HasSwitch(kOptionGenerateDiff)) {
if (args.size() == 3) {
return DiffImages(FilePath(args[0]),
diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc
index e107b6a..5d2efd2 100644
--- a/webkit/tools/test_shell/test_shell_main.cc
+++ b/webkit/tools/test_shell/test_shell_main.cc
@@ -235,7 +235,7 @@ int main(int argc, char* argv[]) {
.AppendASCII("test_shell").AppendASCII("index.html");
starting_url = net::FilePathToFileURL(path);
- const std::vector<CommandLine::StringType>& args = parsed_command_line.args();
+ const CommandLine::StringVector& args = parsed_command_line.GetArgs();
if (!args.empty()) {
GURL url(args[0]);
if (url.is_valid()) {