| OLD | NEW |
| 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_SAVE_PACKAGE_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ |
| 6 #define CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 // Show or Open a saved page via the Windows shell. | 118 // Show or Open a saved page via the Windows shell. |
| 119 void ShowDownloadInShell(); | 119 void ShowDownloadInShell(); |
| 120 | 120 |
| 121 bool canceled() const { return user_canceled_ || disk_error_occurred_; } | 121 bool canceled() const { return user_canceled_ || disk_error_occurred_; } |
| 122 bool finished() const { return finished_; } | 122 bool finished() const { return finished_; } |
| 123 SavePackageType save_type() const { return save_type_; } | 123 SavePackageType save_type() const { return save_type_; } |
| 124 int tab_id() const { return tab_id_; } | 124 int tab_id() const { return tab_id_; } |
| 125 int id() const { return unique_id_; } | 125 int id() const { return unique_id_; } |
| 126 | 126 |
| 127 // Determines the saved file name based on the information of the |
| 128 // current page, and then starts to download the page. This method |
| 129 // runs in the background and may finish asynchronously after this |
| 130 // method returns. |
| 127 void GetSaveInfo(); | 131 void GetSaveInfo(); |
| 128 | 132 |
| 129 // Statics ------------------------------------------------------------------- | 133 // Statics ------------------------------------------------------------------- |
| 130 | 134 |
| 131 // Used to disable prompting the user for a directory/filename of the saved | 135 // Used to disable prompting the user for a directory/filename of the saved |
| 132 // web page. This is available for testing. | 136 // web page. This is available for testing. |
| 133 static void SetShouldPromptUser(bool should_prompt); | 137 static void SetShouldPromptUser(bool should_prompt); |
| 134 | 138 |
| 135 // Check whether we can do the saving page operation for the specified URL. | 139 // Check whether we can do the saving page operation for the specified URL. |
| 136 static bool IsSavableURL(const GURL& url); | 140 static bool IsSavableURL(const GURL& url); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 void GetSerializedHtmlDataForCurrentPageWithLocalLinks(); | 193 void GetSerializedHtmlDataForCurrentPageWithLocalLinks(); |
| 190 | 194 |
| 191 SaveItem* LookupItemInProcessBySaveId(int32 save_id); | 195 SaveItem* LookupItemInProcessBySaveId(int32 save_id); |
| 192 void PutInProgressItemToSavedMap(SaveItem* save_item); | 196 void PutInProgressItemToSavedMap(SaveItem* save_item); |
| 193 | 197 |
| 194 // Retrieves the URL to be saved from tab_contents_ variable. | 198 // Retrieves the URL to be saved from tab_contents_ variable. |
| 195 GURL GetUrlToBeSaved(); | 199 GURL GetUrlToBeSaved(); |
| 196 | 200 |
| 197 void CreateDirectoryOnFileThread(const FilePath& website_save_dir, | 201 void CreateDirectoryOnFileThread(const FilePath& website_save_dir, |
| 198 const FilePath& download_save_dir, | 202 const FilePath& download_save_dir, |
| 203 const FilePath& default_download_dir, |
| 199 const std::string& mime_type); | 204 const std::string& mime_type); |
| 200 void ContinueGetSaveInfo(const FilePath& suggested_path, | 205 void ContinueGetSaveInfo(const FilePath& suggested_path, |
| 201 bool can_save_as_complete); | 206 bool can_save_as_complete); |
| 202 void ContinueSave(const FilePath& final_name, int index); | 207 void ContinueSave(const FilePath& final_name, int index); |
| 203 | 208 |
| 204 void OnReceivedSavableResourceLinksForCurrentPage( | 209 void OnReceivedSavableResourceLinksForCurrentPage( |
| 205 const std::vector<GURL>& resources_list, | 210 const std::vector<GURL>& resources_list, |
| 206 const std::vector<GURL>& referrers_list, | 211 const std::vector<GURL>& referrers_list, |
| 207 const std::vector<GURL>& frames_list); | 212 const std::vector<GURL>& frames_list); |
| 208 | 213 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 friend class SavePackageTest; | 323 friend class SavePackageTest; |
| 319 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestSuggestedSaveNames); | 324 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestSuggestedSaveNames); |
| 320 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestLongSafePureFilename); | 325 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestLongSafePureFilename); |
| 321 | 326 |
| 322 ScopedRunnableMethodFactory<SavePackage> method_factory_; | 327 ScopedRunnableMethodFactory<SavePackage> method_factory_; |
| 323 | 328 |
| 324 DISALLOW_COPY_AND_ASSIGN(SavePackage); | 329 DISALLOW_COPY_AND_ASSIGN(SavePackage); |
| 325 }; | 330 }; |
| 326 | 331 |
| 327 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ | 332 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ |
| OLD | NEW |