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

Unified Diff: chrome/browser/ui/tabs/tab_utils.cc

Issue 2497373003: Add tab status to accessibility labels (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/tabs/tab_utils.cc
diff --git a/chrome/browser/ui/tabs/tab_utils.cc b/chrome/browser/ui/tabs/tab_utils.cc
index bfaa2744ea407cbe64c9f862d1deac747f6e5f2b..377a51eb21d60ede8a50777975114837e9f54387 100644
--- a/chrome/browser/ui/tabs/tab_utils.cc
+++ b/chrome/browser/ui/tabs/tab_utils.cc
@@ -59,6 +59,9 @@ const int kIndicatorFrameIntervalMs = 50; // 20 FPS
const int kIndicatorFadeInDurationMs = 200;
const int kIndicatorFadeOutDurationMs = 1000;
+// Network state indicating an error.
+const int kNetworkStateError = 3;
dmazzoni 2016/11/14 21:59:02 Can you use TabRendererData::NetworkState? Maybe
edwardjung 2016/11/24 11:36:43 Makes sense, separating this tooltip change into a
+
// Animation that throbs in (towards 1.0) and out (towards 0.0), and ends in the
// "in" state.
class TabRecordingIndicatorAnimation : public gfx::MultiAnimation {
@@ -250,13 +253,20 @@ std::unique_ptr<gfx::Animation> CreateTabAlertIndicatorFadeAnimation(
}
base::string16 AssembleTabTooltipText(const base::string16& title,
- TabAlertState alert_state) {
- if (alert_state == TabAlertState::NONE)
- return title;
-
+ TabAlertState alert_state,
+ int network_state) {
base::string16 result = title;
if (!result.empty())
result.append(1, '\n');
+
+ if (network_state == kNetworkStateError) {
+ result.append(
+ l10n_util::GetStringUTF16(IDS_TAB_AX_LABEL_NETWORK_ERROR));
+ return result;
+ }
+ if (alert_state == TabAlertState::NONE)
+ return title;
+
switch (alert_state) {
case TabAlertState::AUDIO_PLAYING:
result.append(

Powered by Google App Engine
This is Rietveld 408576698