OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/dom_distiller/content/dom_distiller_viewer_source.h" | 5 #include "components/dom_distiller/content/dom_distiller_viewer_source.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 content::RenderFrameHost::FromID(render_process_id, | 256 content::RenderFrameHost::FromID(render_process_id, |
257 render_frame_id)); | 257 render_frame_id)); |
258 DCHECK(web_contents); | 258 DCHECK(web_contents); |
259 // An empty |path| is invalid, but guard against it. If not empty, assume | 259 // An empty |path| is invalid, but guard against it. If not empty, assume |
260 // |path| starts with '?', which is stripped away. | 260 // |path| starts with '?', which is stripped away. |
261 const std::string path_after_query_separator = | 261 const std::string path_after_query_separator = |
262 path.size() > 0 ? path.substr(1) : ""; | 262 path.size() > 0 ? path.substr(1) : ""; |
263 RequestViewerHandle* request_viewer_handle = new RequestViewerHandle( | 263 RequestViewerHandle* request_viewer_handle = new RequestViewerHandle( |
264 web_contents, scheme_, path_after_query_separator, callback); | 264 web_contents, scheme_, path_after_query_separator, callback); |
265 scoped_ptr<ViewerHandle> viewer_handle = viewer::CreateViewRequest( | 265 scoped_ptr<ViewerHandle> viewer_handle = viewer::CreateViewRequest( |
266 dom_distiller_service_, path, request_viewer_handle); | 266 dom_distiller_service_, path, request_viewer_handle, |
| 267 web_contents->GetContainerBounds().size()); |
267 | 268 |
268 if (viewer_handle) { | 269 if (viewer_handle) { |
269 // The service returned a |ViewerHandle| and guarantees it will call | 270 // The service returned a |ViewerHandle| and guarantees it will call |
270 // the |RequestViewerHandle|, so passing ownership to it, to ensure the | 271 // the |RequestViewerHandle|, so passing ownership to it, to ensure the |
271 // request is not cancelled. The |RequestViewerHandle| will delete itself | 272 // request is not cancelled. The |RequestViewerHandle| will delete itself |
272 // after receiving the callback. | 273 // after receiving the callback. |
273 request_viewer_handle->TakeViewerHandle(viewer_handle.Pass()); | 274 request_viewer_handle->TakeViewerHandle(viewer_handle.Pass()); |
274 } else { | 275 } else { |
275 // The service did not return a |ViewerHandle|, which means the | 276 // The service did not return a |ViewerHandle|, which means the |
276 // |RequestViewerHandle| will never be called, so clean up now. | 277 // |RequestViewerHandle| will never be called, so clean up now. |
(...skipping 25 matching lines...) Expand all Loading... |
302 const net::URLRequest* request, | 303 const net::URLRequest* request, |
303 std::string* path) const { | 304 std::string* path) const { |
304 } | 305 } |
305 | 306 |
306 std::string DomDistillerViewerSource::GetContentSecurityPolicyObjectSrc() | 307 std::string DomDistillerViewerSource::GetContentSecurityPolicyObjectSrc() |
307 const { | 308 const { |
308 return "object-src 'none'; style-src 'self';"; | 309 return "object-src 'none'; style-src 'self';"; |
309 } | 310 } |
310 | 311 |
311 } // namespace dom_distiller | 312 } // namespace dom_distiller |
OLD | NEW |