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/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
848 // same site instance. | 848 // same site instance. |
849 GetMainFrame()->RequestAXTreeSnapshot(callback); | 849 GetMainFrame()->RequestAXTreeSnapshot(callback); |
850 } | 850 } |
851 | 851 |
852 WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url, | 852 WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url, |
853 const std::string& frame_name) { | 853 const std::string& frame_name) { |
854 DCHECK(!frame_name.empty()); | 854 DCHECK(!frame_name.empty()); |
855 return CreateWebUI(url, frame_name); | 855 return CreateWebUI(url, frame_name); |
856 } | 856 } |
857 | 857 |
858 WebUI* WebContentsImpl::GetWebUI() const { | 858 WebUI* WebContentsImpl::GetWebUI() const { |
carlosk
2015/10/30 18:55:44
I kept the implementation of GetWebUI() working th
| |
859 return GetRenderManager()->web_ui() | 859 if (GetCommittedWebUI()) |
860 ? GetRenderManager()->web_ui() | 860 return GetCommittedWebUI(); |
861 : GetRenderManager()->GetNavigatingWebUI(); | 861 if (GetRenderManager()->pending_frame_host()) |
862 return GetRenderManager()->pending_frame_host()->web_ui(); | |
863 return nullptr; | |
862 } | 864 } |
863 | 865 |
864 WebUI* WebContentsImpl::GetCommittedWebUI() const { | 866 WebUI* WebContentsImpl::GetCommittedWebUI() const { |
865 return GetRenderManager()->web_ui(); | 867 return frame_tree_.root()->current_frame_host()->web_ui(); |
866 } | 868 } |
867 | 869 |
868 void WebContentsImpl::SetUserAgentOverride(const std::string& override) { | 870 void WebContentsImpl::SetUserAgentOverride(const std::string& override) { |
869 if (GetUserAgentOverride() == override) | 871 if (GetUserAgentOverride() == override) |
870 return; | 872 return; |
871 | 873 |
872 renderer_preferences_.user_agent_override = override; | 874 renderer_preferences_.user_agent_override = override; |
873 | 875 |
874 // Send the new override string to the renderer. | 876 // Send the new override string to the renderer. |
875 RenderViewHost* host = GetRenderViewHost(); | 877 RenderViewHost* host = GetRenderViewHost(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
922 const base::string16& WebContentsImpl::GetTitle() const { | 924 const base::string16& WebContentsImpl::GetTitle() const { |
923 // Transient entries take precedence. They are used for interstitial pages | 925 // Transient entries take precedence. They are used for interstitial pages |
924 // that are shown on top of existing pages. | 926 // that are shown on top of existing pages. |
925 NavigationEntry* entry = controller_.GetTransientEntry(); | 927 NavigationEntry* entry = controller_.GetTransientEntry(); |
926 std::string accept_languages = | 928 std::string accept_languages = |
927 GetContentClient()->browser()->GetAcceptLangs( | 929 GetContentClient()->browser()->GetAcceptLangs( |
928 GetBrowserContext()); | 930 GetBrowserContext()); |
929 if (entry) { | 931 if (entry) { |
930 return entry->GetTitleForDisplay(accept_languages); | 932 return entry->GetTitleForDisplay(accept_languages); |
931 } | 933 } |
932 WebUI* our_web_ui = GetRenderManager()->GetNavigatingWebUI() | 934 WebUI* our_web_ui = GetRenderManager()->pending_frame_host() |
933 ? GetRenderManager()->GetNavigatingWebUI() | 935 ? GetRenderManager()->pending_frame_host()->web_ui() |
934 : GetRenderManager()->web_ui(); | 936 : frame_tree_.root()->current_frame_host()->web_ui(); |
935 if (our_web_ui) { | 937 if (our_web_ui) { |
936 // Don't override the title in view source mode. | 938 // Don't override the title in view source mode. |
937 entry = controller_.GetVisibleEntry(); | 939 entry = controller_.GetVisibleEntry(); |
938 if (!(entry && entry->IsViewSourceMode())) { | 940 if (!(entry && entry->IsViewSourceMode())) { |
939 // Give the Web UI the chance to override our title. | 941 // Give the Web UI the chance to override our title. |
940 const base::string16& title = our_web_ui->GetOverriddenTitle(); | 942 const base::string16& title = our_web_ui->GetOverriddenTitle(); |
941 if (!title.empty()) | 943 if (!title.empty()) |
942 return title; | 944 return title; |
943 } | 945 } |
944 } | 946 } |
(...skipping 3724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4669 return NULL; | 4671 return NULL; |
4670 } | 4672 } |
4671 | 4673 |
4672 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4674 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4673 force_disable_overscroll_content_ = force_disable; | 4675 force_disable_overscroll_content_ = force_disable; |
4674 if (view_) | 4676 if (view_) |
4675 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4677 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4676 } | 4678 } |
4677 | 4679 |
4678 } // namespace content | 4680 } // namespace content |
OLD | NEW |