summaryrefslogtreecommitdiff
path: root/chromium/content/browser/download/save_package.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/content/browser/download/save_package.h')
-rw-r--r--chromium/content/browser/download/save_package.h56
1 files changed, 31 insertions, 25 deletions
diff --git a/chromium/content/browser/download/save_package.h b/chromium/content/browser/download/save_package.h
index 940f5f65feb..783be979877 100644
--- a/chromium/content/browser/download/save_package.h
+++ b/chromium/content/browser/download/save_package.h
@@ -44,7 +44,6 @@ namespace content {
class DownloadManagerImpl;
class FrameTreeNode;
class RenderFrameHostImpl;
-struct SavableSubframe;
class SaveFileManager;
class SaveItem;
class SavePackage;
@@ -127,6 +126,17 @@ class CONTENT_EXPORT SavePackage
void GetSaveInfo();
+ // Response from |sender| frame to GetSavableResourceLinks request.
+ void SavableResourceLinksResponse(
+ RenderFrameHostImpl* sender,
+ const std::vector<GURL>& resources_list,
+ blink::mojom::ReferrerPtr referrer,
+ const std::vector<blink::mojom::SavableSubframePtr>& subframes);
+
+ // Response to GetSavableResourceLinks that indicates an error when processing
+ // the frame associated with |sender|.
+ void SavableResourceLinksError(RenderFrameHostImpl* sender);
+
private:
friend class base::RefCountedThreadSafe<SavePackage>;
@@ -186,10 +196,6 @@ class CONTENT_EXPORT SavePackage
// Continue processing the save page job after one SaveItem has been finished.
void DoSavingProcess();
- // WebContentsObserver implementation.
- bool OnMessageReceived(const IPC::Message& message,
- RenderFrameHost* render_frame_host) override;
-
// Update the download history of this item upon completion.
void FinalizeDownloadEntry();
@@ -233,19 +239,12 @@ class CONTENT_EXPORT SavePackage
// and pending responses are counted/tracked by
// CompleteSavableResourceLinksResponse.
//
- // OnSavableResourceLinksResponse creates SaveItems for each savable resource
+ // SavableResourceLinksResponse creates SaveItems for each savable resource
// and each subframe - these SaveItems get enqueued into |waiting_item_queue_|
// with the help of CreatePendingSaveItem, EnqueueSavableResource,
// EnqueueFrame.
void GetSavableResourceLinks();
- // Response from |sender| frame to GetSavableResourceLinks request.
- void OnSavableResourceLinksResponse(
- RenderFrameHostImpl* sender,
- const std::vector<GURL>& resources_list,
- const Referrer& referrer,
- const std::vector<SavableSubframe>& subframes);
-
// Helper for finding or creating a SaveItem with the given parameters.
SaveItem* CreatePendingSaveItem(
int container_frame_tree_node_id,
@@ -272,13 +271,9 @@ class CONTENT_EXPORT SavePackage
int frame_tree_node_id,
const GURL& frame_original_url);
- // Response to GetSavableResourceLinks that indicates an error when processing
- // the frame associated with |sender|.
- void OnSavableResourceLinksError(RenderFrameHostImpl* sender);
-
// Helper tracking how many |number_of_frames_pending_response_| we have
// left and kicking off the next phase after we got all the
- // OnSavableResourceLinksResponse messages we were waiting for.
+ // SavableResourceLinks reply messages we were waiting for.
void CompleteSavableResourceLinksResponse();
// For each frame in the current page, ask the renderer process associated
@@ -289,12 +284,23 @@ class CONTENT_EXPORT SavePackage
// with resource links replaced with a link to a locally saved copy.
void GetSerializedHtmlWithLocalLinksForFrame(FrameTreeNode* target_tree_node);
- // 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(RenderFrameHostImpl* sender,
- const std::string& data,
- bool end_of_data);
+ // Called when receiving a response to GetSerializedHtmlWithLocalLinks() from
+ // the renderer, including in |data| the amount of content serialized so far.
+ void OnDidReceiveSerializedHtmlData(base::WeakPtr<RenderFrameHostImpl> sender,
+ const std::string& data);
+
+ // Called right after the last response to GetSerializedHtmlWithLocalLinks()
+ // has been received from the renderer, so that the SaveFileManager can also
+ // be notified that the entire process is over.
+ void OnDidFinishedSerializingHtmlData(
+ base::WeakPtr<RenderFrameHostImpl> sender);
+
+ // Helper function to lookup the right SaveItem for a given RenderFrameHost
+ // from the |frame_tree_node_id_to_save_item_| map. Used to avoid duplication
+ // and meant to be used from the DidReceiveData() and Done() callbacks used
+ // along with the call to the remote GetSerializedHtmlWithLocalLinks() method.
+ const SaveItem* LookupSaveItemForSender(
+ base::WeakPtr<RenderFrameHostImpl> sender);
// Look up SaveItem by save item id from in progress map.
SaveItem* LookupInProgressSaveItem(SaveItemId save_item_id);
@@ -353,7 +359,7 @@ class CONTENT_EXPORT SavePackage
std::map<GURL, SaveItem*> url_to_save_item_;
// Map used to route responses from a given a subframe (i.e.
- // OnSerializedHtmlWithLocalLinksResponse) to the right SaveItem.
+ // GetSerializedHtmlWithLocalLinksResponse) to the right SaveItem.
// Note that |frame_tree_node_id_to_save_item_| does NOT own SaveItems - they
// remain owned by waiting_item_queue_, in_progress_items_, etc.
std::unordered_map<int, SaveItem*> frame_tree_node_id_to_save_item_;