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

Unified Diff: chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc

Issue 2581023002: Add tab status to accessibility labels (Closed)
Patch Set: Add check for active browser tab index to prevent crashes 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
index 21c34bebee5fc5843b5a1554f7cea70cd6f25836..1913279453b42c672b778a0debde1d48b82093c5 100644
--- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
+++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
@@ -34,6 +34,9 @@
#include "components/omnibox/browser/autocomplete_match.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/navigation_controller.h"
+#include "content/public/browser/navigation_entry.h"
+#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/plugin_service.h"
#include "content/public/browser/user_metrics.h"
@@ -54,8 +57,17 @@ namespace {
TabRendererData::NetworkState TabContentsNetworkState(
WebContents* contents) {
- if (!contents || !contents->IsLoadingToDifferentDocument())
+ if (!contents)
return TabRendererData::NETWORK_STATE_NONE;
+
+ if (!contents->IsLoadingToDifferentDocument()) {
+ content::NavigationEntry* entry =
+ contents->GetController().GetLastCommittedEntry();
+ if (entry && (entry->GetPageType() == content::PAGE_TYPE_ERROR))
+ return TabRendererData::NETWORK_STATE_ERROR;
+ return TabRendererData::NETWORK_STATE_NONE;
+ }
+
if (contents->IsWaitingForResponse())
return TabRendererData::NETWORK_STATE_WAITING;
return TabRendererData::NETWORK_STATE_LOADING;
@@ -420,6 +432,11 @@ SkColor BrowserTabStripController::GetToolbarTopSeparatorColor() const {
->GetFrameView()->GetToolbarTopSeparatorColor();
}
+base::string16 BrowserTabStripController::GetAccessibleTabName() const {
+ return BrowserView::GetBrowserViewForBrowser(browser_)
sky 2016/12/16 00:52:51 Can you change BrowserTabStripController to take a
edwardjung 2016/12/19 12:59:25 Good point, fixed.
+ ->GetAccessibleWindowTitle();
+}
+
////////////////////////////////////////////////////////////////////////////////
// BrowserTabStripController, TabStripModelObserver implementation:

Powered by Google App Engine
This is Rietveld 408576698