| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 return static_cast<int>(in_progress_items_.size()); | 229 return static_cast<int>(in_progress_items_.size()); |
| 230 } | 230 } |
| 231 | 231 |
| 232 // The number of all SaveItems which have completed, including success items | 232 // The number of all SaveItems which have completed, including success items |
| 233 // and failed items. | 233 // and failed items. |
| 234 int completed_count() const { | 234 int completed_count() const { |
| 235 return static_cast<int>(saved_success_items_.size() + | 235 return static_cast<int>(saved_success_items_.size() + |
| 236 saved_failed_items_.size()); | 236 saved_failed_items_.size()); |
| 237 } | 237 } |
| 238 | 238 |
| 239 // Retrieve the preference for the directory to save pages to. |
| 240 static FilePath GetSaveDirPreference(PrefService* prefs); |
| 241 |
| 239 // Helper function for preparing suggested name for the SaveAs Dialog. The | 242 // Helper function for preparing suggested name for the SaveAs Dialog. The |
| 240 // suggested name is composed of the default save path and the web document's | 243 // suggested name is determined by the web document's title. |
| 241 // title. | 244 static FilePath GetSuggestedNameForSaveAs(const FilePath& name, |
| 242 static FilePath GetSuggestNameForSaveAs( | 245 bool can_save_as_complete); |
| 243 PrefService* prefs, const FilePath& name, bool can_save_as_complete); | |
| 244 | 246 |
| 245 // Ensure that the file name has a proper extension for HTML by adding ".htm" | 247 // Ensure that the file name has a proper extension for HTML by adding ".htm" |
| 246 // if necessary. | 248 // if necessary. |
| 247 static FilePath EnsureHtmlExtension(const FilePath& name); | 249 static FilePath EnsureHtmlExtension(const FilePath& name); |
| 248 | 250 |
| 249 typedef std::queue<SaveItem*> SaveItemQueue; | 251 typedef std::queue<SaveItem*> SaveItemQueue; |
| 250 // A queue for items we are about to start saving. | 252 // A queue for items we are about to start saving. |
| 251 SaveItemQueue waiting_item_queue_; | 253 SaveItemQueue waiting_item_queue_; |
| 252 | 254 |
| 253 typedef base::hash_map<int32, SaveItem*> SavedItemMap; | 255 typedef base::hash_map<int32, SaveItem*> SavedItemMap; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 // from outside. | 301 // from outside. |
| 300 WaitState wait_state_; | 302 WaitState wait_state_; |
| 301 | 303 |
| 302 // Unique id for this SavePackage. | 304 // Unique id for this SavePackage. |
| 303 const int tab_id_; | 305 const int tab_id_; |
| 304 | 306 |
| 305 // For managing select file dialogs. | 307 // For managing select file dialogs. |
| 306 scoped_refptr<SelectFileDialog> select_file_dialog_; | 308 scoped_refptr<SelectFileDialog> select_file_dialog_; |
| 307 | 309 |
| 308 friend class SavePackageTest; | 310 friend class SavePackageTest; |
| 311 |
| 309 DISALLOW_COPY_AND_ASSIGN(SavePackage); | 312 DISALLOW_COPY_AND_ASSIGN(SavePackage); |
| 310 }; | 313 }; |
| 311 | 314 |
| 312 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ | 315 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ |
| OLD | NEW |