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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1502563004: Save-Page-As-Complete-Html: Each frame links to a distinct local file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-url-deduping-for-frame-and-adding-save-item-id
Patch Set: Rebasing... Created 5 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 4743 matching lines...) Expand 10 before | Expand all | Expand 10 after
4754 } 4754 }
4755 4755
4756 Referrer referrer = 4756 Referrer referrer =
4757 Referrer(frame_->document().url(), frame_->document().referrerPolicy()); 4757 Referrer(frame_->document().url(), frame_->document().referrerPolicy());
4758 4758
4759 Send(new FrameHostMsg_SavableResourceLinksResponse( 4759 Send(new FrameHostMsg_SavableResourceLinksResponse(
4760 routing_id_, resources_list, referrer, subframes)); 4760 routing_id_, resources_list, referrer, subframes));
4761 } 4761 }
4762 4762
4763 void RenderFrameImpl::OnGetSerializedHtmlWithLocalLinks( 4763 void RenderFrameImpl::OnGetSerializedHtmlWithLocalLinks(
4764 const std::map<GURL, base::FilePath>& url_to_local_path) { 4764 const std::map<GURL, base::FilePath>& url_to_local_path,
4765 const std::map<int, base::FilePath>& frame_routing_id_to_local_path) {
4765 // Convert input to the canonical way of passing a map into a Blink API. 4766 // Convert input to the canonical way of passing a map into a Blink API.
4766 std::vector<std::pair<WebURL, WebString>> weburl_to_local_path; 4767 std::vector<std::pair<WebURL, WebString>> weburl_to_local_path;
4767 for (const auto& it : url_to_local_path) { 4768 for (const auto& it : url_to_local_path) {
4768 const GURL& url = it.first; 4769 const GURL& url = it.first;
4769 const base::FilePath& local_path = it.second; 4770 const base::FilePath& local_path = it.second;
4770 weburl_to_local_path.push_back(std::make_pair( 4771 weburl_to_local_path.push_back(std::make_pair(
4771 WebURL(url), ConvertRelativePathToHtmlAttribute(local_path))); 4772 WebURL(url), ConvertRelativePathToHtmlAttribute(local_path)));
4772 } 4773 }
4774 std::vector<std::pair<WebFrame*, WebString>> webframe_to_local_path;
4775 for (const auto& it : frame_routing_id_to_local_path) {
4776 int routing_id = it.first;
4777 const base::FilePath& local_path = it.second;
4778
4779 WebFrame* web_frame = GetWebFrameFromRoutingIdForFrameOrProxy(routing_id);
4780 if (web_frame) {
4781 webframe_to_local_path.push_back(std::make_pair(
4782 web_frame, ConvertRelativePathToHtmlAttribute(local_path)));
4783 }
4784 }
4773 4785
4774 // Serialize the frame (without recursing into subframes). 4786 // Serialize the frame (without recursing into subframes).
4775 WebPageSerializer::serialize(GetWebFrame(), 4787 WebPageSerializer::serialize(GetWebFrame(),
4776 this, // WebPageSerializerClient. 4788 this, // WebPageSerializerClient.
4777 weburl_to_local_path); 4789 weburl_to_local_path, webframe_to_local_path);
4778 } 4790 }
4779 4791
4780 void RenderFrameImpl::OnSerializeAsMHTML( 4792 void RenderFrameImpl::OnSerializeAsMHTML(
4781 int job_id, 4793 int job_id,
4782 IPC::PlatformFileForTransit file_for_transit, 4794 IPC::PlatformFileForTransit file_for_transit,
4783 const std::string& std_mhtml_boundary, 4795 const std::string& std_mhtml_boundary,
4784 const std::map<int, std::string>& frame_routing_id_to_content_id, 4796 const std::map<int, std::string>& frame_routing_id_to_content_id,
4785 bool is_last_frame) { 4797 bool is_last_frame) {
4786 // Unpack IPC payload. 4798 // Unpack IPC payload.
4787 base::File file = IPC::PlatformFileForTransitToFile(file_for_transit); 4799 base::File file = IPC::PlatformFileForTransitToFile(file_for_transit);
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
5637 media::ConvertToSwitchOutputDeviceCB(web_callbacks); 5649 media::ConvertToSwitchOutputDeviceCB(web_callbacks);
5638 scoped_refptr<media::AudioOutputDevice> device = 5650 scoped_refptr<media::AudioOutputDevice> device =
5639 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), 5651 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(),
5640 security_origin); 5652 security_origin);
5641 media::OutputDeviceStatus status = device->GetDeviceStatus(); 5653 media::OutputDeviceStatus status = device->GetDeviceStatus();
5642 device->Stop(); 5654 device->Stop();
5643 callback.Run(status); 5655 callback.Run(status);
5644 } 5656 }
5645 5657
5646 } // namespace content 5658 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698