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

Unified Diff: views/focus/focus_search.h

Issue 8588064: views: Move bubble, events, focus and layout to ui/views/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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
« no previous file with comments | « views/focus/focus_manager_unittest.cc ('k') | views/focus/focus_search.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/focus/focus_search.h
diff --git a/views/focus/focus_search.h b/views/focus/focus_search.h
index ae20a3157ef8552d4c127861c38d064345cf9c3b..0ef2fc3d9c5b2b5e147b7b37a29cf86521bae3b8 100644
--- a/views/focus/focus_search.h
+++ b/views/focus/focus_search.h
@@ -2,121 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef VIEWS_WIDGET_FOCUS_SEARCH_H_
-#define VIEWS_WIDGET_FOCUS_SEARCH_H_
+#ifndef VIEWS_FOCUS_FOCUS_SEARCH_H_
+#define VIEWS_FOCUS_FOCUS_SEARCH_H_
#pragma once
-#include "views/view.h"
+#include "ui/views/focus/focus_search.h"
+// TODO(tfarina): remove this file once all includes have been updated.
-namespace views {
-
-class FocusTraversable;
-
-// FocusSearch is an object that implements the algorithm to find the
-// next view to focus.
-class VIEWS_EXPORT FocusSearch {
- public:
- // The direction in which the focus traversal is going.
- // TODO (jcampan): add support for lateral (left, right) focus traversal. The
- // goal is to switch to focusable views on the same level when using the arrow
- // keys (ala Windows: in a dialog box, arrow keys typically move between the
- // dialog OK, Cancel buttons).
- enum Direction {
- UP = 0,
- DOWN
- };
-
- // Constructor.
- // - |root| is the root of the view hierarchy to traverse. Focus will be
- // trapped inside.
- // - |cycle| should be true if you want FindNextFocusableView to cycle back
- // to the first view within this root when the traversal reaches
- // the end. If this is true, then if you pass a valid starting
- // view to FindNextFocusableView you will always get a valid view
- // out, even if it's the same view.
- // - |accessibility_mode| should be true if full keyboard accessibility is
- // needed and you want to check IsAccessibilityFocusableInRootView(),
- // rather than IsFocusableInRootView().
- FocusSearch(View* root, bool cycle, bool accessibility_mode);
- virtual ~FocusSearch() {}
-
- // Finds the next view that should be focused and returns it. If a
- // FocusTraversable is found while searching for the focusable view,
- // returns NULL and sets |focus_traversable| to the FocusTraversable
- // and |focus_traversable_view| to the view associated with the
- // FocusTraversable.
- //
- // Return NULL if the end of the focus loop is reached, unless this object
- // was initialized with |cycle|=true, in which case it goes back to the
- // beginning when it reaches the end of the traversal.
- // - |starting_view| is the view that should be used as the starting point
- // when looking for the previous/next view. It may be NULL (in which case
- // the first/last view should be used depending if normal/reverse).
- // - |reverse| whether we should find the next (reverse is false) or the
- // previous (reverse is true) view.
- // - |direction| specifies whether we are traversing down (meaning we should
- // look into child views) or traversing up (don't look at child views).
- // - |check_starting_view| is true if starting_view may obtain the next focus.
- // - |focus_traversable| is set to the focus traversable that should be
- // traversed if one is found (in which case the call returns NULL).
- // - |focus_traversable_view| is set to the view associated with the
- // FocusTraversable set in the previous parameter (it is used as the
- // starting view when looking for the next focusable view).
- virtual View* FindNextFocusableView(View* starting_view,
- bool reverse,
- Direction direction,
- bool check_starting_view,
- FocusTraversable** focus_traversable,
- View** focus_traversable_view);
-
- private:
- // Convenience method that returns true if a view is focusable and does not
- // belong to the specified group.
- bool IsViewFocusableCandidate(View* v, int skip_group_id);
-
- // Convenience method; returns true if a view is not NULL and is focusable
- // (checking IsAccessibilityFocusableInRootView() if accessibility_mode_ is
- // true).
- bool IsFocusable(View* v);
-
- // Returns the view selected for the group of the selected view. If the view
- // does not belong to a group or if no view is selected in the group, the
- // specified view is returned.
- View* FindSelectedViewForGroup(View* view);
-
- // Get the parent, but stay within the root. Returns NULL if asked for
- // the parent of root_.
- View* GetParent(View* view);
-
- // Returns the next focusable view or view containing a FocusTraversable
- // (NULL if none was found), starting at the starting_view.
- // |check_starting_view|, |can_go_up| and |can_go_down| controls the
- // traversal of the views hierarchy. |skip_group_id| specifies a group_id,
- // -1 means no group. All views from a group are traversed in one pass.
- View* FindNextFocusableViewImpl(View* starting_view,
- bool check_starting_view,
- bool can_go_up,
- bool can_go_down,
- int skip_group_id,
- FocusTraversable** focus_traversable,
- View** focus_traversable_view);
-
- // Same as FindNextFocusableViewImpl but returns the previous focusable view.
- View* FindPreviousFocusableViewImpl(View* starting_view,
- bool check_starting_view,
- bool can_go_up,
- bool can_go_down,
- int skip_group_id,
- FocusTraversable** focus_traversable,
- View** focus_traversable_view);
-
- View* root_;
- bool cycle_;
- bool accessibility_mode_;
-
- DISALLOW_COPY_AND_ASSIGN(FocusSearch);
-};
-
-} // namespace views
-
-#endif // VIEWS_WIDGET_FOCUS_SEARCH_H_
+#endif // VIEWS_FOCUS_FOCUS_SEARCH_H_
« no previous file with comments | « views/focus/focus_manager_unittest.cc ('k') | views/focus/focus_search.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698