OLD | NEW |
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/pepper/url_response_info_util.h" | 5 #include "content/renderer/pepper/url_response_info_util.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "content/public/renderer/renderer_ppapi_host.h" | 10 #include "content/public/renderer/renderer_ppapi_host.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 buffer_.append(": "); | 38 buffer_.append(": "); |
39 buffer_.append(value.utf8()); | 39 buffer_.append(value.utf8()); |
40 } | 40 } |
41 | 41 |
42 private: | 42 private: |
43 std::string buffer_; | 43 std::string buffer_; |
44 }; | 44 }; |
45 | 45 |
46 bool IsRedirect(int32_t status) { return status >= 300 && status <= 399; } | 46 bool IsRedirect(int32_t status) { return status >= 300 && status <= 399; } |
47 | 47 |
48 void DidCreateResourceHosts(const ppapi::URLResponseInfoData& in_data, | 48 void DidCreateResourceHosts( |
49 const base::FilePath& external_path, | 49 const ppapi::URLResponseInfoData& in_data, |
50 int renderer_pending_host_id, | 50 const base::FilePath& external_path, |
51 const DataFromWebURLResponseCallback& callback, | 51 int renderer_pending_host_id, |
52 const std::vector<int>& browser_pending_host_ids) { | 52 const DataFromWebURLResponseCallback& callback, |
53 DCHECK_EQ(1U, browser_pending_host_ids.size()); | 53 const ppapi::proxy::CompletedBrowserResourceHosts& browser_hosts) { |
| 54 DCHECK_EQ(1U, browser_hosts.host_ids.size()); |
54 int browser_pending_host_id = 0; | 55 int browser_pending_host_id = 0; |
55 | 56 |
56 if (browser_pending_host_ids.size() == 1) | 57 if (browser_hosts.host_ids.size() == 1) |
57 browser_pending_host_id = browser_pending_host_ids[0]; | 58 browser_pending_host_id = browser_hosts.host_ids[0]; |
58 | 59 |
59 ppapi::URLResponseInfoData data = in_data; | 60 ppapi::URLResponseInfoData data = in_data; |
60 | 61 |
61 data.body_as_file_ref = | 62 data.body_as_file_ref = |
62 ppapi::MakeExternalFileRefCreateInfo(external_path, | 63 ppapi::MakeExternalFileRefCreateInfo(external_path, |
63 std::string(), | 64 std::string(), |
64 browser_pending_host_id, | 65 browser_pending_host_id, |
65 renderer_pending_host_id); | 66 renderer_pending_host_id); |
66 callback.Run(data); | 67 callback.Run(data); |
67 } | 68 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 external_path, | 106 external_path, |
106 renderer_pending_host_id, | 107 renderer_pending_host_id, |
107 callback)); | 108 callback)); |
108 } else { | 109 } else { |
109 base::MessageLoop::current()->PostTask(FROM_HERE, | 110 base::MessageLoop::current()->PostTask(FROM_HERE, |
110 base::Bind(callback, data)); | 111 base::Bind(callback, data)); |
111 } | 112 } |
112 } | 113 } |
113 | 114 |
114 } // namespace content | 115 } // namespace content |
OLD | NEW |