| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "chrome/browser/browser.h" | 5 #include "chrome/browser/browser.h" |
| 6 | 6 |
| 7 #include "app/animation.h" | 7 #include "app/animation.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/idle_timer.h" | 10 #include "base/idle_timer.h" |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 | 437 |
| 438 // |contents| can be NULL because GetCurrentPageTitle is called by the window | 438 // |contents| can be NULL because GetCurrentPageTitle is called by the window |
| 439 // during the window's creation (before tabs have been added). | 439 // during the window's creation (before tabs have been added). |
| 440 if (contents) { | 440 if (contents) { |
| 441 title = UTF16ToWideHack(contents->GetTitle()); | 441 title = UTF16ToWideHack(contents->GetTitle()); |
| 442 FormatTitleForDisplay(&title); | 442 FormatTitleForDisplay(&title); |
| 443 } | 443 } |
| 444 if (title.empty()) | 444 if (title.empty()) |
| 445 title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE); | 445 title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE); |
| 446 | 446 |
| 447 #if defined(OS_WIN) || defined(OS_LINUX) | 447 #if defined(OS_MACOSX) || defined(LINUX2) |
| 448 // On Mac, we don't want to suffix the page title with the application name. |
| 449 return title; |
| 450 #elif defined(OS_WIN) || defined(OS_LINUX) |
| 448 int string_id = IDS_BROWSER_WINDOW_TITLE_FORMAT; | 451 int string_id = IDS_BROWSER_WINDOW_TITLE_FORMAT; |
| 449 // Don't append the app name to window titles when we're not displaying a | 452 // Don't append the app name to window titles when we're not displaying a |
| 450 // distributor logo for the frame. | 453 // distributor logo for the frame. |
| 451 if (!ShouldShowDistributorLogo()) | 454 if (!ShouldShowDistributorLogo()) |
| 452 string_id = IDS_BROWSER_WINDOW_TITLE_FORMAT_NO_LOGO; | 455 string_id = IDS_BROWSER_WINDOW_TITLE_FORMAT_NO_LOGO; |
| 453 return l10n_util::GetStringF(string_id, title); | 456 return l10n_util::GetStringF(string_id, title); |
| 454 #elif defined(OS_MACOSX) | |
| 455 // On Mac, we don't want to suffix the page title with the application name. | |
| 456 return title; | |
| 457 #endif | 457 #endif |
| 458 } | 458 } |
| 459 | 459 |
| 460 // static | 460 // static |
| 461 void Browser::FormatTitleForDisplay(std::wstring* title) { | 461 void Browser::FormatTitleForDisplay(std::wstring* title) { |
| 462 size_t current_index = 0; | 462 size_t current_index = 0; |
| 463 size_t match_index; | 463 size_t match_index; |
| 464 while ((match_index = title->find(L'\n', current_index)) != | 464 while ((match_index = title->find(L'\n', current_index)) != |
| 465 std::wstring::npos) { | 465 std::wstring::npos) { |
| 466 title->replace(match_index, 1, L""); | 466 title->replace(match_index, 1, L""); |
| (...skipping 2238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2705 /////////////////////////////////////////////////////////////////////////////// | 2705 /////////////////////////////////////////////////////////////////////////////// |
| 2706 // BrowserToolbarModel (private): | 2706 // BrowserToolbarModel (private): |
| 2707 | 2707 |
| 2708 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { | 2708 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { |
| 2709 // This |current_tab| can be NULL during the initialization of the | 2709 // This |current_tab| can be NULL during the initialization of the |
| 2710 // toolbar during window creation (i.e. before any tabs have been added | 2710 // toolbar during window creation (i.e. before any tabs have been added |
| 2711 // to the window). | 2711 // to the window). |
| 2712 TabContents* current_tab = browser_->GetSelectedTabContents(); | 2712 TabContents* current_tab = browser_->GetSelectedTabContents(); |
| 2713 return current_tab ? ¤t_tab->controller() : NULL; | 2713 return current_tab ? ¤t_tab->controller() : NULL; |
| 2714 } | 2714 } |
| OLD | NEW |