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" | |
Paweł Hajdan Jr.
2011/02/11 19:17:49
nit: Is this include really needed? It should be p
magnus
2011/02/13 03:32:41
See comment below.
| |
19 #include "chrome/browser/shell_dialogs.h" | 20 #include "chrome/browser/shell_dialogs.h" |
20 #include "chrome/browser/tab_contents/tab_contents_observer.h" | 21 #include "chrome/browser/tab_contents/tab_contents_observer.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 commited to the history system | |
Randy Smith (Not in Mondays)
2011/02/11 19:10:07
nit: "is commited"
magnus
2011/02/13 03:32:41
Done.
| |
168 void OnDownloadEntryAdded(DownloadCreateInfo info, int64 db_handle); | |
Paweł Hajdan Jr.
2011/02/11 19:17:49
nit: |info| should probably be passed as const Dow
magnus
2011/02/13 03:32:41
This is actually a callback function for the histo
| |
169 // Called when a Save Page As download is started. | |
Randy Smith (Not in Mondays)
2011/02/11 19:10:07
nit: I'd put a blank line above this comment.
magnus
2011/02/13 03:32:41
Done.
| |
170 void CreateDownloadItem(const FilePath& path, const GURL& url, bool is_otr); | |
171 | |
166 // TabContentsObserver implementation. | 172 // TabContentsObserver implementation. |
167 virtual bool OnMessageReceived(const IPC::Message& message); | 173 virtual bool OnMessageReceived(const IPC::Message& message); |
168 | 174 |
169 // Create a file name based on the response from the server. | 175 // Create a file name based on the response from the server. |
170 bool GenerateFileName(const std::string& disposition, | 176 bool GenerateFileName(const std::string& disposition, |
171 const GURL& url, | 177 const GURL& url, |
172 bool need_html_ext, | 178 bool need_html_ext, |
173 FilePath::StringType* generated_name); | 179 FilePath::StringType* generated_name); |
174 | 180 |
175 // Get all savable resource links from current web page, include main | 181 // Get all savable resource links from current web page, include main |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
311 | 317 |
312 friend class SavePackageTest; | 318 friend class SavePackageTest; |
313 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestSuggestedSaveNames); | 319 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestSuggestedSaveNames); |
314 | 320 |
315 ScopedRunnableMethodFactory<SavePackage> method_factory_; | 321 ScopedRunnableMethodFactory<SavePackage> method_factory_; |
316 | 322 |
317 DISALLOW_COPY_AND_ASSIGN(SavePackage); | 323 DISALLOW_COPY_AND_ASSIGN(SavePackage); |
318 }; | 324 }; |
319 | 325 |
320 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ | 326 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ |
OLD | NEW |