Skip to content
Snippets Groups Projects
Commit 731f8a45 authored by phajdan.jr@chromium.org's avatar phajdan.jr@chromium.org
Browse files

Fix misleading name and comment of Browser::GetCurrentPageTitle.

GetWindowTitleForCurrentTab more accurately describes what this function really does.

TEST=none
http://crbug.com/16231

Review URL: http://codereview.chromium.org/155534

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21114 0039d316-1c4b-4281-b951-d872f2087c98
parent 772836b1
No related merge requests found
......@@ -431,12 +431,12 @@ SkBitmap Browser::GetCurrentPageIcon() const {
return contents ? contents->GetFavIcon() : SkBitmap();
}
string16 Browser::GetCurrentPageTitle() const {
string16 Browser::GetWindowTitleForCurrentTab() const {
TabContents* contents = tabstrip_model_.GetSelectedTabContents();
string16 title;
// |contents| can be NULL because GetCurrentPageTitle is called by the window
// during the window's creation (before tabs have been added).
// |contents| can be NULL because GetWindowTitleForCurrentTab is called by the
// window during the window's creation (before tabs have been added).
if (contents) {
title = contents->GetTitle();
FormatTitleForDisplay(&title);
......
......@@ -162,8 +162,8 @@ class Browser : public TabStripModelDelegate,
// Gets the FavIcon of the page in the selected tab.
SkBitmap GetCurrentPageIcon() const;
// Gets the title of the page in the selected tab.
string16 GetCurrentPageTitle() const;
// Gets the title of the window based on the selected tab's title.
string16 GetWindowTitleForCurrentTab() const;
// Prepares a title string for display (removes embedded newlines, etc).
static void FormatTitleForDisplay(string16* title);
......
......@@ -65,7 +65,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NoTitle) {
ui_test_utils::NavigateToURL(browser(),
ui_test_utils::GetTestUrl(L".", L"title1.html"));
EXPECT_EQ(LocaleWindowCaptionFromPageTitle(L"title1.html"),
UTF16ToWideHack(browser()->GetCurrentPageTitle()));
UTF16ToWideHack(browser()->GetWindowTitleForCurrentTab()));
string16 tab_title;
ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &tab_title));
EXPECT_EQ(ASCIIToUTF16("title1.html"), tab_title);
......@@ -78,7 +78,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, Title) {
ui_test_utils::GetTestUrl(L".", L"title2.html"));
const std::wstring test_title(L"Title Of Awesomeness");
EXPECT_EQ(LocaleWindowCaptionFromPageTitle(test_title),
UTF16ToWideHack(browser()->GetCurrentPageTitle()));
UTF16ToWideHack(browser()->GetWindowTitleForCurrentTab()));
string16 tab_title;
ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &tab_title));
EXPECT_EQ(WideToUTF16(test_title), tab_title);
......
......@@ -92,7 +92,7 @@ void BrowserWindowCocoa::SelectedTabToolbarSizeChanged(bool is_animating) {
void BrowserWindowCocoa::UpdateTitleBar() {
NSString* newTitle =
base::SysUTF16ToNSString(browser_->GetCurrentPageTitle());
base::SysUTF16ToNSString(browser_->GetWindowTitleForCurrentTab());
// Window menu
[NSApp changeWindowsItem:window_ title:newTitle filename:NO];
......
......@@ -585,7 +585,7 @@ void BrowserWindowGtk::UpdateTitleBar() {
panel_controller_->UpdateTitleBar();
#endif
string16 title = browser_->GetCurrentPageTitle();
string16 title = browser_->GetWindowTitleForCurrentTab();
gtk_window_set_title(window_, UTF16ToUTF8(title).c_str());
if (ShouldShowWindowIcon()) {
// TODO(tc): If we're showing a title bar, we should update the app icon.
......
......@@ -1127,7 +1127,7 @@ bool BrowserView::IsModal() const {
}
std::wstring BrowserView::GetWindowTitle() const {
return UTF16ToWideHack(browser_->GetCurrentPageTitle());
return UTF16ToWideHack(browser_->GetWindowTitleForCurrentTab());
}
views::View* BrowserView::GetInitiallyFocusedView() {
......
......@@ -95,8 +95,8 @@ PanelController::PanelController(BrowserWindowGtk* browser_window)
}
void PanelController::UpdateTitleBar() {
title_content_->title_label()->SetText(
UTF16ToWideHack(browser_window_->browser()->GetCurrentPageTitle()));
title_content_->title_label()->SetText(UTF16ToWideHack(
browser_window_->browser()->GetWindowTitleForCurrentTab()));
}
bool PanelController::TitleMousePressed(const views::MouseEvent& event) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment