diff options
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r-- | chrome/browser/browser.cc | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 105654f..866b2a5 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -1632,7 +1632,7 @@ void Browser::OpenURLOffTheRecord(Profile* profile, const GURL& url) { std::wstring Browser::ComputePopupTitle(const GURL& url, const std::wstring& title) { std::wstring result(title); - Tab::FormatTitleForDisplay(&result); + FormatTitleForDisplay(&result); return result; } @@ -1762,3 +1762,35 @@ NavigationController* Browser::GetSelectedNavigationController() const { else return NULL; } + +/////////////////////////////////////////////////////////////////////////////// +// NEW FRAME TODO(beng): clean up this file +// DO NOT PLACE METHODS NOT RELATED TO NEW FRAMES BELOW THIS LINE. + +SkBitmap Browser::GetCurrentPageIcon() const { + TabContents* contents = tabstrip_model_.GetSelectedTabContents(); + return contents ? contents->GetFavIcon() : SkBitmap(); +} + +std::wstring Browser::GetCurrentPageTitle() const { + TabContents* contents = tabstrip_model_.GetSelectedTabContents(); + std::wstring title; + if (contents) { + title = contents->GetTitle(); + FormatTitleForDisplay(&title); + } + if (title.empty()) + title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE); + return title; +} + +// static +void Browser::FormatTitleForDisplay(std::wstring* title) { + size_t current_index = 0; + size_t match_index; + while ((match_index = title->find(L'\n', current_index)) != + std::wstring::npos) { + title->replace(match_index, 1, L""); + current_index = match_index; + } +} |