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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } else { | 125 } else { |
126 DCHECK(buffer_.empty()); | 126 DCHECK(buffer_.empty()); |
127 if (web_contents()) { | 127 if (web_contents()) { |
128 RunIsolatedJavaScript(web_contents()->GetMainFrame(), buffer); | 128 RunIsolatedJavaScript(web_contents()->GetMainFrame(), buffer); |
129 } | 129 } |
130 } | 130 } |
131 } | 131 } |
132 | 132 |
133 void DomDistillerViewerSource::RequestViewerHandle::DidFinishNavigation( | 133 void DomDistillerViewerSource::RequestViewerHandle::DidFinishNavigation( |
134 content::NavigationHandle* navigation_handle) { | 134 content::NavigationHandle* navigation_handle) { |
| 135 if (!navigation_handle->IsInMainFrame() || !navigation_handle->HasCommitted()) |
| 136 return; |
| 137 |
135 const GURL& navigation = navigation_handle->GetURL(); | 138 const GURL& navigation = navigation_handle->GetURL(); |
136 bool expected_main_view_request = | 139 bool expected_main_view_request = |
137 navigation.SchemeIs(expected_scheme_.c_str()) && | 140 navigation.SchemeIs(expected_scheme_.c_str()) && |
138 expected_request_path_ == navigation.query(); | 141 expected_request_path_ == navigation.query(); |
139 if (navigation_handle->IsSamePage() || expected_main_view_request) { | 142 if (navigation_handle->IsSamePage() || expected_main_view_request) { |
140 // In-page navigations, as well as the main view request can be ignored. | 143 // In-page navigations, as well as the main view request can be ignored. |
141 if (expected_main_view_request) { | 144 if (expected_main_view_request) { |
142 content::RenderFrameHost* render_frame_host = | 145 content::RenderFrameHost* render_frame_host = |
143 navigation_handle->GetRenderFrameHost(); | 146 navigation_handle->GetRenderFrameHost(); |
144 content::RenderViewHost* render_view_host = | 147 content::RenderViewHost* render_view_host = |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 std::string DomDistillerViewerSource::GetContentSecurityPolicyStyleSrc() | 304 std::string DomDistillerViewerSource::GetContentSecurityPolicyStyleSrc() |
302 const { | 305 const { |
303 return "style-src 'self' https://fonts.googleapis.com;"; | 306 return "style-src 'self' https://fonts.googleapis.com;"; |
304 } | 307 } |
305 | 308 |
306 std::string DomDistillerViewerSource::GetContentSecurityPolicyChildSrc() const { | 309 std::string DomDistillerViewerSource::GetContentSecurityPolicyChildSrc() const { |
307 return "child-src *;"; | 310 return "child-src *;"; |
308 } | 311 } |
309 | 312 |
310 } // namespace dom_distiller | 313 } // namespace dom_distiller |
OLD | NEW |