OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 return item.httpBody().identifier(); | 193 return item.httpBody().identifier(); |
194 } | 194 } |
195 | 195 |
196 WebURLResponseExtraDataImpl* GetExtraDataFromResponse( | 196 WebURLResponseExtraDataImpl* GetExtraDataFromResponse( |
197 const WebURLResponse& response) { | 197 const WebURLResponse& response) { |
198 return static_cast<WebURLResponseExtraDataImpl*>(response.extraData()); | 198 return static_cast<WebURLResponseExtraDataImpl*>(response.extraData()); |
199 } | 199 } |
200 | 200 |
201 void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { | 201 void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { |
202 // Replace any occurrences of swappedout:// with about:blank. | 202 // Replace any occurrences of swappedout:// with about:blank. |
203 const WebURL& blank_url = GURL(kAboutBlankURL); | 203 const WebURL& blank_url = GURL(url::kAboutBlankURL); |
204 WebVector<WebURL> urls; | 204 WebVector<WebURL> urls; |
205 ds->redirectChain(urls); | 205 ds->redirectChain(urls); |
206 result->reserve(urls.size()); | 206 result->reserve(urls.size()); |
207 for (size_t i = 0; i < urls.size(); ++i) { | 207 for (size_t i = 0; i < urls.size(); ++i) { |
208 if (urls[i] != GURL(kSwappedOutURL)) | 208 if (urls[i] != GURL(kSwappedOutURL)) |
209 result->push_back(urls[i]); | 209 result->push_back(urls[i]); |
210 else | 210 else |
211 result->push_back(blank_url); | 211 result->push_back(blank_url); |
212 } | 212 } |
213 } | 213 } |
(...skipping 1821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2035 DomAutomationController::Install(this, frame); | 2035 DomAutomationController::Install(this, frame); |
2036 | 2036 |
2037 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidClearWindowObject()); | 2037 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidClearWindowObject()); |
2038 } | 2038 } |
2039 | 2039 |
2040 void RenderFrameImpl::didCreateDocumentElement(blink::WebLocalFrame* frame) { | 2040 void RenderFrameImpl::didCreateDocumentElement(blink::WebLocalFrame* frame) { |
2041 DCHECK(!frame_ || frame_ == frame); | 2041 DCHECK(!frame_ || frame_ == frame); |
2042 | 2042 |
2043 // Notify the browser about non-blank documents loading in the top frame. | 2043 // Notify the browser about non-blank documents loading in the top frame. |
2044 GURL url = frame->document().url(); | 2044 GURL url = frame->document().url(); |
2045 if (url.is_valid() && url.spec() != kAboutBlankURL) { | 2045 if (url.is_valid() && url.spec() != url::kAboutBlankURL) { |
2046 // TODO(nasko): Check if webview()->mainFrame() is the same as the | 2046 // TODO(nasko): Check if webview()->mainFrame() is the same as the |
2047 // frame->tree()->top(). | 2047 // frame->tree()->top(). |
2048 blink::WebFrame* main_frame = render_view_->webview()->mainFrame(); | 2048 blink::WebFrame* main_frame = render_view_->webview()->mainFrame(); |
2049 if (frame == main_frame) { | 2049 if (frame == main_frame) { |
2050 // For now, don't remember plugin zoom values. We don't want to mix them | 2050 // For now, don't remember plugin zoom values. We don't want to mix them |
2051 // with normal web content (i.e. a fixed layout plugin would usually want | 2051 // with normal web content (i.e. a fixed layout plugin would usually want |
2052 // them different). | 2052 // them different). |
2053 render_view_->Send(new ViewHostMsg_DocumentAvailableInMainFrame( | 2053 render_view_->Send(new ViewHostMsg_DocumentAvailableInMainFrame( |
2054 render_view_->GetRoutingID(), | 2054 render_view_->GetRoutingID(), |
2055 main_frame->document().isPluginDocument())); | 2055 main_frame->document().isPluginDocument())); |
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3258 // about:blank to clear a tab, and we want to still allow that. | 3258 // about:blank to clear a tab, and we want to still allow that. |
3259 // | 3259 // |
3260 // Note: this is known to break POST submissions when crossing process | 3260 // Note: this is known to break POST submissions when crossing process |
3261 // boundaries until http://crbug.com/101395 is fixed. This is better for | 3261 // boundaries until http://crbug.com/101395 is fixed. This is better for |
3262 // security than loading a WebUI, extension or app page in the wrong process. | 3262 // security than loading a WebUI, extension or app page in the wrong process. |
3263 // POST requests don't work because this mechanism does not preserve form | 3263 // POST requests don't work because this mechanism does not preserve form |
3264 // POST data. We will need to send the request's httpBody data up to the | 3264 // POST data. We will need to send the request's httpBody data up to the |
3265 // browser process, and issue a special POST navigation in WebKit (via | 3265 // browser process, and issue a special POST navigation in WebKit (via |
3266 // FrameLoader::loadFrameRequest). See ResourceDispatcher and WebURLLoaderImpl | 3266 // FrameLoader::loadFrameRequest). See ResourceDispatcher and WebURLLoaderImpl |
3267 // for examples of how to send the httpBody data. | 3267 // for examples of how to send the httpBody data. |
3268 if (!frame->parent() && is_content_initiated && !url.SchemeIs(kAboutScheme)) { | 3268 if (!frame->parent() && is_content_initiated && |
| 3269 !url.SchemeIs(url::kAboutScheme)) { |
3269 bool send_referrer = false; | 3270 bool send_referrer = false; |
3270 | 3271 |
3271 // All navigations to or from WebUI URLs or within WebUI-enabled | 3272 // All navigations to or from WebUI URLs or within WebUI-enabled |
3272 // RenderProcesses must be handled by the browser process so that the | 3273 // RenderProcesses must be handled by the browser process so that the |
3273 // correct bindings and data sources can be registered. | 3274 // correct bindings and data sources can be registered. |
3274 // Similarly, navigations to view-source URLs or within ViewSource mode | 3275 // Similarly, navigations to view-source URLs or within ViewSource mode |
3275 // must be handled by the browser process (except for reloads - those are | 3276 // must be handled by the browser process (except for reloads - those are |
3276 // safe to leave within the renderer). | 3277 // safe to leave within the renderer). |
3277 // Lastly, access to file:// URLs from non-file:// URL pages must be | 3278 // Lastly, access to file:// URLs from non-file:// URL pages must be |
3278 // handled by the browser so that ordinary renderer processes don't get | 3279 // handled by the browser so that ordinary renderer processes don't get |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3318 // We use the following heuristic to decide whether to fork a new page in its | 3319 // We use the following heuristic to decide whether to fork a new page in its |
3319 // own process: | 3320 // own process: |
3320 // The parent page must open a new tab to about:blank, set the new tab's | 3321 // The parent page must open a new tab to about:blank, set the new tab's |
3321 // window.opener to null, and then redirect the tab to a cross-site URL using | 3322 // window.opener to null, and then redirect the tab to a cross-site URL using |
3322 // JavaScript. | 3323 // JavaScript. |
3323 // | 3324 // |
3324 // TODO(creis): Deprecate this logic once we can rely on rel=noreferrer | 3325 // TODO(creis): Deprecate this logic once we can rely on rel=noreferrer |
3325 // (see below). | 3326 // (see below). |
3326 bool is_fork = | 3327 bool is_fork = |
3327 // Must start from a tab showing about:blank, which is later redirected. | 3328 // Must start from a tab showing about:blank, which is later redirected. |
3328 old_url == GURL(kAboutBlankURL) && | 3329 old_url == GURL(url::kAboutBlankURL) && |
3329 // Must be the first real navigation of the tab. | 3330 // Must be the first real navigation of the tab. |
3330 render_view_->historyBackListCount() < 1 && | 3331 render_view_->historyBackListCount() < 1 && |
3331 render_view_->historyForwardListCount() < 1 && | 3332 render_view_->historyForwardListCount() < 1 && |
3332 // The parent page must have set the child's window.opener to null before | 3333 // The parent page must have set the child's window.opener to null before |
3333 // redirecting to the desired URL. | 3334 // redirecting to the desired URL. |
3334 frame->opener() == NULL && | 3335 frame->opener() == NULL && |
3335 // Must be a top-level frame. | 3336 // Must be a top-level frame. |
3336 frame->parent() == NULL && | 3337 frame->parent() == NULL && |
3337 // Must not have issued the request from this page. | 3338 // Must not have issued the request from this page. |
3338 is_content_initiated && | 3339 is_content_initiated && |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3572 | 3573 |
3573 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 3574 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
3574 if (!cdm_manager_) | 3575 if (!cdm_manager_) |
3575 cdm_manager_ = new RendererCdmManager(this); | 3576 cdm_manager_ = new RendererCdmManager(this); |
3576 return cdm_manager_; | 3577 return cdm_manager_; |
3577 } | 3578 } |
3578 | 3579 |
3579 #endif // defined(OS_ANDROID) | 3580 #endif // defined(OS_ANDROID) |
3580 | 3581 |
3581 } // namespace content | 3582 } // namespace content |
OLD | NEW |