diff options
author | Torne (Richard Coles) <torne@google.com> | 2013-12-18 16:25:09 +0000 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2013-12-18 16:25:09 +0000 |
commit | a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7 (patch) | |
tree | dafc1c6417406a7fbd422ad0bb890e96909ef564 /content/browser/download | |
parent | d5f893c0bc79db3066bb5ae5d3d972ba1be7dd5f (diff) | |
download | chromium_org-a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7.tar.gz |
Merge from Chromium at DEPS revision 240154
This commit was generated by merge_to_master.py.
Change-Id: I8f2ba858cf0e7f413dddedc2ae91dc37f7136c2e
Diffstat (limited to 'content/browser/download')
-rw-r--r-- | content/browser/download/base_file.cc | 6 | ||||
-rw-r--r-- | content/browser/download/base_file_unittest.cc | 7 | ||||
-rw-r--r-- | content/browser/download/download_file_unittest.cc | 4 | ||||
-rw-r--r-- | content/browser/download/download_manager_impl.cc | 2 | ||||
-rw-r--r-- | content/browser/download/download_manager_impl_unittest.cc | 2 | ||||
-rw-r--r-- | content/browser/download/drag_download_file.h | 1 | ||||
-rw-r--r-- | content/browser/download/drag_download_util.cc | 12 | ||||
-rw-r--r-- | content/browser/download/drag_download_util.h | 4 | ||||
-rw-r--r-- | content/browser/download/file_metadata_unittest_linux.cc | 3 | ||||
-rw-r--r-- | content/browser/download/mhtml_generation_browsertest.cc | 2 | ||||
-rw-r--r-- | content/browser/download/save_file_manager.cc | 2 | ||||
-rw-r--r-- | content/browser/download/save_package.cc | 4 | ||||
-rw-r--r-- | content/browser/download/save_package.h | 2 | ||||
-rw-r--r-- | content/browser/download/save_package_unittest.cc | 4 |
14 files changed, 26 insertions, 29 deletions
diff --git a/content/browser/download/base_file.cc b/content/browser/download/base_file.cc index 90ab485c36..1de3e842dd 100644 --- a/content/browser/download/base_file.cc +++ b/content/browser/download/base_file.cc @@ -82,8 +82,8 @@ DownloadInterruptReason BaseFile::Initialize( // |initial_directory| can still be empty if ContentBrowserClient returned // an empty path for the downloads directory. if ((initial_directory.empty() || - !file_util::CreateTemporaryFileInDir(initial_directory, &temp_file)) && - !file_util::CreateTemporaryFile(&temp_file)) { + !base::CreateTemporaryFileInDir(initial_directory, &temp_file)) && + !base::CreateTemporaryFile(&temp_file)) { return LogInterruptReason("Unable to create", 0, DOWNLOAD_INTERRUPT_REASON_FILE_FAILED); } @@ -165,7 +165,7 @@ DownloadInterruptReason BaseFile::Rename(const base::FilePath& new_path) { net::NetLog::TYPE_DOWNLOAD_FILE_RENAMED, base::Bind(&FileRenamedNetLogCallback, &full_path_, &new_path)); Close(); - file_util::CreateDirectory(new_path.DirName()); + base::CreateDirectory(new_path.DirName()); // A simple rename wouldn't work here since we want the file to have // permissions / security descriptors that makes sense in the new directory. diff --git a/content/browser/download/base_file_unittest.cc b/content/browser/download/base_file_unittest.cc index b82b0a8ab7..4ab0c2ae8f 100644 --- a/content/browser/download/base_file_unittest.cc +++ b/content/browser/download/base_file_unittest.cc @@ -464,7 +464,7 @@ TEST_F(BaseFileTest, RenameWithError) { // TestDir is a subdirectory in |temp_dir_| that we will make read-only so // that the rename will fail. base::FilePath test_dir(temp_dir_.path().AppendASCII("TestDir")); - ASSERT_TRUE(file_util::CreateDirectory(test_dir)); + ASSERT_TRUE(base::CreateDirectory(test_dir)); base::FilePath new_path(test_dir.AppendASCII("TestFile")); EXPECT_FALSE(base::PathExists(new_path)); @@ -482,7 +482,7 @@ TEST_F(BaseFileTest, RenameWithError) { // Write data to the file multiple times. TEST_F(BaseFileTest, MultipleWritesWithError) { base::FilePath path; - ASSERT_TRUE(file_util::CreateTemporaryFile(&path)); + ASSERT_TRUE(base::CreateTemporaryFile(&path)); // Create a new file stream. scoped_ptr takes ownership and passes it to // BaseFile; we use the pointer anyway and rely on the BaseFile not // deleting the MockFileStream until the BaseFile is reset. @@ -623,8 +623,7 @@ TEST_F(BaseFileTest, CreatedInDefaultDirectory) { // be a string-wise match to base_file_->full_path().DirName() even though // they are in the same directory. base::FilePath temp_file; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &temp_file)); ASSERT_FALSE(temp_file.empty()); EXPECT_STREQ(temp_file.DirName().value().c_str(), base_file_->full_path().DirName().value().c_str()); diff --git a/content/browser/download/download_file_unittest.cc b/content/browser/download/download_file_unittest.cc index dcc0e424bd..141808685f 100644 --- a/content/browser/download/download_file_unittest.cc +++ b/content/browser/download/download_file_unittest.cc @@ -195,7 +195,7 @@ class DownloadFileTest : public testing::Test { void VerifyStreamAndSize() { ::testing::Mock::VerifyAndClearExpectations(input_stream_); int64 size; - EXPECT_TRUE(file_util::GetFileSize(download_file_->FullPath(), &size)); + EXPECT_TRUE(base::GetFileSize(download_file_->FullPath(), &size)); EXPECT_EQ(expected_data_.size(), static_cast<size_t>(size)); } @@ -461,7 +461,7 @@ TEST_F(DownloadFileTest, RenameError) { // Create a subdirectory. base::FilePath tempdir( initial_path.DirName().Append(FILE_PATH_LITERAL("tempdir"))); - ASSERT_TRUE(file_util::CreateDirectory(tempdir)); + ASSERT_TRUE(base::CreateDirectory(tempdir)); base::FilePath target_path(tempdir.Append(initial_path.BaseName())); // Targets diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc index ea0f305a5a..35825d32a9 100644 --- a/content/browser/download/download_manager_impl.cc +++ b/content/browser/download/download_manager_impl.cc @@ -413,7 +413,7 @@ void DownloadManagerImpl::StartDownloadWithId( file_factory_->CreateFile( info->save_info.Pass(), default_download_directory, info->url(), info->referrer_url, - delegate_->GenerateFileHash(), + delegate_ && delegate_->GenerateFileHash(), stream.Pass(), download->GetBoundNetLog(), download->DestinationObserverAsWeakPtr())); diff --git a/content/browser/download/download_manager_impl_unittest.cc b/content/browser/download/download_manager_impl_unittest.cc index aecded1262..3afc41ad5a 100644 --- a/content/browser/download/download_manager_impl_unittest.cc +++ b/content/browser/download/download_manager_impl_unittest.cc @@ -120,7 +120,7 @@ class MockDownloadItemImpl : public DownloadItemImpl { MOCK_CONST_METHOD0(CurrentSpeed, int64()); MOCK_CONST_METHOD0(PercentComplete, int()); MOCK_CONST_METHOD0(AllDataSaved, bool()); - MOCK_CONST_METHOD1(MatchesQuery, bool(const string16& query)); + MOCK_CONST_METHOD1(MatchesQuery, bool(const base::string16& query)); MOCK_CONST_METHOD0(IsDone, bool()); MOCK_CONST_METHOD0(GetFullPath, const base::FilePath&()); MOCK_CONST_METHOD0(GetTargetFilePath, const base::FilePath&()); diff --git a/content/browser/download/drag_download_file.h b/content/browser/download/drag_download_file.h index 41fdf6224e..c281d977d8 100644 --- a/content/browser/download/drag_download_file.h +++ b/content/browser/download/drag_download_file.h @@ -17,7 +17,6 @@ #include "content/public/common/referrer.h" #include "net/base/file_stream.h" #include "ui/base/dragdrop/download_file_interface.h" -#include "ui/base/ui_export.h" #include "url/gurl.h" namespace net { diff --git a/content/browser/download/drag_download_util.cc b/content/browser/download/drag_download_util.cc index 41bff06dd2..0850c3ba08 100644 --- a/content/browser/download/drag_download_util.cc +++ b/content/browser/download/drag_download_util.cc @@ -23,18 +23,18 @@ using net::FileStream; namespace content { -bool ParseDownloadMetadata(const string16& metadata, - string16* mime_type, +bool ParseDownloadMetadata(const base::string16& metadata, + base::string16* mime_type, base::FilePath* file_name, GURL* url) { const char16 separator = L':'; size_t mime_type_end_pos = metadata.find(separator); - if (mime_type_end_pos == string16::npos) + if (mime_type_end_pos == base::string16::npos) return false; size_t file_name_end_pos = metadata.find(separator, mime_type_end_pos + 1); - if (file_name_end_pos == string16::npos) + if (file_name_end_pos == base::string16::npos) return false; GURL parsed_url = GURL(metadata.substr(file_name_end_pos + 1)); @@ -44,7 +44,7 @@ bool ParseDownloadMetadata(const string16& metadata, if (mime_type) *mime_type = metadata.substr(0, mime_type_end_pos); if (file_name) { - string16 file_name_str = metadata.substr( + base::string16 file_name_str = metadata.substr( mime_type_end_pos + 1, file_name_end_pos - mime_type_end_pos - 1); #if defined(OS_WIN) *file_name = base::FilePath(file_name_str); @@ -70,7 +70,7 @@ FileStream* CreateFileStreamForDrop(base::FilePath* file_path, new_file_path = *file_path; } else { #if defined(OS_WIN) - string16 suffix = ASCIIToUTF16("-") + base::IntToString16(seq); + base::string16 suffix = ASCIIToUTF16("-") + base::IntToString16(seq); #else std::string suffix = std::string("-") + base::IntToString(seq); #endif diff --git a/content/browser/download/drag_download_util.h b/content/browser/download/drag_download_util.h index 8b58f4840e..ca266efa62 100644 --- a/content/browser/download/drag_download_util.h +++ b/content/browser/download/drag_download_util.h @@ -32,8 +32,8 @@ namespace content { // appropriately. // For example, we can have // text/plain:example.txt:http://example.com/example.txt -bool ParseDownloadMetadata(const string16& metadata, - string16* mime_type, +bool ParseDownloadMetadata(const base::string16& metadata, + base::string16* mime_type, base::FilePath* file_name, GURL* url); diff --git a/content/browser/download/file_metadata_unittest_linux.cc b/content/browser/download/file_metadata_unittest_linux.cc index 4f223519c4..96db264647 100644 --- a/content/browser/download/file_metadata_unittest_linux.cc +++ b/content/browser/download/file_metadata_unittest_linux.cc @@ -52,8 +52,7 @@ class FileMetadataLinuxTest : public testing::Test { protected: virtual void SetUp() OVERRIDE { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &test_file_)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &test_file_)); int result = setxattr(test_file_.value().c_str(), "user.test", "test", 4, 0); is_xattr_supported_ = (!result) || (errno != ENOTSUP); diff --git a/content/browser/download/mhtml_generation_browsertest.cc b/content/browser/download/mhtml_generation_browsertest.cc index 6e790135bc..11a08519e2 100644 --- a/content/browser/download/mhtml_generation_browsertest.cc +++ b/content/browser/download/mhtml_generation_browsertest.cc @@ -66,7 +66,7 @@ IN_PROC_BROWSER_TEST_F(MHTMLGenerationTest, GenerateMHTML) { // Make sure the actual generated file has some contents. int64 file_size; - ASSERT_TRUE(file_util::GetFileSize(path, &file_size)); + ASSERT_TRUE(base::GetFileSize(path, &file_size)); EXPECT_GT(file_size, 100); } diff --git a/content/browser/download/save_file_manager.cc b/content/browser/download/save_file_manager.cc index 442c28e102..85651b7709 100644 --- a/content/browser/download/save_file_manager.cc +++ b/content/browser/download/save_file_manager.cc @@ -482,7 +482,7 @@ void SaveFileManager::RenameAllFiles( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); if (!resource_dir.empty() && !base::PathExists(resource_dir)) - file_util::CreateDirectory(resource_dir); + base::CreateDirectory(resource_dir); for (FinalNameList::const_iterator i = final_names.begin(); i != final_names.end(); ++i) { diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index 2fc68dff55..5961e6bf58 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc @@ -519,7 +519,7 @@ bool SavePackage::GenerateFileName(const std::string& disposition, if (ordinal_number > (kMaxFileOrdinalNumber - 1)) { // Use a random file from temporary file. base::FilePath temp_file; - file_util::CreateTemporaryFile(&temp_file); + base::CreateTemporaryFile(&temp_file); file_name = temp_file.RemoveExtension().BaseName().value(); // Get safe pure file name. if (!GetSafePureFileName(saved_main_directory_path_, @@ -1347,7 +1347,7 @@ void SavePackage::CreateDirectoryOnFileThread( if (!skip_dir_check && !base::DirectoryExists(website_save_dir)) { // If the default download dir doesn't exist, create it. if (!base::DirectoryExists(download_save_dir)) { - bool res = file_util::CreateDirectory(download_save_dir); + bool res = base::CreateDirectory(download_save_dir); DCHECK(res); } save_dir = download_save_dir; diff --git a/content/browser/download/save_package.h b/content/browser/download/save_package.h index 939002e1ee..1ab429e16b 100644 --- a/content/browser/download/save_package.h +++ b/content/browser/download/save_package.h @@ -279,7 +279,7 @@ class CONTENT_EXPORT SavePackage base::FilePath saved_main_directory_path_; // The title of the page the user wants to save. - string16 title_; + base::string16 title_; // Used to calculate package download speed (in files per second). base::TimeTicks start_tick_; diff --git a/content/browser/download/save_package_unittest.cc b/content/browser/download/save_package_unittest.cc index c0aa3f8862..47fd1b4668 100644 --- a/content/browser/download/save_package_unittest.cc +++ b/content/browser/download/save_package_unittest.cc @@ -10,8 +10,8 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "content/browser/download/save_package.h" -#include "content/browser/renderer_host/test_render_view_host.h" #include "content/test/net/url_request_mock_http_job.h" +#include "content/test/test_render_view_host.h" #include "content/test/test_web_contents.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" @@ -346,7 +346,7 @@ TEST_F(SavePackageTest, MAYBE_TestEnsureMimeExtension) { static const struct SuggestedSaveNameTestCase { const char* page_url; - const string16 page_title; + const base::string16 page_title; const base::FilePath::CharType* expected_name; bool ensure_html_extension; } kSuggestedSaveNames[] = { |