| Index: content/browser/download/save_package.h
|
| diff --git a/content/browser/download/save_package.h b/content/browser/download/save_package.h
|
| index 5971c14df8b2c5b95dfa86e337773b05bbf417e3..93e8cb5bf048d4cfd44fdb7bf9ca379ae8e187c2 100644
|
| --- a/content/browser/download/save_package.h
|
| +++ b/content/browser/download/save_package.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_
|
| #define CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_
|
|
|
| +#include <map>
|
| #include <queue>
|
| #include <set>
|
| #include <string>
|
| @@ -189,28 +190,48 @@ class CONTENT_EXPORT SavePackage
|
| void CompleteSavableResourceLinksResponse();
|
|
|
| // Ask renderer processes to serialize all frames in the current page.
|
| + // (serialize into html data with "blanks" that we can replace with links to
|
| + // local paths).
|
| void GetSerializedHtmlWithLocalLinks();
|
|
|
| - // Ask renderer process to serialize |target| frame into html data
|
| - // with lists which contain all resource links that have a local copy.
|
| - // The parameter |saved_links| contains original URLs of all saved links.
|
| - // The parameter |saved_file_paths| contains corresponding local file paths of
|
| - // all saved links, which is matched with vector:links one by one.
|
| - // The parameter |relative_dir_name| is relative path of directory which
|
| - // contain all saved auxiliary files included all sub frames and resouces.
|
| - void GetSerializedHtmlWithLocalLinksForFrame(
|
| - const std::vector<GURL>& saved_links,
|
| - const std::vector<base::FilePath>& saved_file_paths,
|
| - const base::FilePath& relative_dir_name,
|
| - RenderFrameHost* target);
|
| -
|
| - // Routes html data (sent by renderer process in response to
|
| - // GetSerializedHtmlWithLocalLinksForFrame above) to the associated local file
|
| - // (and also keeps track of when all frames have been completed).
|
| - void OnSerializedHtmlWithLocalLinksResponse(RenderFrameHost* sender,
|
| - const GURL& frame_url,
|
| - const std::string& data,
|
| - int32 status);
|
| + // Equivalent of GetSerializedHtmlWithLocalLinks that targets a single
|
| + // |target| frame.
|
| + void GetSerializedHtmlWithLocalLinksForFrame(RenderFrameHost* target);
|
| +
|
| + // Response to GetSerializedHtmlWithLocalLinksForFrame above that routes html
|
| + // fragment into the local file associated with |sender|.
|
| + void OnSerializedHtmlFragment(RenderFrameHost* sender,
|
| + const std::string& data);
|
| +
|
| + // Response to GetSerializedHtmlWithLocalLinksForFrame above that replaces
|
| + // |render_frame_or_proxy_routing_id| with a corresponding local path
|
| + // and then writes the result to the local file associated with |sender|.
|
| + void OnSerializedLocalPathForSubFrame(RenderFrameHost* sender,
|
| + int render_frame_or_proxy_routing_id);
|
| +
|
| + // Response to GetSerializedHtmlWithLocalLinksForFrame above that replaces
|
| + // |savable_resource| with a corresponding local path and then writes the
|
| + // result to the local file associated with |sender|.
|
| + void OnSerializedLocalPathForSavableResource(RenderFrameHost* sender,
|
| + const GURL& savable_resource);
|
| +
|
| + // Response to GetSerializedHtmlWithLocalLinksForFrame above that keeps track
|
| + // of how many frames still need to complete their serialization process.
|
| + void OnSerializedEndOfFrame(RenderFrameHost* sender);
|
| +
|
| + // Helper used by OnSerializedLocalPathForSubFrame and
|
| + // OnSerializedLocalPathForSavableResource to convert |save_item| into a local
|
| + // path (and falling back to |fallback_url| if |save_item| is null).
|
| + void SerializeLocalPathForSaveItem(RenderFrameHost* sender,
|
| + SaveItem* save_item,
|
| + const GURL& fallback_url);
|
| +
|
| + // Finds in-progress SaveItem by |frame_tree_node_id|.
|
| + SaveItem* FindInProgressSaveItemByFrameTreeNodeID(int frame_tree_node_id);
|
| +
|
| + // Helper to log telemetry entry for writes to already completed or failed
|
| + // SaveItems.
|
| + void LogWriteToAlreadyCompletedOrFailedSaveItem(int frame_tree_node_id);
|
|
|
| // Look up SaveItem by save id from in progress map.
|
| SaveItem* LookupItemInProcessBySaveId(int32 save_id);
|
| @@ -283,11 +304,11 @@ class CONTENT_EXPORT SavePackage
|
| // A queue for items we are about to start saving.
|
| SaveItemQueue waiting_item_queue_;
|
|
|
| - // Used to de-dupe urls that are being gathered into |waiting_item_queue_|.
|
| - std::set<GURL> unique_urls_to_save_;
|
| -
|
| - // Temporarily stores urls of savable frames, until we can process them.
|
| - std::vector<GURL> frame_urls_to_save_;
|
| + // Used to
|
| + // 1) de-dupe urls that are being gathered into |waiting_item_queue_|
|
| + // 2) find a SaveItem which needs to be updated with frame_tree_node_id or
|
| + // referrer.
|
| + std::map<GURL, SaveItem*> url_to_save_item_;
|
|
|
| // Number of frames that we still need to get a response from.
|
| int number_of_frames_pending_response_;
|
|
|