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