summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/download/download_manager.cc5
-rw-r--r--chrome/browser/download/download_util.cc3
-rw-r--r--chrome/browser/download/save_package.cc4
-rw-r--r--chrome/browser/printing/printing_layout_uitest.cc8
-rw-r--r--chrome/browser/shell_integration.cc10
-rw-r--r--chrome/browser/shell_integration.h2
-rw-r--r--chrome/tools/convert_dict/aff_reader.cc3
-rw-r--r--chrome/tools/convert_dict/dic_reader.cc6
8 files changed, 25 insertions, 16 deletions
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index b41be08..fe4a463 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -1327,8 +1327,9 @@ void DownloadManager::GenerateExtension(
FILE_PATH_LITERAL("download");
// See if our file name already contains an extension.
- FilePath::StringType extension(
- file_util::GetFileExtensionFromPath(file_name));
+ FilePath::StringType extension = file_name.Extension();
+ if (!extension.empty())
+ extension.erase(extension.begin()); // Erase preceding '.'.
#if defined(OS_WIN)
// Rename shell-integrated extensions.
diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc
index 2da4c14..591eb83 100644
--- a/chrome/browser/download/download_util.cc
+++ b/chrome/browser/download/download_util.cc
@@ -490,8 +490,7 @@ void UpdateAppIconDownloadProgress(int download_count,
// Appends the passed the number between parenthesis the path before the
// extension.
void AppendNumberToPath(FilePath* path, int number) {
- file_util::InsertBeforeExtension(path,
- StringPrintf(FILE_PATH_LITERAL(" (%d)"), number));
+ *path = path->InsertBeforeExtensionASCII(StringPrintf(" (%d)", number));
}
// Attempts to find a number that can be appended to that path to make it
diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc
index db34e35..f95ba7c 100644
--- a/chrome/browser/download/save_package.cc
+++ b/chrome/browser/download/save_package.cc
@@ -1084,7 +1084,9 @@ FilePath SavePackage::GetSuggestedNameForSaveAs(const FilePath& name,
FilePath SavePackage::EnsureHtmlExtension(const FilePath& name) {
// If the file name doesn't have an extension suitable for HTML files,
// append one.
- FilePath::StringType ext = file_util::GetFileExtensionFromPath(name);
+ FilePath::StringType ext = name.Extension();
+ if (!ext.empty())
+ ext.erase(ext.begin()); // Erase preceding '.'.
std::string mime_type;
if (!net::GetMimeTypeFromExtension(ext, &mime_type) ||
!CanSaveAsComplete(mime_type)) {
diff --git a/chrome/browser/printing/printing_layout_uitest.cc b/chrome/browser/printing/printing_layout_uitest.cc
index 5cfe387..501a7b3 100644
--- a/chrome/browser/printing/printing_layout_uitest.cc
+++ b/chrome/browser/printing/printing_layout_uitest.cc
@@ -80,15 +80,15 @@ class PrintingLayoutTest : public PrintingTest<UITest> {
if (GenerateFiles()) {
// Copy the .emf and generate an .png.
file_util::CopyFile(test_result, emf);
- Image emf_content(emf.value());
+ Image emf_content(emf);
emf_content.SaveToPng(png);
// Saving is always fine.
return 0;
} else {
// File compare between test and result.
- Image emf_content(emf.value());
- Image test_content(test_result.value());
- Image png_content(png.value());
+ Image emf_content(emf);
+ Image test_content(test_result);
+ Image png_content(png);
double diff_emf = emf_content.PercentageDifferent(test_content);
EXPECT_EQ(0., diff_emf) << verification_name <<
diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc
index 23d9fcb..492bb06 100644
--- a/chrome/browser/shell_integration.cc
+++ b/chrome/browser/shell_integration.cc
@@ -18,13 +18,15 @@ std::string ShellIntegration::GetCommandLineArgumentsCommon(const GURL& url,
std::wstring arguments_w;
// Use the same UserDataDir for new launches that we currently have set.
- std::wstring user_data_dir = cmd.GetSwitchValue(switches::kUserDataDir);
- if (!user_data_dir.empty()) {
+ FilePath user_data_dir = cmd.GetSwitchValuePath(switches::kUserDataDir);
+ if (!user_data_dir.value().empty()) {
// Make sure user_data_dir is an absolute path.
if (file_util::AbsolutePath(&user_data_dir) &&
- file_util::PathExists(FilePath::FromWStringHack(user_data_dir))) {
+ file_util::PathExists(user_data_dir)) {
+ // TODO: This is wrong in pathological quoting scenarios; we shouldn't be
+ // passing around command lines as strings at all.
arguments_w += std::wstring(L"--") + ASCIIToWide(switches::kUserDataDir) +
- L"=\"" + user_data_dir + L"\" ";
+ L"=\"" + user_data_dir.ToWStringHack() + L"\" ";
}
}
diff --git a/chrome/browser/shell_integration.h b/chrome/browser/shell_integration.h
index 670063e..a468a46 100644
--- a/chrome/browser/shell_integration.h
+++ b/chrome/browser/shell_integration.h
@@ -71,6 +71,8 @@ class ShellIntegration {
// which is deprecated. If |extension_app_id| is non-empty, an arguments
// string is created using the kAppId=<id> flag. Otherwise, the kApp=<url> is
// used.
+ // FIXME This function is dangerous, do not use! You cannot treat
+ // command lines as plain strings as there are metacharacters.
static std::string GetCommandLineArgumentsCommon(const GURL& url,
const string16& extension_app_id);
diff --git a/chrome/tools/convert_dict/aff_reader.cc b/chrome/tools/convert_dict/aff_reader.cc
index ea7e2a8..767ba92 100644
--- a/chrome/tools/convert_dict/aff_reader.cc
+++ b/chrome/tools/convert_dict/aff_reader.cc
@@ -48,7 +48,8 @@ void CollapseDuplicateSpaces(std::string* str) {
AffReader::AffReader(const std::string& filename)
: has_indexed_affixes_(false) {
- file_ = file_util::OpenFile(filename, "r");
+ FilePath path = FilePath::FromWStringHack(ASCIIToWide(filename));
+ file_ = file_util::OpenFile(path, "r");
// Default to Latin1 in case the file doesn't specify it.
encoding_ = "ISO8859-1";
diff --git a/chrome/tools/convert_dict/dic_reader.cc b/chrome/tools/convert_dict/dic_reader.cc
index 2233d04..bac3162 100644
--- a/chrome/tools/convert_dict/dic_reader.cc
+++ b/chrome/tools/convert_dict/dic_reader.cc
@@ -129,8 +129,10 @@ bool PopulateWordSet(WordSet* word_set, FILE* file, AffReader* aff_reader,
} // namespace
DicReader::DicReader(const std::string& filename) {
- file_ = file_util::OpenFile(filename, "r");
- additional_words_file_ = file_util::OpenFile(filename + "_delta", "r");
+ FilePath path = FilePath::FromWStringHack(ASCIIToWide(filename));
+ file_ = file_util::OpenFile(path, "r");
+ additional_words_file_ =
+ file_util::OpenFile(FilePath(path.InsertBeforeExtension("_delta")), "r");
}
DicReader::~DicReader() {