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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 return item.httpBody().identifier(); | 188 return item.httpBody().identifier(); |
189 } | 189 } |
190 | 190 |
191 WebURLResponseExtraDataImpl* GetExtraDataFromResponse( | 191 WebURLResponseExtraDataImpl* GetExtraDataFromResponse( |
192 const WebURLResponse& response) { | 192 const WebURLResponse& response) { |
193 return static_cast<WebURLResponseExtraDataImpl*>(response.extraData()); | 193 return static_cast<WebURLResponseExtraDataImpl*>(response.extraData()); |
194 } | 194 } |
195 | 195 |
196 void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { | 196 void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { |
197 // Replace any occurrences of swappedout:// with about:blank. | 197 // Replace any occurrences of swappedout:// with about:blank. |
198 const WebURL& blank_url = GURL(kAboutBlankURL); | 198 const WebURL& blank_url = GURL(url::kAboutBlankURL); |
199 WebVector<WebURL> urls; | 199 WebVector<WebURL> urls; |
200 ds->redirectChain(urls); | 200 ds->redirectChain(urls); |
201 result->reserve(urls.size()); | 201 result->reserve(urls.size()); |
202 for (size_t i = 0; i < urls.size(); ++i) { | 202 for (size_t i = 0; i < urls.size(); ++i) { |
203 if (urls[i] != GURL(kSwappedOutURL)) | 203 if (urls[i] != GURL(kSwappedOutURL)) |
204 result->push_back(urls[i]); | 204 result->push_back(urls[i]); |
205 else | 205 else |
206 result->push_back(blank_url); | 206 result->push_back(blank_url); |
207 } | 207 } |
208 } | 208 } |
(...skipping 1821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2030 DomAutomationController::Install(this, frame); | 2030 DomAutomationController::Install(this, frame); |
2031 | 2031 |
2032 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidClearWindowObject()); | 2032 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidClearWindowObject()); |
2033 } | 2033 } |
2034 | 2034 |
2035 void RenderFrameImpl::didCreateDocumentElement(blink::WebLocalFrame* frame) { | 2035 void RenderFrameImpl::didCreateDocumentElement(blink::WebLocalFrame* frame) { |
2036 DCHECK(!frame_ || frame_ == frame); | 2036 DCHECK(!frame_ || frame_ == frame); |
2037 | 2037 |
2038 // Notify the browser about non-blank documents loading in the top frame. | 2038 // Notify the browser about non-blank documents loading in the top frame. |
2039 GURL url = frame->document().url(); | 2039 GURL url = frame->document().url(); |
2040 if (url.is_valid() && url.spec() != kAboutBlankURL) { | 2040 if (url.is_valid() && url.spec() != url::kAboutBlankURL) { |
2041 // TODO(nasko): Check if webview()->mainFrame() is the same as the | 2041 // TODO(nasko): Check if webview()->mainFrame() is the same as the |
2042 // frame->tree()->top(). | 2042 // frame->tree()->top(). |
2043 blink::WebFrame* main_frame = render_view_->webview()->mainFrame(); | 2043 blink::WebFrame* main_frame = render_view_->webview()->mainFrame(); |
2044 if (frame == main_frame) { | 2044 if (frame == main_frame) { |
2045 // For now, don't remember plugin zoom values. We don't want to mix them | 2045 // For now, don't remember plugin zoom values. We don't want to mix them |
2046 // with normal web content (i.e. a fixed layout plugin would usually want | 2046 // with normal web content (i.e. a fixed layout plugin would usually want |
2047 // them different). | 2047 // them different). |
2048 render_view_->Send(new ViewHostMsg_DocumentAvailableInMainFrame( | 2048 render_view_->Send(new ViewHostMsg_DocumentAvailableInMainFrame( |
2049 render_view_->GetRoutingID(), | 2049 render_view_->GetRoutingID(), |
2050 main_frame->document().isPluginDocument())); | 2050 main_frame->document().isPluginDocument())); |
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3229 // about:blank to clear a tab, and we want to still allow that. | 3229 // about:blank to clear a tab, and we want to still allow that. |
3230 // | 3230 // |
3231 // Note: this is known to break POST submissions when crossing process | 3231 // Note: this is known to break POST submissions when crossing process |
3232 // boundaries until http://crbug.com/101395 is fixed. This is better for | 3232 // boundaries until http://crbug.com/101395 is fixed. This is better for |
3233 // security than loading a WebUI, extension or app page in the wrong process. | 3233 // security than loading a WebUI, extension or app page in the wrong process. |
3234 // POST requests don't work because this mechanism does not preserve form | 3234 // POST requests don't work because this mechanism does not preserve form |
3235 // POST data. We will need to send the request's httpBody data up to the | 3235 // POST data. We will need to send the request's httpBody data up to the |
3236 // browser process, and issue a special POST navigation in WebKit (via | 3236 // browser process, and issue a special POST navigation in WebKit (via |
3237 // FrameLoader::loadFrameRequest). See ResourceDispatcher and WebURLLoaderImpl | 3237 // FrameLoader::loadFrameRequest). See ResourceDispatcher and WebURLLoaderImpl |
3238 // for examples of how to send the httpBody data. | 3238 // for examples of how to send the httpBody data. |
3239 if (!frame->parent() && is_content_initiated && !url.SchemeIs(kAboutScheme)) { | 3239 if (!frame->parent() && is_content_initiated && !url.SchemeIs(url::kAboutSchem e)) { |
jam
2014/06/06 19:39:23
nit: 80 chars
blundell
2014/06/08 18:47:22
Done.
| |
3240 bool send_referrer = false; | 3240 bool send_referrer = false; |
3241 | 3241 |
3242 // All navigations to or from WebUI URLs or within WebUI-enabled | 3242 // All navigations to or from WebUI URLs or within WebUI-enabled |
3243 // RenderProcesses must be handled by the browser process so that the | 3243 // RenderProcesses must be handled by the browser process so that the |
3244 // correct bindings and data sources can be registered. | 3244 // correct bindings and data sources can be registered. |
3245 // Similarly, navigations to view-source URLs or within ViewSource mode | 3245 // Similarly, navigations to view-source URLs or within ViewSource mode |
3246 // must be handled by the browser process (except for reloads - those are | 3246 // must be handled by the browser process (except for reloads - those are |
3247 // safe to leave within the renderer). | 3247 // safe to leave within the renderer). |
3248 // Lastly, access to file:// URLs from non-file:// URL pages must be | 3248 // Lastly, access to file:// URLs from non-file:// URL pages must be |
3249 // handled by the browser so that ordinary renderer processes don't get | 3249 // 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... | |
3289 // We use the following heuristic to decide whether to fork a new page in its | 3289 // We use the following heuristic to decide whether to fork a new page in its |
3290 // own process: | 3290 // own process: |
3291 // The parent page must open a new tab to about:blank, set the new tab's | 3291 // The parent page must open a new tab to about:blank, set the new tab's |
3292 // window.opener to null, and then redirect the tab to a cross-site URL using | 3292 // window.opener to null, and then redirect the tab to a cross-site URL using |
3293 // JavaScript. | 3293 // JavaScript. |
3294 // | 3294 // |
3295 // TODO(creis): Deprecate this logic once we can rely on rel=noreferrer | 3295 // TODO(creis): Deprecate this logic once we can rely on rel=noreferrer |
3296 // (see below). | 3296 // (see below). |
3297 bool is_fork = | 3297 bool is_fork = |
3298 // Must start from a tab showing about:blank, which is later redirected. | 3298 // Must start from a tab showing about:blank, which is later redirected. |
3299 old_url == GURL(kAboutBlankURL) && | 3299 old_url == GURL(url::kAboutBlankURL) && |
3300 // Must be the first real navigation of the tab. | 3300 // Must be the first real navigation of the tab. |
3301 render_view_->historyBackListCount() < 1 && | 3301 render_view_->historyBackListCount() < 1 && |
3302 render_view_->historyForwardListCount() < 1 && | 3302 render_view_->historyForwardListCount() < 1 && |
3303 // The parent page must have set the child's window.opener to null before | 3303 // The parent page must have set the child's window.opener to null before |
3304 // redirecting to the desired URL. | 3304 // redirecting to the desired URL. |
3305 frame->opener() == NULL && | 3305 frame->opener() == NULL && |
3306 // Must be a top-level frame. | 3306 // Must be a top-level frame. |
3307 frame->parent() == NULL && | 3307 frame->parent() == NULL && |
3308 // Must not have issued the request from this page. | 3308 // Must not have issued the request from this page. |
3309 is_content_initiated && | 3309 is_content_initiated && |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3543 | 3543 |
3544 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 3544 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
3545 if (!cdm_manager_) | 3545 if (!cdm_manager_) |
3546 cdm_manager_ = new RendererCdmManager(this); | 3546 cdm_manager_ = new RendererCdmManager(this); |
3547 return cdm_manager_; | 3547 return cdm_manager_; |
3548 } | 3548 } |
3549 | 3549 |
3550 #endif // defined(OS_ANDROID) | 3550 #endif // defined(OS_ANDROID) |
3551 | 3551 |
3552 } // namespace content | 3552 } // namespace content |
OLD | NEW |