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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 void DomDistillerViewerSource::RequestViewerHandle::DidFinishNavigation( | 132 void DomDistillerViewerSource::RequestViewerHandle::DidFinishNavigation( |
133 content::NavigationHandle* navigation_handle) { | 133 content::NavigationHandle* navigation_handle) { |
134 if (!navigation_handle->IsInMainFrame() || !navigation_handle->HasCommitted()) | 134 if (!navigation_handle->IsInMainFrame() || !navigation_handle->HasCommitted()) |
135 return; | 135 return; |
136 | 136 |
137 const GURL& navigation = navigation_handle->GetURL(); | 137 const GURL& navigation = navigation_handle->GetURL(); |
138 bool expected_main_view_request = | 138 bool expected_main_view_request = |
139 navigation.SchemeIs(expected_scheme_.c_str()) && | 139 navigation.SchemeIs(expected_scheme_.c_str()) && |
140 expected_request_path_ == navigation.query(); | 140 expected_request_path_ == navigation.query(); |
141 if (navigation_handle->IsSamePage() || expected_main_view_request) { | 141 if (navigation_handle->IsSameDocument() || expected_main_view_request) { |
142 // 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. |
143 if (expected_main_view_request) { | 143 if (expected_main_view_request) { |
144 content::RenderFrameHost* render_frame_host = | 144 content::RenderFrameHost* render_frame_host = |
145 navigation_handle->GetRenderFrameHost(); | 145 navigation_handle->GetRenderFrameHost(); |
146 CHECK_EQ(0, render_frame_host->GetEnabledBindings()); | 146 CHECK_EQ(0, render_frame_host->GetEnabledBindings()); |
147 | 147 |
148 // Add mojo service for JavaScript functionality. This is the receiving | 148 // Add mojo service for JavaScript functionality. This is the receiving |
149 // end of this particular service. | 149 // end of this particular service. |
150 render_frame_host->GetInterfaceRegistry()->AddInterface( | 150 render_frame_host->GetInterfaceRegistry()->AddInterface( |
151 base::Bind(&CreateDistillerJavaScriptService, | 151 base::Bind(&CreateDistillerJavaScriptService, |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 std::string DomDistillerViewerSource::GetContentSecurityPolicyStyleSrc() | 303 std::string DomDistillerViewerSource::GetContentSecurityPolicyStyleSrc() |
304 const { | 304 const { |
305 return "style-src 'self' https://fonts.googleapis.com;"; | 305 return "style-src 'self' https://fonts.googleapis.com;"; |
306 } | 306 } |
307 | 307 |
308 std::string DomDistillerViewerSource::GetContentSecurityPolicyChildSrc() const { | 308 std::string DomDistillerViewerSource::GetContentSecurityPolicyChildSrc() const { |
309 return "child-src *;"; | 309 return "child-src *;"; |
310 } | 310 } |
311 | 311 |
312 } // namespace dom_distiller | 312 } // namespace dom_distiller |
OLD | NEW |