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

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

Issue 1478303003: Converted all Views to use an InkDropDelegate instead of a InkDropAnimationController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added missing include. Created 5 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 unified diff | Download patch
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 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "content/public/browser/native_web_keyboard_event.h" 10 #include "content/public/browser/native_web_keyboard_event.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 // Shows the dropdown bar. 68 // Shows the dropdown bar.
69 virtual void Show(bool animate); 69 virtual void Show(bool animate);
70 // Hides the dropdown bar. 70 // Hides the dropdown bar.
71 virtual void Hide(bool animate); 71 virtual void Hide(bool animate);
72 72
73 // Returns the rectangle representing where to position the dropdown widget. 73 // Returns the rectangle representing where to position the dropdown widget.
74 virtual gfx::Rect GetDialogPosition(gfx::Rect avoid_overlapping_rect) = 0; 74 virtual gfx::Rect GetDialogPosition(gfx::Rect avoid_overlapping_rect) = 0;
75 75
76 // Moves the widget to the provided location, moves it to top 76 // Moves the widget to the provided location, moves it to top
77 // in the z-order (HWND_TOP, not HWND_TOPMOST for windows), and sets the size 77 // in the z-order (HWND_TOP, not HWND_TOPMOST for windows) and shows
78 // of the |view_|. 78 // the widget (if hidden).
79 virtual void SetDialogPosition(const gfx::Rect& new_pos); 79 virtual void SetDialogPosition(const gfx::Rect& new_pos) = 0;
80 80
81 // Overridden from views::FocusChangeListener: 81 // Overridden from views::FocusChangeListener:
82 void OnWillChangeFocus(views::View* focused_before, 82 void OnWillChangeFocus(views::View* focused_before,
83 views::View* focused_now) override; 83 views::View* focused_now) override;
84 void OnDidChangeFocus(views::View* focused_before, 84 void OnDidChangeFocus(views::View* focused_before,
85 views::View* focused_now) override; 85 views::View* focused_now) override;
86 86
87 // Overridden from ui::AcceleratorTarget: 87 // Overridden from ui::AcceleratorTarget:
88 bool AcceleratorPressed(const ui::Accelerator& accelerator) override = 0; 88 bool AcceleratorPressed(const ui::Accelerator& accelerator) override = 0;
89 bool CanHandleAccelerators() const override = 0; 89 bool CanHandleAccelerators() const override = 0;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 // Resets the focus tracker. 126 // Resets the focus tracker.
127 void ResetFocusTracker(); 127 void ResetFocusTracker();
128 128
129 // The focus manager we register with to keep track of focus changes. 129 // The focus manager we register with to keep track of focus changes.
130 views::FocusManager* focus_manager() const { return focus_manager_; } 130 views::FocusManager* focus_manager() const { return focus_manager_; }
131 131
132 // Returns the host widget. 132 // Returns the host widget.
133 views::Widget* host() const { return host_.get(); } 133 views::Widget* host() const { return host_.get(); }
134 134
135 // Returns the animation offset.
136 int animation_offset() const { return animation_offset_; }
137
135 // Retrieves the boundary that the dropdown widget has to work with 138 // Retrieves the boundary that the dropdown widget has to work with
136 // within the Chrome frame window. The boundary differs depending on 139 // within the Chrome frame window. The boundary differs depending on
137 // the dropdown bar implementation. The default implementation 140 // the dropdown bar implementation. The default implementation
138 // returns the boundary of browser_view and the drop down 141 // returns the boundary of browser_view and the drop down
139 // can be shown in any client area. 142 // can be shown in any client area.
140 virtual void GetWidgetBounds(gfx::Rect* bounds); 143 virtual void GetWidgetBounds(gfx::Rect* bounds);
141 144
142 // Returns the animation for the dropdown. 145 // Returns the animation for the dropdown.
143 gfx::SlideAnimation* animation() { 146 gfx::SlideAnimation* animation() {
144 return animation_.get(); 147 return animation_.get();
145 } 148 }
146 149
147 private: 150 private:
148 // Set the view whose position in the |browser_view_| view hierarchy 151 // Set the view whose position in the |browser_view_| view hierarchy
149 // determines the z-order of |host_| relative to views with layers and 152 // determines the z-order of |host_| relative to views with layers and
150 // views with associated NativeViews. 153 // views with associated NativeViews.
151 void SetHostViewNative(views::View* host_view); 154 void SetHostViewNative(views::View* host_view);
152 155
153 // The BrowserView that created us. 156 // The BrowserView that created us.
154 BrowserView* browser_view_; 157 BrowserView* browser_view_;
155 158
156 // A parent View to |view_| that is used to clip when animating the bar
157 // between the shown and hidden states.
158 views::View* clip_view_;
159
160 // Our view, which is responsible for drawing the UI. 159 // Our view, which is responsible for drawing the UI.
161 views::View* view_; 160 views::View* view_;
162 DropdownBarHostDelegate* delegate_; 161 DropdownBarHostDelegate* delegate_;
163 162
163 // The y position pixel offset of the widget while animating the
164 // dropdown widget.
165 int animation_offset_;
166
164 // The animation class to use when opening the Dropdown widget. 167 // The animation class to use when opening the Dropdown widget.
165 scoped_ptr<gfx::SlideAnimation> animation_; 168 scoped_ptr<gfx::SlideAnimation> animation_;
166 169
167 // The focus manager we register with to keep track of focus changes. 170 // The focus manager we register with to keep track of focus changes.
168 views::FocusManager* focus_manager_; 171 views::FocusManager* focus_manager_;
169 172
170 // True if the accelerator target for Esc key is registered. 173 // True if the accelerator target for Esc key is registered.
171 bool esc_accel_target_registered_; 174 bool esc_accel_target_registered_;
172 175
173 // Tracks and stores the last focused view which is not the DropdownBarView 176 // Tracks and stores the last focused view which is not the DropdownBarView
174 // or any of its children. Used to restore focus once the DropdownBarView is 177 // or any of its children. Used to restore focus once the DropdownBarView is
175 // closed. 178 // closed.
176 scoped_ptr<views::ExternalFocusTracker> focus_tracker_; 179 scoped_ptr<views::ExternalFocusTracker> focus_tracker_;
177 180
178 // Host is the Widget implementation that is created and maintained by the 181 // Host is the Widget implementation that is created and maintained by the
179 // dropdown bar. It contains the DropdownBarView. 182 // dropdown bar. It contains the DropdownBarView.
180 scoped_ptr<views::Widget> host_; 183 scoped_ptr<views::Widget> host_;
181 184
182 // A flag to manually manage visibility. GTK/X11 is asynchronous and 185 // A flag to manually manage visibility. GTK/X11 is asynchronous and
183 // the state of the widget can be out of sync. 186 // the state of the widget can be out of sync.
184 bool is_visible_; 187 bool is_visible_;
185 188
186 DISALLOW_COPY_AND_ASSIGN(DropdownBarHost); 189 DISALLOW_COPY_AND_ASSIGN(DropdownBarHost);
187 }; 190 };
188 191
189 #endif // CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_HOST_H_ 192 #endif // CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698