| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/hash_tables.h" | 16 #include "base/hash_tables.h" |
| 17 #include "base/ref_counted.h" | 17 #include "base/ref_counted.h" |
| 18 #include "base/task.h" | 18 #include "base/task.h" |
| 19 #include "chrome/browser/history/download_create_info.h" |
| 19 #include "chrome/browser/tab_contents/tab_contents_observer.h" | 20 #include "chrome/browser/tab_contents/tab_contents_observer.h" |
| 20 #include "chrome/browser/ui/shell_dialogs.h" | 21 #include "chrome/browser/ui/shell_dialogs.h" |
| 21 #include "googleurl/src/gurl.h" | 22 #include "googleurl/src/gurl.h" |
| 22 | 23 |
| 23 class SaveFileManager; | 24 class SaveFileManager; |
| 24 class SaveItem; | 25 class SaveItem; |
| 25 class SavePackage; | 26 class SavePackage; |
| 26 class DownloadItem; | 27 class DownloadItem; |
| 27 class DownloadManager; | 28 class DownloadManager; |
| 28 class GURL; | 29 class GURL; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 ~SavePackage(); | 157 ~SavePackage(); |
| 157 | 158 |
| 158 // Notes from Init() above applies here as well. | 159 // Notes from Init() above applies here as well. |
| 159 void InternalInit(); | 160 void InternalInit(); |
| 160 | 161 |
| 161 void Stop(); | 162 void Stop(); |
| 162 void CheckFinish(); | 163 void CheckFinish(); |
| 163 void SaveNextFile(bool process_all_remainder_items); | 164 void SaveNextFile(bool process_all_remainder_items); |
| 164 void DoSavingProcess(); | 165 void DoSavingProcess(); |
| 165 | 166 |
| 167 // Called when Save Page As entry is commited to the history system. |
| 168 void OnDownloadEntryAdded(DownloadCreateInfo info, int64 db_handle); |
| 169 |
| 170 // Called when a Save Page As download is started. |
| 171 void CreateDownloadItem(const FilePath& path, const GURL& url, bool is_otr); |
| 172 |
| 166 // TabContentsObserver implementation. | 173 // TabContentsObserver implementation. |
| 167 virtual bool OnMessageReceived(const IPC::Message& message); | 174 virtual bool OnMessageReceived(const IPC::Message& message); |
| 168 | 175 |
| 169 // Return max length of a path for a specific base directory. | 176 // Return max length of a path for a specific base directory. |
| 170 // This is needed on POSIX, which restrict the length of file names in | 177 // This is needed on POSIX, which restrict the length of file names in |
| 171 // addition to the restriction on the length of path names. | 178 // addition to the restriction on the length of path names. |
| 172 // |base_dir| is assumed to be a directory name with no trailing slash. | 179 // |base_dir| is assumed to be a directory name with no trailing slash. |
| 173 static uint32 GetMaxPathLengthForDirectory(const FilePath& base_dir); | 180 static uint32 GetMaxPathLengthForDirectory(const FilePath& base_dir); |
| 174 | 181 |
| 175 static bool GetSafePureFileName(const FilePath& dir_path, | 182 static bool GetSafePureFileName(const FilePath& dir_path, |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 friend class SavePackageTest; | 328 friend class SavePackageTest; |
| 322 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestSuggestedSaveNames); | 329 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestSuggestedSaveNames); |
| 323 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestLongSafePureFilename); | 330 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestLongSafePureFilename); |
| 324 | 331 |
| 325 ScopedRunnableMethodFactory<SavePackage> method_factory_; | 332 ScopedRunnableMethodFactory<SavePackage> method_factory_; |
| 326 | 333 |
| 327 DISALLOW_COPY_AND_ASSIGN(SavePackage); | 334 DISALLOW_COPY_AND_ASSIGN(SavePackage); |
| 328 }; | 335 }; |
| 329 | 336 |
| 330 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ | 337 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ |
| OLD | NEW |