| 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/browser/frame_host/navigator_impl.h" | 5 #include "content/browser/frame_host/navigator_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "content/browser/frame_host/frame_tree.h" | 9 #include "content/browser/frame_host/frame_tree.h" |
| 10 #include "content/browser/frame_host/frame_tree_node.h" | 10 #include "content/browser/frame_host/frame_tree_node.h" |
| 11 #include "content/browser/frame_host/navigation_before_commit_info.h" | |
| 12 #include "content/browser/frame_host/navigation_controller_impl.h" | 11 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 13 #include "content/browser/frame_host/navigation_entry_impl.h" | 12 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 14 #include "content/browser/frame_host/navigator_delegate.h" | 13 #include "content/browser/frame_host/navigator_delegate.h" |
| 15 #include "content/browser/frame_host/render_frame_host_impl.h" | 14 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 16 #include "content/browser/renderer_host/render_view_host_impl.h" | 15 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 17 #include "content/browser/site_instance_impl.h" | 16 #include "content/browser/site_instance_impl.h" |
| 18 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 17 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
| 19 #include "content/browser/webui/web_ui_impl.h" | 18 #include "content/browser/webui/web_ui_impl.h" |
| 20 #include "content/common/frame_messages.h" | 19 #include "content/common/frame_messages.h" |
| 21 #include "content/common/view_messages.h" | 20 #include "content/common/view_messages.h" |
| 22 #include "content/public/browser/browser_context.h" | 21 #include "content/public/browser/browser_context.h" |
| 23 #include "content/public/browser/content_browser_client.h" | 22 #include "content/public/browser/content_browser_client.h" |
| 24 #include "content/public/browser/global_request_id.h" | 23 #include "content/public/browser/global_request_id.h" |
| 25 #include "content/public/browser/invalidate_type.h" | 24 #include "content/public/browser/invalidate_type.h" |
| 26 #include "content/public/browser/navigation_controller.h" | 25 #include "content/public/browser/navigation_controller.h" |
| 27 #include "content/public/browser/navigation_details.h" | 26 #include "content/public/browser/navigation_details.h" |
| 28 #include "content/public/browser/page_navigator.h" | 27 #include "content/public/browser/page_navigator.h" |
| 29 #include "content/public/browser/render_view_host.h" | 28 #include "content/public/browser/render_view_host.h" |
| 29 #include "content/public/browser/stream_handle.h" |
| 30 #include "content/public/common/bindings_policy.h" | 30 #include "content/public/common/bindings_policy.h" |
| 31 #include "content/public/common/content_client.h" | 31 #include "content/public/common/content_client.h" |
| 32 #include "content/public/common/content_switches.h" | 32 #include "content/public/common/content_switches.h" |
| 33 #include "content/public/common/url_constants.h" | 33 #include "content/public/common/url_constants.h" |
| 34 #include "content/public/common/url_utils.h" | 34 #include "content/public/common/url_utils.h" |
| 35 | 35 |
| 36 namespace content { | 36 namespace content { |
| 37 | 37 |
| 38 namespace { | 38 namespace { |
| 39 | 39 |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 params.referrer = Referrer(); | 655 params.referrer = Referrer(); |
| 656 | 656 |
| 657 // Navigations in Web UI pages count as browser-initiated navigations. | 657 // Navigations in Web UI pages count as browser-initiated navigations. |
| 658 params.is_renderer_initiated = false; | 658 params.is_renderer_initiated = false; |
| 659 } | 659 } |
| 660 | 660 |
| 661 if (delegate_) | 661 if (delegate_) |
| 662 delegate_->RequestOpenURL(render_frame_host, params); | 662 delegate_->RequestOpenURL(render_frame_host, params); |
| 663 } | 663 } |
| 664 | 664 |
| 665 void NavigatorImpl::CommitNavigation( | 665 void NavigatorImpl::CommitNavigation(RenderFrameHostImpl* render_frame_host, |
| 666 RenderFrameHostImpl* render_frame_host, | 666 const GURL& url, |
| 667 const NavigationBeforeCommitInfo& info) { | 667 ResourceResponse* response, |
| 668 CheckWebUIRendererDoesNotDisplayNormalURL( | 668 scoped_ptr<StreamHandle> body) { |
| 669 render_frame_host, info.navigation_url); | 669 CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host, url); |
| 670 // TODO(clamy): the render_frame_host should now send a commit IPC to the | 670 // TODO(clamy): the render_frame_host should now send a commit IPC to the |
| 671 // renderer. | 671 // renderer. |
| 672 NOTIMPLEMENTED(); |
| 672 } | 673 } |
| 673 | 674 |
| 674 void NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL( | 675 void NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL( |
| 675 RenderFrameHostImpl* render_frame_host, | 676 RenderFrameHostImpl* render_frame_host, |
| 676 const GURL& url) { | 677 const GURL& url) { |
| 677 int enabled_bindings = | 678 int enabled_bindings = |
| 678 render_frame_host->render_view_host()->GetEnabledBindings(); | 679 render_frame_host->render_view_host()->GetEnabledBindings(); |
| 679 bool is_allowed_in_web_ui_renderer = | 680 bool is_allowed_in_web_ui_renderer = |
| 680 WebUIControllerFactoryRegistry::GetInstance()->IsURLAcceptableForWebUI( | 681 WebUIControllerFactoryRegistry::GetInstance()->IsURLAcceptableForWebUI( |
| 681 controller_->GetBrowserContext(), url); | 682 controller_->GetBrowserContext(), url); |
| 682 if ((enabled_bindings & BINDINGS_POLICY_WEB_UI) && | 683 if ((enabled_bindings & BINDINGS_POLICY_WEB_UI) && |
| 683 !is_allowed_in_web_ui_renderer) { | 684 !is_allowed_in_web_ui_renderer) { |
| 684 // Log the URL to help us diagnose any future failures of this CHECK. | 685 // Log the URL to help us diagnose any future failures of this CHECK. |
| 685 GetContentClient()->SetActiveURL(url); | 686 GetContentClient()->SetActiveURL(url); |
| 686 CHECK(0); | 687 CHECK(0); |
| 687 } | 688 } |
| 688 } | 689 } |
| 689 | 690 |
| 690 } // namespace content | 691 } // namespace content |
| OLD | NEW |