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

Unified Diff: chrome/browser/views/accessible_toolbar_view.h

Issue 333010: Implement keyboard access between bookmarks and toolbar. (Closed)
Patch Set: Add more null checks Created 11 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
« no previous file with comments | « no previous file | chrome/browser/views/accessible_toolbar_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/accessible_toolbar_view.h
diff --git a/chrome/browser/views/accessible_toolbar_view.h b/chrome/browser/views/accessible_toolbar_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..f892a745c0a50f64275c80b0d7032533c329af0d
--- /dev/null
+++ b/chrome/browser/views/accessible_toolbar_view.h
@@ -0,0 +1,72 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_VIEWS_ACCESSIBLE_TOOLBAR_VIEW_H_
+#define CHROME_BROWSER_VIEWS_ACCESSIBLE_TOOLBAR_VIEW_H_
+
+#include "views/view.h"
+
+// This class provides keyboard access to any view that extends it by intiating
+// ALT+SHIFT+T. And once you press TAB or SHIFT-TAB, it will traverse all the
+// toolbars within Chrome. Child views are traversed in the order they were
+// added.
+
+class AccessibleToolbarView : public views::View {
+ public:
+ AccessibleToolbarView();
+ virtual ~AccessibleToolbarView();
+
+ // Initiate the traversal on the toolbar. The last focused view is stored in
+ // the ViewStorage with the corresponding |view_storage_id|.
+ void InitiateTraversal(int view_storage_id);
+
+ // Overridden from views::View:
+ virtual void DidGainFocus();
+ virtual void WillLoseFocus();
+ virtual bool OnKeyPressed(const views::KeyEvent& e);
+ virtual bool OnKeyReleased(const views::KeyEvent& e);
+ virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e);
+ virtual void ShowContextMenu(int x, int y, bool is_mouse_gesture);
+ virtual void RequestFocus();
+ virtual bool GetAccessibleName(std::wstring* name);
+ virtual bool GetAccessibleRole(AccessibilityTypes::Role* role);
+ virtual void SetAccessibleName(const std::wstring& name);
+ virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
+ virtual View* GetAccFocusedChildView() { return selected_focused_view_; }
+
+ protected:
+ // Returns the next accessible view on the toolbar, starting from the given
+ // |view_index|. |forward| when true means it will navigate from left to right
+ // and vice versa when false. If |view_index| is -1 the first accessible child
+ // is returned.
+ views::View* GetNextAccessibleView(int view_index, bool forward);
+
+ // Invoked from GetNextAccessibleViewIndex to determine if |view| can be
+ // traversed to. Default implementation returns true, override to return false
+ // for views you don't want reachable.
+ virtual bool IsAccessibleViewTraversable(views::View* view);
+
+ private:
+ // Sets the focus to the currently |acc_focused_view_| view.
+ void SetFocusToAccessibleView();
+
+ // Retrieve the focused view from the storage so we can request focus back
+ // to it. If |focus_view| is null, we place focus on the default view.
+ // |selected_focused_view_| doesn't need to reset here since it will be
+ // dealt within the WillLoseFocus method.
+ void SetFocusToLastFocusedView();
+
+ // Storage of strings needed for accessibility.
+ std::wstring accessible_name_;
+
+ // Selected child view currently having accessibility focus.
+ views::View* selected_focused_view_;
+
+ // Last focused view that issued this traversal.
+ int last_focused_view_storage_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(AccessibleToolbarView);
+};
+
+#endif // CHROME_BROWSER_VIEWS_ACCESSIBLE_TOOLBAR_VIEW_H_
« no previous file with comments | « no previous file | chrome/browser/views/accessible_toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698