| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 render_frame_id)); | 278 render_frame_id)); |
| 279 DCHECK(web_contents); | 279 DCHECK(web_contents); |
| 280 // An empty |path| is invalid, but guard against it. If not empty, assume | 280 // An empty |path| is invalid, but guard against it. If not empty, assume |
| 281 // |path| starts with '?', which is stripped away. | 281 // |path| starts with '?', which is stripped away. |
| 282 const std::string path_after_query_separator = | 282 const std::string path_after_query_separator = |
| 283 path.size() > 0 ? path.substr(1) : ""; | 283 path.size() > 0 ? path.substr(1) : ""; |
| 284 RequestViewerHandle* request_viewer_handle = new RequestViewerHandle( | 284 RequestViewerHandle* request_viewer_handle = new RequestViewerHandle( |
| 285 web_contents, scheme_, path_after_query_separator, callback, | 285 web_contents, scheme_, path_after_query_separator, callback, |
| 286 dom_distiller_service_->GetDistilledPagePrefs()); | 286 dom_distiller_service_->GetDistilledPagePrefs()); |
| 287 scoped_ptr<ViewerHandle> viewer_handle = viewer::CreateViewRequest( | 287 scoped_ptr<ViewerHandle> viewer_handle = viewer::CreateViewRequest( |
| 288 dom_distiller_service_, path, request_viewer_handle); | 288 dom_distiller_service_, path, request_viewer_handle, |
| 289 web_contents->GetContainerBounds().size()); |
| 289 | 290 |
| 290 if (viewer_handle) { | 291 if (viewer_handle) { |
| 291 // The service returned a |ViewerHandle| and guarantees it will call | 292 // The service returned a |ViewerHandle| and guarantees it will call |
| 292 // the |RequestViewerHandle|, so passing ownership to it, to ensure the | 293 // the |RequestViewerHandle|, so passing ownership to it, to ensure the |
| 293 // request is not cancelled. The |RequestViewerHandle| will delete itself | 294 // request is not cancelled. The |RequestViewerHandle| will delete itself |
| 294 // after receiving the callback. | 295 // after receiving the callback. |
| 295 request_viewer_handle->TakeViewerHandle(viewer_handle.Pass()); | 296 request_viewer_handle->TakeViewerHandle(viewer_handle.Pass()); |
| 296 } else { | 297 } else { |
| 297 // The service did not return a |ViewerHandle|, which means the | 298 // The service did not return a |ViewerHandle|, which means the |
| 298 // |RequestViewerHandle| will never be called, so clean up now. | 299 // |RequestViewerHandle| will never be called, so clean up now. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 325 const net::URLRequest* request, | 326 const net::URLRequest* request, |
| 326 std::string* path) const { | 327 std::string* path) const { |
| 327 } | 328 } |
| 328 | 329 |
| 329 std::string DomDistillerViewerSource::GetContentSecurityPolicyObjectSrc() | 330 std::string DomDistillerViewerSource::GetContentSecurityPolicyObjectSrc() |
| 330 const { | 331 const { |
| 331 return "object-src 'none'; style-src 'self';"; | 332 return "object-src 'none'; style-src 'self';"; |
| 332 } | 333 } |
| 333 | 334 |
| 334 } // namespace dom_distiller | 335 } // namespace dom_distiller |
| OLD | NEW |