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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 } else if (kViewerJsPath == path) { | 315 } else if (kViewerJsPath == path) { |
316 std::string js = viewer::GetJavaScript(); | 316 std::string js = viewer::GetJavaScript(); |
317 callback.Run(base::RefCountedString::TakeString(&js)); | 317 callback.Run(base::RefCountedString::TakeString(&js)); |
318 return; | 318 return; |
319 } else if (kViewerViewOriginalPath == path) { | 319 } else if (kViewerViewOriginalPath == path) { |
320 content::RecordAction(base::UserMetricsAction("DomDistiller_ViewOriginal")); | 320 content::RecordAction(base::UserMetricsAction("DomDistiller_ViewOriginal")); |
321 callback.Run(NULL); | 321 callback.Run(NULL); |
322 return; | 322 return; |
323 } else if (kFeedbackBad == path) { | 323 } else if (kFeedbackBad == path) { |
324 FeedbackReporter::ReportQuality(false); | 324 FeedbackReporter::ReportQuality(false); |
| 325 callback.Run(NULL); |
325 if (!external_feedback_reporter_) | 326 if (!external_feedback_reporter_) |
326 return; | 327 return; |
327 content::WebContents* contents = | 328 content::WebContents* contents = |
328 content::WebContents::FromRenderFrameHost(render_frame_host); | 329 content::WebContents::FromRenderFrameHost(render_frame_host); |
329 external_feedback_reporter_->ReportExternalFeedback( | 330 external_feedback_reporter_->ReportExternalFeedback( |
330 contents, contents->GetURL(), false); | 331 contents, contents->GetURL(), false); |
331 return; | 332 return; |
332 } else if (kFeedbackGood == path) { | 333 } else if (kFeedbackGood == path) { |
333 FeedbackReporter::ReportQuality(true); | 334 FeedbackReporter::ReportQuality(true); |
| 335 callback.Run(NULL); |
334 return; | 336 return; |
335 } | 337 } |
336 content::WebContents* web_contents = | 338 content::WebContents* web_contents = |
337 content::WebContents::FromRenderFrameHost(render_frame_host); | 339 content::WebContents::FromRenderFrameHost(render_frame_host); |
338 DCHECK(web_contents); | 340 DCHECK(web_contents); |
339 // An empty |path| is invalid, but guard against it. If not empty, assume | 341 // An empty |path| is invalid, but guard against it. If not empty, assume |
340 // |path| starts with '?', which is stripped away. | 342 // |path| starts with '?', which is stripped away. |
341 const std::string path_after_query_separator = | 343 const std::string path_after_query_separator = |
342 path.size() > 0 ? path.substr(1) : ""; | 344 path.size() > 0 ? path.substr(1) : ""; |
343 RequestViewerHandle* request_viewer_handle = new RequestViewerHandle( | 345 RequestViewerHandle* request_viewer_handle = new RequestViewerHandle( |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 std::string DomDistillerViewerSource::GetContentSecurityPolicyObjectSrc() | 385 std::string DomDistillerViewerSource::GetContentSecurityPolicyObjectSrc() |
384 const { | 386 const { |
385 return "object-src 'none'; style-src 'self' https://fonts.googleapis.com;"; | 387 return "object-src 'none'; style-src 'self' https://fonts.googleapis.com;"; |
386 } | 388 } |
387 | 389 |
388 std::string DomDistillerViewerSource::GetContentSecurityPolicyFrameSrc() const { | 390 std::string DomDistillerViewerSource::GetContentSecurityPolicyFrameSrc() const { |
389 return "frame-src *;"; | 391 return "frame-src *;"; |
390 } | 392 } |
391 | 393 |
392 } // namespace dom_distiller | 394 } // namespace dom_distiller |
OLD | NEW |