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 |
133 // Used in automated testing. This method basically does the same thing | |
134 // as GetSaveInfo(), but we can explicitly specify the default folder for | |
135 // saving HTML and the default folder for saving downloaded files. | |
136 void GetSaveInfo(const FilePath& website_save_dir, | |
137 const FilePath& download_save_dir, | |
138 SavePackageType save_type); | |
Randy Smith (Not in Mondays)
2011/05/31 23:03:10
The C++ style guide discourages overloading; see h
haraken1
2011/06/02 09:13:22
Done.
| |
139 | |
129 // Statics ------------------------------------------------------------------- | 140 // Statics ------------------------------------------------------------------- |
130 | 141 |
131 // Used to disable prompting the user for a directory/filename of the saved | 142 // Used to disable prompting the user for a directory/filename of the saved |
132 // web page. This is available for testing. | 143 // web page. This is available for testing. |
133 static void SetShouldPromptUser(bool should_prompt); | 144 static void SetShouldPromptUser(bool should_prompt); |
134 | 145 |
135 // Check whether we can do the saving page operation for the specified URL. | 146 // Check whether we can do the saving page operation for the specified URL. |
136 static bool IsSavableURL(const GURL& url); | 147 static bool IsSavableURL(const GURL& url); |
137 | 148 |
138 // Check whether we can do the saving page operation for the contents which | 149 // Check whether we can do the saving page operation for the contents which |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
318 friend class SavePackageTest; | 329 friend class SavePackageTest; |
319 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestSuggestedSaveNames); | 330 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestSuggestedSaveNames); |
320 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestLongSafePureFilename); | 331 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestLongSafePureFilename); |
321 | 332 |
322 ScopedRunnableMethodFactory<SavePackage> method_factory_; | 333 ScopedRunnableMethodFactory<SavePackage> method_factory_; |
323 | 334 |
324 DISALLOW_COPY_AND_ASSIGN(SavePackage); | 335 DISALLOW_COPY_AND_ASSIGN(SavePackage); |
325 }; | 336 }; |
326 | 337 |
327 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ | 338 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ |
OLD | NEW |