Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 595 // The web app frame uses the host instead of the title. | 595 // The web app frame uses the host instead of the title. |
| 596 if (ShouldUseWebAppFrame()) | 596 if (ShouldUseWebAppFrame()) |
| 597 return base::UTF8ToUTF16(contents->GetURL().host()); | 597 return base::UTF8ToUTF16(contents->GetURL().host()); |
| 598 | 598 |
| 599 title = contents->GetTitle(); | 599 title = contents->GetTitle(); |
| 600 FormatTitleForDisplay(&title); | 600 FormatTitleForDisplay(&title); |
| 601 } | 601 } |
| 602 if (title.empty()) | 602 if (title.empty()) |
| 603 title = CoreTabHelper::GetDefaultTitle(); | 603 title = CoreTabHelper::GetDefaultTitle(); |
| 604 | 604 |
| 605 #if defined(OS_MACOSX) || defined(USE_ASH) | 605 #if defined(OS_MACOSX) |
| 606 // On Mac and Ash, we don't want to suffix the page title with the application | 606 // On Mac, we don't want to suffix the page title with the application name. |
| 607 // name. | |
| 608 return title; | 607 return title; |
| 609 #endif | 608 #endif |
| 610 // Don't append the app name to window titles on app frames and app popups | 609 // Don't append the app name to window titles on app frames and app popups. |
| 611 return is_app() ? | 610 return is_app() ? |
| 612 title : | 611 title : |
| 613 l10n_util::GetStringFUTF16(IDS_BROWSER_WINDOW_TITLE_FORMAT, title); | 612 l10n_util::GetStringFUTF16(IDS_BROWSER_WINDOW_TITLE_FORMAT, title); |
|
sky
2016/06/24 22:16:12
Won't this change effect more than just overview m
varkha
2016/06/24 23:15:32
My logic was:
- The change is only on Chrome OS (t
| |
| 614 } | 613 } |
| 615 | 614 |
| 616 // static | 615 // static |
| 617 void Browser::FormatTitleForDisplay(base::string16* title) { | 616 void Browser::FormatTitleForDisplay(base::string16* title) { |
| 618 size_t current_index = 0; | 617 size_t current_index = 0; |
| 619 size_t match_index; | 618 size_t match_index; |
| 620 while ((match_index = title->find(L'\n', current_index)) != | 619 while ((match_index = title->find(L'\n', current_index)) != |
| 621 base::string16::npos) { | 620 base::string16::npos) { |
| 622 title->replace(match_index, 1, base::string16()); | 621 title->replace(match_index, 1, base::string16()); |
| 623 current_index = match_index; | 622 current_index = match_index; |
| (...skipping 1974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2598 if (contents && !allow_js_access) { | 2597 if (contents && !allow_js_access) { |
| 2599 contents->web_contents()->GetController().LoadURL( | 2598 contents->web_contents()->GetController().LoadURL( |
| 2600 target_url, | 2599 target_url, |
| 2601 content::Referrer(), | 2600 content::Referrer(), |
| 2602 ui::PAGE_TRANSITION_LINK, | 2601 ui::PAGE_TRANSITION_LINK, |
| 2603 std::string()); // No extra headers. | 2602 std::string()); // No extra headers. |
| 2604 } | 2603 } |
| 2605 | 2604 |
| 2606 return contents != NULL; | 2605 return contents != NULL; |
| 2607 } | 2606 } |
| OLD | NEW |