Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Side by Side Diff: chrome/browser/download/base_file.h

Issue 6973052: When the download folder does not exist, change the download folder to a user's "Downloads" (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Remove DownloadTest.DownloadFolder2 and SavePageBrowserTest.SaveFolder4 Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_DOWNLOAD_BASE_FILE_H_ 5 #ifndef CHROME_BROWSER_DOWNLOAD_BASE_FILE_H_
6 #define CHROME_BROWSER_DOWNLOAD_BASE_FILE_H_ 6 #define CHROME_BROWSER_DOWNLOAD_BASE_FILE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 14 matching lines...) Expand all
25 // for DownloadFile and SaveFile, which keep more state information. 25 // for DownloadFile and SaveFile, which keep more state information.
26 class BaseFile { 26 class BaseFile {
27 public: 27 public:
28 BaseFile(const FilePath& full_path, 28 BaseFile(const FilePath& full_path,
29 const GURL& source_url, 29 const GURL& source_url,
30 const GURL& referrer_url, 30 const GURL& referrer_url,
31 int64 received_bytes, 31 int64 received_bytes,
32 const linked_ptr<net::FileStream>& file_stream); 32 const linked_ptr<net::FileStream>& file_stream);
33 virtual ~BaseFile(); 33 virtual ~BaseFile();
34 34
35 // If calculate_hash is true, sha256 hash will be calculated. 35 // If |calculate_hash| is true, sha256 hash will be calculated.
36 bool Initialize(bool calculate_hash); 36 // If the file path is not decided yet (i.e. if we do not specify the
37 // file path when we create this BaseFile object), this method creates
38 // the file under |save_path|.
39 bool Initialize(bool calculate_hash, const FilePath& save_path);
37 40
38 // Write a new chunk of data to the file. Returns true on success (all bytes 41 // Write a new chunk of data to the file. Returns true on success (all bytes
39 // written to the file). 42 // written to the file).
40 bool AppendDataToFile(const char* data, size_t data_len); 43 bool AppendDataToFile(const char* data, size_t data_len);
41 44
42 // Rename the download file. Returns true on success. 45 // Rename the download file. Returns true on success.
43 virtual bool Rename(const FilePath& full_path); 46 virtual bool Rename(const FilePath& full_path);
44 47
45 // Detach the file so it is not deleted on destruction. 48 // Detach the file so it is not deleted on destruction.
46 virtual void Detach(); 49 virtual void Detach();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 unsigned char sha256_hash_[kSha256HashLen]; 102 unsigned char sha256_hash_[kSha256HashLen];
100 103
101 // Indicates that this class no longer owns the associated file, and so 104 // Indicates that this class no longer owns the associated file, and so
102 // won't delete it on destruction. 105 // won't delete it on destruction.
103 bool detached_; 106 bool detached_;
104 107
105 DISALLOW_COPY_AND_ASSIGN(BaseFile); 108 DISALLOW_COPY_AND_ASSIGN(BaseFile);
106 }; 109 };
107 110
108 #endif // CHROME_BROWSER_DOWNLOAD_BASE_FILE_H_ 111 #endif // CHROME_BROWSER_DOWNLOAD_BASE_FILE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/base_file.cc » ('j') | chrome/browser/download/download_item.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698