Chromium Code Reviews| 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 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 737 if (entry) { | 737 if (entry) { |
| 738 return entry->GetTitleForDisplay(accept_languages); | 738 return entry->GetTitleForDisplay(accept_languages); |
| 739 } | 739 } |
| 740 WebUI* our_web_ui = GetRenderManager()->pending_web_ui() ? | 740 WebUI* our_web_ui = GetRenderManager()->pending_web_ui() ? |
| 741 GetRenderManager()->pending_web_ui() : GetRenderManager()->web_ui(); | 741 GetRenderManager()->pending_web_ui() : GetRenderManager()->web_ui(); |
| 742 if (our_web_ui) { | 742 if (our_web_ui) { |
| 743 // Don't override the title in view source mode. | 743 // Don't override the title in view source mode. |
| 744 entry = controller_.GetVisibleEntry(); | 744 entry = controller_.GetVisibleEntry(); |
| 745 if (!(entry && entry->IsViewSourceMode())) { | 745 if (!(entry && entry->IsViewSourceMode())) { |
| 746 // Give the Web UI the chance to override our title. | 746 // Give the Web UI the chance to override our title. |
| 747 const string16& title = our_web_ui->GetOverriddenTitle(); | 747 const string16& title = our_web_ui->GetOverriddenTitle(); |
|
Charlie Reis
2013/11/22 01:47:45
Shouldn't we be using the WebUI's overridden title
samarth
2013/11/22 17:25:54
With 1993, the NTP is no longer a WebUI, which is
Charlie Reis
2013/11/22 19:03:01
Actually, I'm a also bit confused about this. How
samarth
2013/11/22 20:03:19
This is done by loading the NTP in the "Instant Pr
Charlie Reis
2013/11/22 20:33:47
Makes sense. Thanks for elaborating.
| |
| 748 if (!title.empty()) | 748 if (!title.empty()) |
| 749 return title; | 749 return title; |
| 750 } | 750 } |
| 751 } | 751 } |
| 752 | 752 |
| 753 // We use the title for the last committed entry rather than a pending | 753 // We use the title for the last committed entry rather than a pending |
| 754 // navigation entry. For example, when the user types in a URL, we want to | 754 // navigation entry. For example, when the user types in a URL, we want to |
| 755 // keep the old page's title until the new load has committed and we get a new | 755 // keep the old page's title until the new load has committed and we get a new |
| 756 // title. | 756 // title. |
| 757 entry = controller_.GetLastCommittedEntry(); | 757 entry = controller_.GetLastCommittedEntry(); |
| 758 | 758 |
| 759 // We make an exception for initial navigations, because we can have a | 759 // We make an exception for initial navigations, because there is no committed |
|
Charlie Reis
2013/11/22 01:47:45
This comment isn't correct: there may or may not b
samarth
2013/11/22 17:25:54
Can you suggest a better wording? This code is ver
Charlie Reis
2013/11/22 18:54:18
Sure, but I don't think we've established that thi
| |
| 760 // committed entry for an initial navigation when doing a history navigation | 760 // entry at this point. |
| 761 // in a new tab, such as Ctrl+Back. | 761 if (controller_.IsInitialNavigation()) |
|
Charlie Reis
2013/11/22 01:47:45
I don't immediately see a security concern with re
Charlie Reis
2013/11/22 18:54:18
Ok, so GetOverriddenTitle doesn't work. Still, th
samarth
2013/11/22 20:03:19
I tested this by ctrl-clicking on a link for http:
Charlie Reis
2013/11/22 20:33:47
Ok, thanks for trying it out. Let's try checking
samarth
2013/11/22 21:54:41
Done.
| |
| 762 if (entry && controller_.IsInitialNavigation()) | |
| 763 entry = controller_.GetVisibleEntry(); | 762 entry = controller_.GetVisibleEntry(); |
| 764 | 763 |
| 765 if (entry) { | 764 if (entry) |
| 766 return entry->GetTitleForDisplay(accept_languages); | 765 return entry->GetTitleForDisplay(accept_languages); |
| 767 } | |
| 768 | 766 |
| 769 // |page_title_when_no_navigation_entry_| is finally used | 767 // |page_title_when_no_navigation_entry_| is finally used |
| 770 // if no title cannot be retrieved. | 768 // if no title cannot be retrieved. |
| 771 return page_title_when_no_navigation_entry_; | 769 return page_title_when_no_navigation_entry_; |
| 772 } | 770 } |
| 773 | 771 |
| 774 int32 WebContentsImpl::GetMaxPageID() { | 772 int32 WebContentsImpl::GetMaxPageID() { |
| 775 return GetMaxPageIDForSiteInstance(GetSiteInstance()); | 773 return GetMaxPageIDForSiteInstance(GetSiteInstance()); |
| 776 } | 774 } |
| 777 | 775 |
| (...skipping 2904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3682 } | 3680 } |
| 3683 | 3681 |
| 3684 void WebContentsImpl::OnFrameRemoved( | 3682 void WebContentsImpl::OnFrameRemoved( |
| 3685 RenderViewHostImpl* render_view_host, | 3683 RenderViewHostImpl* render_view_host, |
| 3686 int64 frame_id) { | 3684 int64 frame_id) { |
| 3687 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3685 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 3688 FrameDetached(render_view_host, frame_id)); | 3686 FrameDetached(render_view_host, frame_id)); |
| 3689 } | 3687 } |
| 3690 | 3688 |
| 3691 } // namespace content | 3689 } // namespace content |
| OLD | NEW |