Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: content/browser/download/save_package.h

Issue 1308113008: OOPIFs: Transitioning Get/Send...SavableResourceLinks away from RenderViewHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@page-serialization-test
Patch Set: Fixed 2 minor issues caught during a late self-review. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 7
8 #include <queue> 8 #include <queue>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // Notes from Init() above applies here as well. 140 // Notes from Init() above applies here as well.
141 void InternalInit(); 141 void InternalInit();
142 142
143 void Stop(); 143 void Stop();
144 void CheckFinish(); 144 void CheckFinish();
145 void SaveNextFile(bool process_all_remainder_items); 145 void SaveNextFile(bool process_all_remainder_items);
146 void DoSavingProcess(); 146 void DoSavingProcess();
147 147
148 // WebContentsObserver implementation. 148 // WebContentsObserver implementation.
149 bool OnMessageReceived(const IPC::Message& message) override; 149 bool OnMessageReceived(const IPC::Message& message) override;
150 bool OnMessageReceived(const IPC::Message& message,
151 RenderFrameHost* render_frame_host) override;
150 152
151 // DownloadItem::Observer implementation. 153 // DownloadItem::Observer implementation.
152 void OnDownloadDestroyed(DownloadItem* download) override; 154 void OnDownloadDestroyed(DownloadItem* download) override;
153 155
154 // Update the download history of this item upon completion. 156 // Update the download history of this item upon completion.
155 void FinalizeDownloadEntry(); 157 void FinalizeDownloadEntry();
156 158
157 // Detach from DownloadManager. 159 // Detach from DownloadManager.
158 void StopObservation(); 160 void StopObservation();
159 161
(...skipping 10 matching lines...) Expand all
170 base::FilePath::StringType* pure_file_name); 172 base::FilePath::StringType* pure_file_name);
171 173
172 // Create a file name based on the response from the server. 174 // Create a file name based on the response from the server.
173 bool GenerateFileName(const std::string& disposition, 175 bool GenerateFileName(const std::string& disposition,
174 const GURL& url, 176 const GURL& url,
175 bool need_html_ext, 177 bool need_html_ext,
176 base::FilePath::StringType* generated_name); 178 base::FilePath::StringType* generated_name);
177 179
178 // Get all savable resource links from current web page, include main 180 // Get all savable resource links from current web page, include main
179 // frame and sub-frame. 181 // frame and sub-frame.
180 void GetAllSavableResourceLinksForCurrentPage(); 182 void GetSavableResourceLinksForCurrentPage();
183 void GetSavableResourceLinksForFrame(RenderFrameHost*);
nasko 2015/09/02 23:45:55 Parameters need names.
Łukasz Anforowicz 2015/09/03 16:59:57 Initially I wanted to push back on this feedback (
nasko 2015/09/03 18:17:02 From the Google C++ style guide: "All parameters
Łukasz Anforowicz 2015/09/03 19:41:24 Ok...
184 void OnReceivedNonSavableFrameIndication(RenderFrameHost* render_frame_host);
nasko 2015/09/02 23:45:55 The usual pattern for naming IPC message handlers
Łukasz Anforowicz 2015/09/03 16:59:57 Done.
185 void OnReceivedSavableResourceLinksForFrame(
186 RenderFrameHost* render_frame_host,
187 const std::vector<GURL>& resources_list,
188 const std::vector<Referrer>& referrers_list);
189 void CompleteSavableResourceLinksResponseFromFrame();
190 std::set<GURL> unique_urls_to_save_; // Used to de-dupe urls.
nasko 2015/09/02 23:45:55 Member variables go down in the class, after all m
Łukasz Anforowicz 2015/09/03 16:59:57 Done.
191 int number_of_frames_with_pending_get_savable_resource_links_;
192
181 // Get html data by serializing all frames of current page with lists 193 // Get html data by serializing all frames of current page with lists
182 // which contain all resource links that have local copy. 194 // which contain all resource links that have local copy.
183 void GetSerializedHtmlDataForCurrentPageWithLocalLinks(); 195 void GetSerializedHtmlDataForCurrentPageWithLocalLinks();
184 196
185 // Look up SaveItem by save id from in progress map. 197 // Look up SaveItem by save id from in progress map.
186 SaveItem* LookupItemInProcessBySaveId(int32 save_id); 198 SaveItem* LookupItemInProcessBySaveId(int32 save_id);
187 199
188 // Remove SaveItem from in progress map and put it to saved map. 200 // Remove SaveItem from in progress map and put it to saved map.
189 void PutInProgressItemToSavedMap(SaveItem* save_item); 201 void PutInProgressItemToSavedMap(SaveItem* save_item);
190 202
191 // Retrieves the URL to be saved from the WebContents. 203 // Retrieves the URL to be saved from the WebContents.
192 GURL GetUrlToBeSaved(); 204 GURL GetUrlToBeSaved();
193 205
194 void CreateDirectoryOnFileThread(const base::FilePath& website_save_dir, 206 void CreateDirectoryOnFileThread(const base::FilePath& website_save_dir,
195 const base::FilePath& download_save_dir, 207 const base::FilePath& download_save_dir,
196 bool skip_dir_check, 208 bool skip_dir_check,
197 const std::string& mime_type, 209 const std::string& mime_type,
198 const std::string& accept_langs); 210 const std::string& accept_langs);
199 void ContinueGetSaveInfo(const base::FilePath& suggested_path, 211 void ContinueGetSaveInfo(const base::FilePath& suggested_path,
200 bool can_save_as_complete); 212 bool can_save_as_complete);
201 void OnPathPicked( 213 void OnPathPicked(
202 const base::FilePath& final_name, 214 const base::FilePath& final_name,
203 SavePageType type, 215 SavePageType type,
204 const SavePackageDownloadCreatedCallback& cb); 216 const SavePackageDownloadCreatedCallback& cb);
205 void OnReceivedSavableResourceLinksForCurrentPage(
206 const std::vector<GURL>& resources_list,
207 const std::vector<Referrer>& referrers_list,
208 const std::vector<GURL>& frames_list);
209 217
210 void OnReceivedSerializedHtmlData(const GURL& frame_url, 218 void OnReceivedSerializedHtmlData(const GURL& frame_url,
211 const std::string& data, 219 const std::string& data,
212 int32 status); 220 int32 status);
213 221
214 typedef base::hash_map<std::string, SaveItem*> SaveUrlItemMap; 222 typedef base::hash_map<std::string, SaveItem*> SaveUrlItemMap;
215 // in_progress_items_ is map of all saving job in in-progress state. 223 // in_progress_items_ is map of all saving job in in-progress state.
216 SaveUrlItemMap in_progress_items_; 224 SaveUrlItemMap in_progress_items_;
217 // saved_failed_items_ is map of all saving job which are failed. 225 // saved_failed_items_ is map of all saving job which are failed.
218 SaveUrlItemMap saved_failed_items_; 226 SaveUrlItemMap saved_failed_items_;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 friend class SavePackageTest; 339 friend class SavePackageTest;
332 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestSuggestedSaveNames); 340 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestSuggestedSaveNames);
333 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestLongSafePureFilename); 341 FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestLongSafePureFilename);
334 342
335 DISALLOW_COPY_AND_ASSIGN(SavePackage); 343 DISALLOW_COPY_AND_ASSIGN(SavePackage);
336 }; 344 };
337 345
338 } // namespace content 346 } // namespace content
339 347
340 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ 348 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698