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

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: Added missing DropdownBarHostDelegate header file. 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"
11 #include "ui/base/animation/animation_delegate.h" 11 #include "ui/base/animation/animation_delegate.h"
12 #include "ui/gfx/native_widget_types.h" 12 #include "ui/gfx/native_widget_types.h"
13 #include "ui/gfx/rect.h" 13 #include "ui/gfx/rect.h"
14 #include "views/controls/textfield/textfield.h" 14 #include "views/controls/textfield/textfield.h"
15 #include "views/focus/focus_manager.h" 15 #include "views/focus/focus_manager.h"
16 16
17 class BrowserView; 17 class BrowserView;
18 class DropdownBarHostDelegate;
18 class DropdownBarView; 19 class DropdownBarView;
19 class TabContents; 20 class TabContents;
20 21
21 namespace ui { 22 namespace ui {
22 class SlideAnimation; 23 class SlideAnimation;
23 } 24 } // namespace ui
24 25
25 namespace views { 26 namespace views {
26 class ExternalFocusTracker; 27 class ExternalFocusTracker;
27 class View; 28 class View;
28 class Widget; 29 class Widget;
29 } 30 } // namespace views
30 31
31 //////////////////////////////////////////////////////////////////////////////// 32 ////////////////////////////////////////////////////////////////////////////////
32 // 33 //
33 // The DropdownBarHost implements the container widget for the UI that 34 // The DropdownBarHost implements the container widget for the UI that
34 // is shown at the top of browser contents. It uses the appropriate 35 // is shown at the top of browser contents. It uses the appropriate
35 // implementation from dropdown_bar_host_win.cc or dropdown_bar_host_gtk.cc to 36 // implementation from dropdown_bar_host_win.cc or dropdown_bar_host_gtk.cc to
36 // draw its content and is responsible for showing, hiding, animating, closing, 37 // draw its content and is responsible for showing, hiding, animating, closing,
37 // and moving the bar if needed, for example if the widget is 38 // and moving the bar if needed, for example if the widget is
38 // obscuring the selection results in FindBar. 39 // obscuring the selection results in FindBar.
39 // 40 //
40 //////////////////////////////////////////////////////////////////////////////// 41 ////////////////////////////////////////////////////////////////////////////////
41 class DropdownBarHost : public views::AcceleratorTarget, 42 class DropdownBarHost : public views::AcceleratorTarget,
42 public views::FocusChangeListener, 43 public views::FocusChangeListener,
43 public ui::AnimationDelegate { 44 public ui::AnimationDelegate {
44 public: 45 public:
45 explicit DropdownBarHost(BrowserView* browser_view); 46 explicit DropdownBarHost(BrowserView* browser_view);
46 virtual ~DropdownBarHost(); 47 virtual ~DropdownBarHost();
47 48
48 // Initializes the dropdown bar host with the give view. 49 void Init(views::View* view, DropdownBarHostDelegate* delegate);
49 void Init(DropdownBarView* view);
50 50
51 // Whether we are animating the position of the dropdown widget. 51 // Whether we are animating the position of the dropdown widget.
52 bool IsAnimating() const; 52 bool IsAnimating() const;
53 // Returns true if the dropdown bar view is visible, or false otherwise. 53 // Returns true if the dropdown bar view is visible, or false otherwise.
54 bool IsVisible() const; 54 bool IsVisible() const;
55 // Selects text in the entry field and set focus. 55 // Selects text in the entry field and set focus.
56 void SetFocusAndSelection(); 56 void SetFocusAndSelection();
57 // Stops the animation. 57 // Stops the animation.
58 void StopAnimation(); 58 void StopAnimation();
59 59
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // classes registers by using overrides of RegisterAccelerators). See also: 94 // classes registers by using overrides of RegisterAccelerators). See also:
95 // SetFocusChangeListener(). 95 // SetFocusChangeListener().
96 virtual void RegisterAccelerators(); 96 virtual void RegisterAccelerators();
97 97
98 // When we loose focus, we unregister all accelerator handlers. See also: 98 // When we loose focus, we unregister all accelerator handlers. See also:
99 // SetFocusChangeListener(). 99 // SetFocusChangeListener().
100 virtual void UnregisterAccelerators(); 100 virtual void UnregisterAccelerators();
101 101
102 protected: 102 protected:
103 // Returns the dropdown bar view. 103 // Returns the dropdown bar view.
104 DropdownBarView* view() const { return view_; } 104 views::View* view() const { return view_; }
105 105
106 // Returns the focus tracker. 106 // Returns the focus tracker.
107 views::ExternalFocusTracker* focus_tracker() const { 107 views::ExternalFocusTracker* focus_tracker() const {
108 return focus_tracker_.get(); 108 return focus_tracker_.get();
109 } 109 }
110 110
111 // Resets the focus tracker. 111 // Resets the focus tracker.
112 void ResetFocusTracker(); 112 void ResetFocusTracker();
113 113
114 // The focus manager we register with to keep track of focus changes. 114 // 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. 147 // Returns the animation for the dropdown.
148 ui::SlideAnimation* animation() { 148 ui::SlideAnimation* animation() {
149 return animation_.get(); 149 return animation_.get();
150 } 150 }
151 151
152 private: 152 private:
153 // The BrowserView that created us. 153 // The BrowserView that created us.
154 BrowserView* browser_view_; 154 BrowserView* browser_view_;
155 155
156 // Our view, which is responsible for drawing the UI. 156 // Our view, which is responsible for drawing the UI.
157 DropdownBarView* view_; 157 views::View* view_;
158 DropdownBarHostDelegate* delegate_;
158 159
159 // The y position pixel offset of the widget while animating the 160 // The y position pixel offset of the widget while animating the
160 // dropdown widget. 161 // dropdown widget.
161 int animation_offset_; 162 int animation_offset_;
162 163
163 // The animation class to use when opening the Dropdown widget. 164 // The animation class to use when opening the Dropdown widget.
164 scoped_ptr<ui::SlideAnimation> animation_; 165 scoped_ptr<ui::SlideAnimation> animation_;
165 166
166 // The focus manager we register with to keep track of focus changes. 167 // The focus manager we register with to keep track of focus changes.
167 views::FocusManager* focus_manager_; 168 views::FocusManager* focus_manager_;
(...skipping 11 matching lines...) Expand all
179 scoped_ptr<views::Widget> host_; 180 scoped_ptr<views::Widget> host_;
180 181
181 // A flag to manually manage visibility. GTK/X11 is asynchronous and 182 // A flag to manually manage visibility. GTK/X11 is asynchronous and
182 // the state of the widget can be out of sync. 183 // the state of the widget can be out of sync.
183 bool is_visible_; 184 bool is_visible_;
184 185
185 DISALLOW_COPY_AND_ASSIGN(DropdownBarHost); 186 DISALLOW_COPY_AND_ASSIGN(DropdownBarHost);
186 }; 187 };
187 188
188 #endif // CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_HOST_H_ 189 #endif // CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698