Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(587)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 78443005: New Tab: fix tab title flickering. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up change. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
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();
748 if (!title.empty()) 748 if (!title.empty())
749 return title; 749 return title;
750 } 750 }
751 } 751 }
752 752
753 // For initial navigations, use the title from the initial pending entry if it
754 // has a title set. This can happen, for example, when doing a history
755 // navigation in a new tab, such as Ctrl+Back.
756 entry = controller_.GetVisibleEntry();
757 if (entry && controller_.IsInitialNavigation()) {
758 const string16& title = entry->GetTitleForDisplay(accept_languages);
Charlie Reis 2013/11/22 23:19:12 This isn't quite right. GetTitleForDisplay will r
samarth 2013/11/25 15:32:13 Done, thanks.
759 if (!title.empty())
760 return title;
761 }
762
753 // We use the title for the last committed entry rather than a pending 763 // 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 764 // 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 765 // keep the old page's title until the new load has committed and we get a new
756 // title. 766 // title.
757 entry = controller_.GetLastCommittedEntry(); 767 entry = controller_.GetLastCommittedEntry();
758 768
759 // We make an exception for initial navigations, because we can have a
760 // committed entry for an initial navigation when doing a history navigation
761 // in a new tab, such as Ctrl+Back.
762 if (entry && controller_.IsInitialNavigation())
763 entry = controller_.GetVisibleEntry();
764
765 if (entry) { 769 if (entry) {
766 return entry->GetTitleForDisplay(accept_languages); 770 return entry->GetTitleForDisplay(accept_languages);
767 } 771 }
768 772
769 // |page_title_when_no_navigation_entry_| is finally used 773 // |page_title_when_no_navigation_entry_| is finally used
770 // if no title cannot be retrieved. 774 // if no title cannot be retrieved.
771 return page_title_when_no_navigation_entry_; 775 return page_title_when_no_navigation_entry_;
772 } 776 }
773 777
774 int32 WebContentsImpl::GetMaxPageID() { 778 int32 WebContentsImpl::GetMaxPageID() {
(...skipping 2907 matching lines...) Expand 10 before | Expand all | Expand 10 after
3682 } 3686 }
3683 3687
3684 void WebContentsImpl::OnFrameRemoved( 3688 void WebContentsImpl::OnFrameRemoved(
3685 RenderViewHostImpl* render_view_host, 3689 RenderViewHostImpl* render_view_host,
3686 int64 frame_id) { 3690 int64 frame_id) {
3687 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 3691 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
3688 FrameDetached(render_view_host, frame_id)); 3692 FrameDetached(render_view_host, frame_id));
3689 } 3693 }
3690 3694
3691 } // namespace content 3695 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698