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/browser/dom_distiller_viewer_source.h
" | 5 #include "components/dom_distiller/content/browser/dom_distiller_viewer_source.h
" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "components/dom_distiller/core/experiments.h" | 27 #include "components/dom_distiller/core/experiments.h" |
28 #include "components/dom_distiller/core/feedback_reporter.h" | 28 #include "components/dom_distiller/core/feedback_reporter.h" |
29 #include "components/dom_distiller/core/task_tracker.h" | 29 #include "components/dom_distiller/core/task_tracker.h" |
30 #include "components/dom_distiller/core/url_constants.h" | 30 #include "components/dom_distiller/core/url_constants.h" |
31 #include "components/dom_distiller/core/url_utils.h" | 31 #include "components/dom_distiller/core/url_utils.h" |
32 #include "components/dom_distiller/core/viewer.h" | 32 #include "components/dom_distiller/core/viewer.h" |
33 #include "content/public/browser/navigation_details.h" | 33 #include "content/public/browser/navigation_details.h" |
34 #include "content/public/browser/navigation_entry.h" | 34 #include "content/public/browser/navigation_entry.h" |
35 #include "content/public/browser/navigation_handle.h" | 35 #include "content/public/browser/navigation_handle.h" |
36 #include "content/public/browser/render_frame_host.h" | 36 #include "content/public/browser/render_frame_host.h" |
37 #include "content/public/browser/render_view_host.h" | |
38 #include "content/public/browser/web_contents.h" | 37 #include "content/public/browser/web_contents.h" |
39 #include "content/public/browser/web_contents_observer.h" | 38 #include "content/public/browser/web_contents_observer.h" |
40 #include "grit/components_strings.h" | 39 #include "grit/components_strings.h" |
41 #include "mojo/public/cpp/bindings/strong_binding.h" | 40 #include "mojo/public/cpp/bindings/strong_binding.h" |
42 #include "net/base/url_util.h" | 41 #include "net/base/url_util.h" |
43 #include "net/url_request/url_request.h" | 42 #include "net/url_request/url_request.h" |
44 #include "services/service_manager/public/cpp/interface_provider.h" | 43 #include "services/service_manager/public/cpp/interface_provider.h" |
45 #include "services/service_manager/public/cpp/interface_registry.h" | 44 #include "services/service_manager/public/cpp/interface_registry.h" |
46 #include "ui/base/l10n/l10n_util.h" | 45 #include "ui/base/l10n/l10n_util.h" |
47 | 46 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 136 |
138 const GURL& navigation = navigation_handle->GetURL(); | 137 const GURL& navigation = navigation_handle->GetURL(); |
139 bool expected_main_view_request = | 138 bool expected_main_view_request = |
140 navigation.SchemeIs(expected_scheme_.c_str()) && | 139 navigation.SchemeIs(expected_scheme_.c_str()) && |
141 expected_request_path_ == navigation.query(); | 140 expected_request_path_ == navigation.query(); |
142 if (navigation_handle->IsSamePage() || expected_main_view_request) { | 141 if (navigation_handle->IsSamePage() || expected_main_view_request) { |
143 // In-page navigations, as well as the main view request can be ignored. | 142 // In-page navigations, as well as the main view request can be ignored. |
144 if (expected_main_view_request) { | 143 if (expected_main_view_request) { |
145 content::RenderFrameHost* render_frame_host = | 144 content::RenderFrameHost* render_frame_host = |
146 navigation_handle->GetRenderFrameHost(); | 145 navigation_handle->GetRenderFrameHost(); |
147 content::RenderViewHost* render_view_host = | 146 CHECK_EQ(0, render_frame_host->GetEnabledBindings()); |
148 render_frame_host->GetRenderViewHost(); | |
149 CHECK_EQ(0, render_view_host->GetEnabledBindings()); | |
150 | 147 |
151 // Add mojo service for JavaScript functionality. This is the receiving | 148 // Add mojo service for JavaScript functionality. This is the receiving |
152 // end of this particular service. | 149 // end of this particular service. |
153 render_frame_host->GetInterfaceRegistry()->AddInterface( | 150 render_frame_host->GetInterfaceRegistry()->AddInterface( |
154 base::Bind(&CreateDistillerJavaScriptService, | 151 base::Bind(&CreateDistillerJavaScriptService, |
155 render_frame_host, | 152 render_frame_host, |
156 distiller_ui_handle_)); | 153 distiller_ui_handle_)); |
157 | 154 |
158 // Tell the renderer that this is currently a distilled page. | 155 // Tell the renderer that this is currently a distilled page. |
159 mojom::DistillerPageNotifierServicePtr page_notifier_service; | 156 mojom::DistillerPageNotifierServicePtr page_notifier_service; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 std::string DomDistillerViewerSource::GetContentSecurityPolicyStyleSrc() | 303 std::string DomDistillerViewerSource::GetContentSecurityPolicyStyleSrc() |
307 const { | 304 const { |
308 return "style-src 'self' https://fonts.googleapis.com;"; | 305 return "style-src 'self' https://fonts.googleapis.com;"; |
309 } | 306 } |
310 | 307 |
311 std::string DomDistillerViewerSource::GetContentSecurityPolicyChildSrc() const { | 308 std::string DomDistillerViewerSource::GetContentSecurityPolicyChildSrc() const { |
312 return "child-src *;"; | 309 return "child-src *;"; |
313 } | 310 } |
314 | 311 |
315 } // namespace dom_distiller | 312 } // namespace dom_distiller |
OLD | NEW |