Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 2581023002: Add tab status to accessibility labels (Closed)
Patch Set: Return early if invalid tab index Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/views/frame/browser_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 // window during the window's creation (before tabs have been added). 570 // window during the window's creation (before tabs have been added).
571 favicon::FaviconDriver* favicon_driver = 571 favicon::FaviconDriver* favicon_driver =
572 web_contents 572 web_contents
573 ? favicon::ContentFaviconDriver::FromWebContents(web_contents) 573 ? favicon::ContentFaviconDriver::FromWebContents(web_contents)
574 : nullptr; 574 : nullptr;
575 return favicon_driver ? favicon_driver->GetFavicon() : gfx::Image(); 575 return favicon_driver ? favicon_driver->GetFavicon() : gfx::Image();
576 } 576 }
577 577
578 base::string16 Browser::GetWindowTitleForCurrentTab( 578 base::string16 Browser::GetWindowTitleForCurrentTab(
579 bool include_app_name) const { 579 bool include_app_name) const {
580 WebContents* contents = tab_strip_model_->GetActiveWebContents(); 580 return GetWindowTitleFromWebContents(
581 include_app_name, tab_strip_model_->GetActiveWebContents());
582 }
583
584 base::string16 Browser::GetWindowTitleForTab(bool include_app_name,
585 int index) const {
586 return GetWindowTitleFromWebContents(
587 include_app_name, tab_strip_model_->GetWebContentsAt(index));
588 }
589
590 base::string16 Browser::GetWindowTitleFromWebContents(
591 bool include_app_name,
592 content::WebContents* contents) const {
581 base::string16 title; 593 base::string16 title;
582 594
583 // |contents| can be NULL because GetWindowTitleForCurrentTab is called by the 595 // |contents| can be NULL because GetWindowTitleForCurrentTab is called by the
584 // window during the window's creation (before tabs have been added). 596 // window during the window's creation (before tabs have been added).
585 if (contents) { 597 if (contents) {
586 // The web app frame uses the host instead of the title. 598 // The web app frame uses the host instead of the title.
587 if (ShouldUseWebAppFrame()) 599 if (ShouldUseWebAppFrame())
588 return base::UTF8ToUTF16(contents->GetURL().host()); 600 return base::UTF8ToUTF16(contents->GetURL().host());
589 601
590 title = contents->GetTitle(); 602 title = contents->GetTitle();
(...skipping 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after
2600 // new window later, thus we need to navigate the window now. 2612 // new window later, thus we need to navigate the window now.
2601 if (contents) { 2613 if (contents) {
2602 contents->web_contents()->GetController().LoadURL( 2614 contents->web_contents()->GetController().LoadURL(
2603 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, 2615 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK,
2604 std::string()); // No extra headers. 2616 std::string()); // No extra headers.
2605 } 2617 }
2606 } 2618 }
2607 2619
2608 return contents != NULL; 2620 return contents != NULL;
2609 } 2621 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/views/frame/browser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698