| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 TRACE_EVENT0("browser", "WebContentsImpl::NavigateToEntry"); | 1605 TRACE_EVENT0("browser", "WebContentsImpl::NavigateToEntry"); |
| 1606 | 1606 |
| 1607 // The renderer will reject IPC messages with URLs longer than | 1607 // The renderer will reject IPC messages with URLs longer than |
| 1608 // this limit, so don't attempt to navigate with a longer URL. | 1608 // this limit, so don't attempt to navigate with a longer URL. |
| 1609 if (entry.GetURL().spec().size() > kMaxURLChars) { | 1609 if (entry.GetURL().spec().size() > kMaxURLChars) { |
| 1610 LOG(WARNING) << "Refusing to load URL as it exceeds " << kMaxURLChars | 1610 LOG(WARNING) << "Refusing to load URL as it exceeds " << kMaxURLChars |
| 1611 << " characters."; | 1611 << " characters."; |
| 1612 return false; | 1612 return false; |
| 1613 } | 1613 } |
| 1614 | 1614 |
| 1615 // TODO(creis): Use entry->frame_tree_node_id() to pick which |
| 1616 // RenderViewHostManager to use. |
| 1615 RenderViewHostImpl* dest_render_view_host = | 1617 RenderViewHostImpl* dest_render_view_host = |
| 1616 static_cast<RenderViewHostImpl*>(GetRenderManager()->Navigate(entry)); | 1618 static_cast<RenderViewHostImpl*>(GetRenderManager()->Navigate(entry)); |
| 1617 if (!dest_render_view_host) | 1619 if (!dest_render_view_host) |
| 1618 return false; // Unable to create the desired render view host. | 1620 return false; // Unable to create the desired render view host. |
| 1619 | 1621 |
| 1620 // For security, we should never send non-Web-UI URLs to a Web UI renderer. | 1622 // For security, we should never send non-Web-UI URLs to a Web UI renderer. |
| 1621 // Double check that here. | 1623 // Double check that here. |
| 1622 int enabled_bindings = dest_render_view_host->GetEnabledBindings(); | 1624 int enabled_bindings = dest_render_view_host->GetEnabledBindings(); |
| 1623 bool data_urls_allowed = delegate_ && delegate_->CanLoadDataURLsInWebUI(); | 1625 bool data_urls_allowed = delegate_ && delegate_->CanLoadDataURLsInWebUI(); |
| 1624 bool is_allowed_in_web_ui_renderer = | 1626 bool is_allowed_in_web_ui_renderer = |
| (...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3134 int64 source_frame_id, | 3136 int64 source_frame_id, |
| 3135 const GlobalRequestID& old_request_id, | 3137 const GlobalRequestID& old_request_id, |
| 3136 bool should_replace_current_entry, | 3138 bool should_replace_current_entry, |
| 3137 bool user_gesture) { | 3139 bool user_gesture) { |
| 3138 WebContents* new_contents = NULL; | 3140 WebContents* new_contents = NULL; |
| 3139 GURL dest_url(url); | 3141 GURL dest_url(url); |
| 3140 if (!GetContentClient()->browser()->ShouldAllowOpenURL( | 3142 if (!GetContentClient()->browser()->ShouldAllowOpenURL( |
| 3141 GetSiteInstance(), url)) | 3143 GetSiteInstance(), url)) |
| 3142 dest_url = GURL(kAboutBlankURL); | 3144 dest_url = GURL(kAboutBlankURL); |
| 3143 | 3145 |
| 3144 OpenURLParams params(dest_url, referrer, source_frame_id, disposition, | 3146 // TODO(creis): Look up the FrameTreeNode ID corresponding to source_frame_id. |
| 3147 int frame_tree_node_id = -1; |
| 3148 OpenURLParams params(dest_url, referrer, source_frame_id, |
| 3149 frame_tree_node_id, disposition, |
| 3145 page_transition, true /* is_renderer_initiated */); | 3150 page_transition, true /* is_renderer_initiated */); |
| 3146 if (redirect_chain.size() > 0) | 3151 if (redirect_chain.size() > 0) |
| 3147 params.redirect_chain = redirect_chain; | 3152 params.redirect_chain = redirect_chain; |
| 3148 params.transferred_global_request_id = old_request_id; | 3153 params.transferred_global_request_id = old_request_id; |
| 3149 params.should_replace_current_entry = should_replace_current_entry; | 3154 params.should_replace_current_entry = should_replace_current_entry; |
| 3150 params.user_gesture = user_gesture; | 3155 params.user_gesture = user_gesture; |
| 3151 | 3156 |
| 3152 if (GetRenderManager()->web_ui()) { | 3157 if (GetRenderManager()->web_ui()) { |
| 3153 // Web UI pages sometimes want to override the page transition type for | 3158 // Web UI pages sometimes want to override the page transition type for |
| 3154 // link clicks (e.g., so the new tab page can specify AUTO_BOOKMARK for | 3159 // link clicks (e.g., so the new tab page can specify AUTO_BOOKMARK for |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3677 } | 3682 } |
| 3678 | 3683 |
| 3679 void WebContentsImpl::OnFrameRemoved( | 3684 void WebContentsImpl::OnFrameRemoved( |
| 3680 RenderViewHostImpl* render_view_host, | 3685 RenderViewHostImpl* render_view_host, |
| 3681 int64 frame_id) { | 3686 int64 frame_id) { |
| 3682 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3687 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 3683 FrameDetached(render_view_host, frame_id)); | 3688 FrameDetached(render_view_host, frame_id)); |
| 3684 } | 3689 } |
| 3685 | 3690 |
| 3686 } // namespace content | 3691 } // namespace content |
| OLD | NEW |