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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // defined(OS_WIN) | 10 #endif // defined(OS_WIN) |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 return favicon_tab_helper ? favicon_tab_helper->GetFavicon() : gfx::Image(); | 569 return favicon_tab_helper ? favicon_tab_helper->GetFavicon() : gfx::Image(); |
570 } | 570 } |
571 | 571 |
572 base::string16 Browser::GetWindowTitleForCurrentTab() const { | 572 base::string16 Browser::GetWindowTitleForCurrentTab() const { |
573 WebContents* contents = tab_strip_model_->GetActiveWebContents(); | 573 WebContents* contents = tab_strip_model_->GetActiveWebContents(); |
574 base::string16 title; | 574 base::string16 title; |
575 | 575 |
576 // |contents| can be NULL because GetWindowTitleForCurrentTab is called by the | 576 // |contents| can be NULL because GetWindowTitleForCurrentTab is called by the |
577 // window during the window's creation (before tabs have been added). | 577 // window during the window's creation (before tabs have been added). |
578 if (contents) { | 578 if (contents) { |
| 579 // Streamlined hosted apps use the host instead of the title. |
| 580 if (is_app() && CommandLine::ForCurrentProcess()->HasSwitch( |
| 581 switches::kEnableStreamlinedHostedApps)) { |
| 582 return base::UTF8ToUTF16(contents->GetURL().host()); |
| 583 } |
| 584 |
579 title = contents->GetTitle(); | 585 title = contents->GetTitle(); |
580 FormatTitleForDisplay(&title); | 586 FormatTitleForDisplay(&title); |
581 } | 587 } |
582 if (title.empty()) | 588 if (title.empty()) |
583 title = CoreTabHelper::GetDefaultTitle(); | 589 title = CoreTabHelper::GetDefaultTitle(); |
584 | 590 |
585 #if defined(OS_MACOSX) | 591 #if defined(OS_MACOSX) |
586 // On Mac, we don't want to suffix the page title with | 592 // On Mac, we don't want to suffix the page title with |
587 // the application name. | 593 // the application name. |
588 return title; | 594 return title; |
(...skipping 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2471 if (contents && !allow_js_access) { | 2477 if (contents && !allow_js_access) { |
2472 contents->web_contents()->GetController().LoadURL( | 2478 contents->web_contents()->GetController().LoadURL( |
2473 target_url, | 2479 target_url, |
2474 content::Referrer(), | 2480 content::Referrer(), |
2475 content::PAGE_TRANSITION_LINK, | 2481 content::PAGE_TRANSITION_LINK, |
2476 std::string()); // No extra headers. | 2482 std::string()); // No extra headers. |
2477 } | 2483 } |
2478 | 2484 |
2479 return contents != NULL; | 2485 return contents != NULL; |
2480 } | 2486 } |
OLD | NEW |