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 CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ |
6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ | 6 #define CONTENT_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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 bool canceled() const { return user_canceled_ || disk_error_occurred_; } | 123 bool canceled() const { return user_canceled_ || disk_error_occurred_; } |
124 bool finished() const { return finished_; } | 124 bool finished() const { return finished_; } |
125 SavePackageType save_type() const { return save_type_; } | 125 SavePackageType save_type() const { return save_type_; } |
126 int tab_id() const { return tab_id_; } | 126 int tab_id() const { return tab_id_; } |
127 int id() const { return unique_id_; } | 127 int id() const { return unique_id_; } |
128 TabContents* tab_contents() const { | 128 TabContents* tab_contents() const { |
129 return TabContentsObserver::tab_contents(); | 129 return TabContentsObserver::tab_contents(); |
130 } | 130 } |
131 | 131 |
| 132 // Determines the saved file name based on the information of the |
| 133 // current page, and then starts to download the page. This method |
| 134 // runs in the background and may finish asynchronously after this |
| 135 // method returns. |
132 void GetSaveInfo(); | 136 void GetSaveInfo(); |
133 | 137 |
134 // Statics ------------------------------------------------------------------- | 138 // Statics ------------------------------------------------------------------- |
135 | 139 |
136 // Check whether we can do the saving page operation for the specified URL. | 140 // Check whether we can do the saving page operation for the specified URL. |
137 static bool IsSavableURL(const GURL& url); | 141 static bool IsSavableURL(const GURL& url); |
138 | 142 |
139 // Check whether we can do the saving page operation for the contents which | 143 // Check whether we can do the saving page operation for the contents which |
140 // have the specified MIME type. | 144 // have the specified MIME type. |
141 static bool IsSavableContents(const std::string& contents_mime_type); | 145 static bool IsSavableContents(const std::string& contents_mime_type); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 friend class SavePackageTest; | 323 friend class SavePackageTest; |
320 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestSuggestedSaveNames); | 324 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestSuggestedSaveNames); |
321 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestLongSafePureFilename); | 325 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestLongSafePureFilename); |
322 | 326 |
323 ScopedRunnableMethodFactory<SavePackage> method_factory_; | 327 ScopedRunnableMethodFactory<SavePackage> method_factory_; |
324 | 328 |
325 DISALLOW_COPY_AND_ASSIGN(SavePackage); | 329 DISALLOW_COPY_AND_ASSIGN(SavePackage); |
326 }; | 330 }; |
327 | 331 |
328 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ | 332 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ |
OLD | NEW |