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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 2579893002: Revert "Add tab status to accessibility labels". (Closed)
Patch Set: Created 4 years 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
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/views/frame/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 #endif 1588 #endif
1589 return false; 1589 return false;
1590 } 1590 }
1591 1591
1592 base::string16 BrowserView::GetWindowTitle() const { 1592 base::string16 BrowserView::GetWindowTitle() const {
1593 return browser_->GetWindowTitleForCurrentTab(true /* include_app_name */); 1593 return browser_->GetWindowTitleForCurrentTab(true /* include_app_name */);
1594 } 1594 }
1595 1595
1596 base::string16 BrowserView::GetAccessibleWindowTitle() const { 1596 base::string16 BrowserView::GetAccessibleWindowTitle() const {
1597 const bool include_app_name = false; 1597 const bool include_app_name = false;
1598 Tab* current_tab =
1599 tabstrip_->tab_at(browser_->tab_strip_model()->active_index());
1600
1601 if (IsIncognito()) { 1598 if (IsIncognito()) {
1602 return l10n_util::GetStringFUTF16( 1599 return l10n_util::GetStringFUTF16(
1603 IDS_ACCESSIBLE_INCOGNITO_WINDOW_TITLE_FORMAT, 1600 IDS_ACCESSIBLE_INCOGNITO_WINDOW_TITLE_FORMAT,
1604 GetAccessibleTabLabel(include_app_name, current_tab->data())); 1601 browser_->GetWindowTitleForCurrentTab(include_app_name));
1605 } 1602 }
1606 return GetAccessibleTabLabel(include_app_name, current_tab->data()); 1603 return browser_->GetWindowTitleForCurrentTab(include_app_name);
1607 }
1608
1609 base::string16 BrowserView::GetAccessibleTabLabel(
1610 bool include_app_name,
1611 const TabRendererData& data) const {
1612 base::string16 window_title =
1613 browser_->GetWindowTitleForCurrentTab(include_app_name);
1614 base::string16 tab_label;
1615 if (data.IsCrashed()) {
1616 // Tab has crashed.
1617 tab_label = l10n_util::GetStringFUTF16(IDS_TAB_AX_LABEL_CRASHED_FORMAT,
1618 window_title);
1619 } else if (data.network_state == TabRendererData::NETWORK_STATE_ERROR) {
1620 // Network error interstitial.
1621 tab_label = l10n_util::GetStringFUTF16(
1622 IDS_TAB_AX_LABEL_NETWORK_ERROR_FORMAT, window_title);
1623 } else {
1624 // Alert tab states.
1625 switch (data.alert_state) {
1626 case TabAlertState::AUDIO_PLAYING:
1627 tab_label = l10n_util::GetStringFUTF16(
1628 IDS_TAB_AX_LABEL_AUDIO_PLAYING_FORMAT, window_title);
1629 break;
1630 case TabAlertState::USB_CONNECTED:
1631 tab_label = l10n_util::GetStringFUTF16(
1632 IDS_TAB_AX_LABEL_USB_CONNECTED_FORMAT, window_title);
1633 break;
1634 case TabAlertState::BLUETOOTH_CONNECTED:
1635 tab_label = l10n_util::GetStringFUTF16(
1636 IDS_TAB_AX_LABEL_BLUETOOTH_CONNECTED_FORMAT, window_title);
1637 break;
1638 case TabAlertState::MEDIA_RECORDING:
1639 tab_label = l10n_util::GetStringFUTF16(
1640 IDS_TAB_AX_LABEL_MEDIA_RECORDING_FORMAT, window_title);
1641 break;
1642 case TabAlertState::AUDIO_MUTING:
1643 tab_label = l10n_util::GetStringFUTF16(
1644 IDS_TAB_AX_LABEL_AUDIO_MUTING_FORMAT, window_title);
1645 break;
1646 case TabAlertState::TAB_CAPTURING:
1647 tab_label = l10n_util::GetStringFUTF16(
1648 IDS_TAB_AX_LABEL_TAB_CAPTURING_FORMAT, window_title);
1649 break;
1650 case TabAlertState::NONE:
1651 tab_label = window_title;
1652 break;
1653 }
1654 }
1655 return tab_label;
1656 } 1604 }
1657 1605
1658 views::View* BrowserView::GetInitiallyFocusedView() { 1606 views::View* BrowserView::GetInitiallyFocusedView() {
1659 return nullptr; 1607 return nullptr;
1660 } 1608 }
1661 1609
1662 bool BrowserView::ShouldShowWindowTitle() const { 1610 bool BrowserView::ShouldShowWindowTitle() const {
1663 #if defined(USE_ASH) 1611 #if defined(USE_ASH)
1664 // For Ash only, trusted windows (apps and settings) do not show a title, 1612 // For Ash only, trusted windows (apps and settings) do not show a title,
1665 // crbug.com/119411. Child windows (i.e. popups) do show a title. 1613 // crbug.com/119411. Child windows (i.e. popups) do show a title.
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
2644 } 2592 }
2645 2593
2646 extensions::ActiveTabPermissionGranter* 2594 extensions::ActiveTabPermissionGranter*
2647 BrowserView::GetActiveTabPermissionGranter() { 2595 BrowserView::GetActiveTabPermissionGranter() {
2648 content::WebContents* web_contents = GetActiveWebContents(); 2596 content::WebContents* web_contents = GetActiveWebContents();
2649 if (!web_contents) 2597 if (!web_contents)
2650 return nullptr; 2598 return nullptr;
2651 return extensions::TabHelper::FromWebContents(web_contents) 2599 return extensions::TabHelper::FromWebContents(web_contents)
2652 ->active_tab_permission_granter(); 2600 ->active_tab_permission_granter();
2653 } 2601 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | chrome/browser/ui/views/tabs/browser_tab_strip_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698