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

Side by Side Diff: chrome/browser/ui/views/dropdown_bar_host.h

Issue 6913026: Compact Navigation prototype (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 7 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_HOST_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_HOST_H_
6 #define CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_HOST_H_ 6 #define CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "content/common/native_web_keyboard_event.h" 10 #include "content/common/native_web_keyboard_event.h"
(...skipping 27 matching lines...) Expand all
38 // obscuring the selection results in FindBar. 38 // obscuring the selection results in FindBar.
39 // 39 //
40 //////////////////////////////////////////////////////////////////////////////// 40 ////////////////////////////////////////////////////////////////////////////////
41 class DropdownBarHost : public views::AcceleratorTarget, 41 class DropdownBarHost : public views::AcceleratorTarget,
42 public views::FocusChangeListener, 42 public views::FocusChangeListener,
43 public ui::AnimationDelegate { 43 public ui::AnimationDelegate {
44 public: 44 public:
45 explicit DropdownBarHost(BrowserView* browser_view); 45 explicit DropdownBarHost(BrowserView* browser_view);
46 virtual ~DropdownBarHost(); 46 virtual ~DropdownBarHost();
47 47
48 class Delegate {
sky 2011/05/03 18:38:32 Declare this in a separate class so folks don't ne
SteveT 2011/05/06 18:48:43 From what we can see in many other places, the Del
sky 2011/05/06 19:56:06 From https://sites.google.com/a/chromium.org/dev/d
SteveT 2011/05/06 22:13:40 Done.
49 public:
50 // Claims focus for the text field and selects its contents.
51 virtual void SetFocusAndSelection(bool select_all) = 0;
52
53 // Updates the view to let it know where the host is clipping the
54 // dropdown widget (while animating the opening or closing of the widget).
55 virtual void set_animation_offset(int offset) = 0;
56 };
57
48 // Initializes the dropdown bar host with the give view. 58 // Initializes the dropdown bar host with the give view.
sky 2011/05/03 18:38:32 'give' -> 'given'
SteveT 2011/05/06 18:48:43 Done.
49 void Init(DropdownBarView* view); 59 void Init(views::View* view, Delegate* delegate);
sky 2011/05/03 18:38:32 Can delegate be passed to the constructor?
SteveT 2011/05/06 18:48:43 It gets a bit hairy here if I move the Delegate in
50 60
51 // Whether we are animating the position of the dropdown widget. 61 // Whether we are animating the position of the dropdown widget.
52 bool IsAnimating() const; 62 bool IsAnimating() const;
53 // Returns true if the dropdown bar view is visible, or false otherwise. 63 // Returns true if the dropdown bar view is visible, or false otherwise.
54 bool IsVisible() const; 64 bool IsVisible() const;
55 // Selects text in the entry field and set focus. 65 // Selects text in the entry field and set focus.
56 void SetFocusAndSelection(); 66 void SetFocusAndSelection();
57 // Stops the animation. 67 // Stops the animation.
58 void StopAnimation(); 68 void StopAnimation();
59 69
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // classes registers by using overrides of RegisterAccelerators). See also: 104 // classes registers by using overrides of RegisterAccelerators). See also:
95 // SetFocusChangeListener(). 105 // SetFocusChangeListener().
96 virtual void RegisterAccelerators(); 106 virtual void RegisterAccelerators();
97 107
98 // When we loose focus, we unregister all accelerator handlers. See also: 108 // When we loose focus, we unregister all accelerator handlers. See also:
99 // SetFocusChangeListener(). 109 // SetFocusChangeListener().
100 virtual void UnregisterAccelerators(); 110 virtual void UnregisterAccelerators();
101 111
102 protected: 112 protected:
103 // Returns the dropdown bar view. 113 // Returns the dropdown bar view.
104 DropdownBarView* view() const { return view_; } 114 views::View* view() const { return view_; }
105 115
106 // Returns the focus tracker. 116 // Returns the focus tracker.
107 views::ExternalFocusTracker* focus_tracker() const { 117 views::ExternalFocusTracker* focus_tracker() const {
108 return focus_tracker_.get(); 118 return focus_tracker_.get();
109 } 119 }
110 120
111 // Resets the focus tracker. 121 // Resets the focus tracker.
112 void ResetFocusTracker(); 122 void ResetFocusTracker();
113 123
114 // The focus manager we register with to keep track of focus changes. 124 // The focus manager we register with to keep track of focus changes.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // Returns the animation for the dropdown. 157 // Returns the animation for the dropdown.
148 ui::SlideAnimation* animation() { 158 ui::SlideAnimation* animation() {
149 return animation_.get(); 159 return animation_.get();
150 } 160 }
151 161
152 private: 162 private:
153 // The BrowserView that created us. 163 // The BrowserView that created us.
154 BrowserView* browser_view_; 164 BrowserView* browser_view_;
155 165
156 // Our view, which is responsible for drawing the UI. 166 // Our view, which is responsible for drawing the UI.
157 DropdownBarView* view_; 167 views::View* view_;
168 Delegate* delegate_;
158 169
159 // The y position pixel offset of the widget while animating the 170 // The y position pixel offset of the widget while animating the
160 // dropdown widget. 171 // dropdown widget.
161 int animation_offset_; 172 int animation_offset_;
162 173
163 // The animation class to use when opening the Dropdown widget. 174 // The animation class to use when opening the Dropdown widget.
164 scoped_ptr<ui::SlideAnimation> animation_; 175 scoped_ptr<ui::SlideAnimation> animation_;
165 176
166 // The focus manager we register with to keep track of focus changes. 177 // The focus manager we register with to keep track of focus changes.
167 views::FocusManager* focus_manager_; 178 views::FocusManager* focus_manager_;
(...skipping 11 matching lines...) Expand all
179 scoped_ptr<views::Widget> host_; 190 scoped_ptr<views::Widget> host_;
180 191
181 // A flag to manually manage visibility. GTK/X11 is asynchronous and 192 // A flag to manually manage visibility. GTK/X11 is asynchronous and
182 // the state of the widget can be out of sync. 193 // the state of the widget can be out of sync.
183 bool is_visible_; 194 bool is_visible_;
184 195
185 DISALLOW_COPY_AND_ASSIGN(DropdownBarHost); 196 DISALLOW_COPY_AND_ASSIGN(DropdownBarHost);
186 }; 197 };
187 198
188 #endif // CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_HOST_H_ 199 #endif // CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698