OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ |
6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 258 |
259 // Remove SaveItem from in progress map and put it to saved map. | 259 // Remove SaveItem from in progress map and put it to saved map. |
260 void PutInProgressItemToSavedMap(SaveItem* save_item); | 260 void PutInProgressItemToSavedMap(SaveItem* save_item); |
261 | 261 |
262 // Retrieves the URL to be saved from the WebContents. | 262 // Retrieves the URL to be saved from the WebContents. |
263 GURL GetUrlToBeSaved(); | 263 GURL GetUrlToBeSaved(); |
264 | 264 |
265 void CreateDirectoryOnFileThread(const base::FilePath& website_save_dir, | 265 void CreateDirectoryOnFileThread(const base::FilePath& website_save_dir, |
266 const base::FilePath& download_save_dir, | 266 const base::FilePath& download_save_dir, |
267 bool skip_dir_check, | 267 bool skip_dir_check, |
268 const std::string& mime_type, | 268 const std::string& mime_type); |
269 const std::string& accept_langs); | |
270 void ContinueGetSaveInfo(const base::FilePath& suggested_path, | 269 void ContinueGetSaveInfo(const base::FilePath& suggested_path, |
271 bool can_save_as_complete); | 270 bool can_save_as_complete); |
272 void OnPathPicked( | 271 void OnPathPicked( |
273 const base::FilePath& final_name, | 272 const base::FilePath& final_name, |
274 SavePageType type, | 273 SavePageType type, |
275 const SavePackageDownloadCreatedCallback& cb); | 274 const SavePackageDownloadCreatedCallback& cb); |
276 | 275 |
277 // Map from SaveItem::id() (aka save_item_id) into a SaveItem. | 276 // Map from SaveItem::id() (aka save_item_id) into a SaveItem. |
278 using SaveItemIdMap = | 277 using SaveItemIdMap = |
279 std::unordered_map<SaveItemId, SaveItem*, SaveItemId::Hasher>; | 278 std::unordered_map<SaveItemId, SaveItem*, SaveItemId::Hasher>; |
(...skipping 18 matching lines...) Expand all Loading... |
298 // DownloadItem associated to this SavePackage. The files per second is | 297 // DownloadItem associated to this SavePackage. The files per second is |
299 // presented by the DownloadItem to the UI as bytes per second, which is | 298 // presented by the DownloadItem to the UI as bytes per second, which is |
300 // not correct but matches the way the total and received number of files is | 299 // not correct but matches the way the total and received number of files is |
301 // presented as the total and received bytes. | 300 // presented as the total and received bytes. |
302 int64_t CurrentSpeed() const; | 301 int64_t CurrentSpeed() const; |
303 | 302 |
304 // Helper function for preparing suggested name for the SaveAs Dialog. The | 303 // Helper function for preparing suggested name for the SaveAs Dialog. The |
305 // suggested name is determined by the web document's title. | 304 // suggested name is determined by the web document's title. |
306 base::FilePath GetSuggestedNameForSaveAs( | 305 base::FilePath GetSuggestedNameForSaveAs( |
307 bool can_save_as_complete, | 306 bool can_save_as_complete, |
308 const std::string& contents_mime_type, | 307 const std::string& contents_mime_type); |
309 const std::string& accept_langs); | |
310 | 308 |
311 // Ensures that the file name has a proper extension for HTML by adding ".htm" | 309 // Ensures that the file name has a proper extension for HTML by adding ".htm" |
312 // if necessary. | 310 // if necessary. |
313 static base::FilePath EnsureHtmlExtension(const base::FilePath& name); | 311 static base::FilePath EnsureHtmlExtension(const base::FilePath& name); |
314 | 312 |
315 // Ensures that the file name has a proper extension for supported formats | 313 // Ensures that the file name has a proper extension for supported formats |
316 // if necessary. | 314 // if necessary. |
317 static base::FilePath EnsureMimeExtension(const base::FilePath& name, | 315 static base::FilePath EnsureMimeExtension(const base::FilePath& name, |
318 const std::string& contents_mime_type); | 316 const std::string& contents_mime_type); |
319 | 317 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 friend class SavePackageTest; | 414 friend class SavePackageTest; |
417 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestSuggestedSaveNames); | 415 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestSuggestedSaveNames); |
418 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestLongSafePureFilename); | 416 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestLongSafePureFilename); |
419 | 417 |
420 DISALLOW_COPY_AND_ASSIGN(SavePackage); | 418 DISALLOW_COPY_AND_ASSIGN(SavePackage); |
421 }; | 419 }; |
422 | 420 |
423 } // namespace content | 421 } // namespace content |
424 | 422 |
425 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ | 423 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ |
OLD | NEW |