OLD | NEW |
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/public/browser/native_web_keyboard_event.h" | 10 #include "content/public/browser/native_web_keyboard_event.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 //////////////////////////////////////////////////////////////////////////////// | 32 //////////////////////////////////////////////////////////////////////////////// |
33 // | 33 // |
34 // The DropdownBarHost implements the container widget for the UI that | 34 // The DropdownBarHost implements the container widget for the UI that |
35 // 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 |
36 // 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 |
37 // draw its content and is responsible for showing, hiding, animating, closing, | 37 // draw its content and is responsible for showing, hiding, animating, closing, |
38 // 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 |
39 // obscuring the selection results in FindBar. | 39 // obscuring the selection results in FindBar. |
40 // | 40 // |
41 //////////////////////////////////////////////////////////////////////////////// | 41 //////////////////////////////////////////////////////////////////////////////// |
42 class DropdownBarHost : public views::AcceleratorTarget, | 42 class DropdownBarHost : public ui::AcceleratorTarget, |
43 public views::FocusChangeListener, | 43 public views::FocusChangeListener, |
44 public ui::AnimationDelegate { | 44 public ui::AnimationDelegate { |
45 public: | 45 public: |
46 explicit DropdownBarHost(BrowserView* browser_view); | 46 explicit DropdownBarHost(BrowserView* browser_view); |
47 virtual ~DropdownBarHost(); | 47 virtual ~DropdownBarHost(); |
48 | 48 |
49 void Init(views::View* view, DropdownBarHostDelegate* delegate); | 49 void Init(views::View* view, DropdownBarHostDelegate* delegate); |
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; |
(...skipping 16 matching lines...) Expand all Loading... |
69 // in the z-order (HWND_TOP, not HWND_TOPMOST for windows) and shows | 69 // in the z-order (HWND_TOP, not HWND_TOPMOST for windows) and shows |
70 // the widget (if hidden). | 70 // the widget (if hidden). |
71 virtual void SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw) = 0; | 71 virtual void SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw) = 0; |
72 | 72 |
73 // Overridden from views::FocusChangeListener: | 73 // Overridden from views::FocusChangeListener: |
74 virtual void OnWillChangeFocus(views::View* focused_before, | 74 virtual void OnWillChangeFocus(views::View* focused_before, |
75 views::View* focused_now) OVERRIDE; | 75 views::View* focused_now) OVERRIDE; |
76 virtual void OnDidChangeFocus(views::View* focused_before, | 76 virtual void OnDidChangeFocus(views::View* focused_before, |
77 views::View* focused_now) OVERRIDE; | 77 views::View* focused_now) OVERRIDE; |
78 | 78 |
79 // Overridden from views::AcceleratorTarget: | 79 // Overridden from ui::AcceleratorTarget: |
80 virtual bool AcceleratorPressed(const views::Accelerator& accelerator) = 0; | 80 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) = 0; |
81 | 81 |
82 // ui::AnimationDelegate implementation: | 82 // ui::AnimationDelegate implementation: |
83 virtual void AnimationProgressed(const ui::Animation* animation); | 83 virtual void AnimationProgressed(const ui::Animation* animation); |
84 virtual void AnimationEnded(const ui::Animation* animation); | 84 virtual void AnimationEnded(const ui::Animation* animation); |
85 | 85 |
86 // During testing we can disable animations by setting this flag to true, | 86 // During testing we can disable animations by setting this flag to true, |
87 // so that opening and closing the dropdown bar is shown instantly, instead of | 87 // so that opening and closing the dropdown bar is shown instantly, instead of |
88 // having to poll it while it animates to open/closed status. | 88 // having to poll it while it animates to open/closed status. |
89 static bool disable_animations_during_testing_; | 89 static bool disable_animations_during_testing_; |
90 | 90 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 scoped_ptr<views::Widget> host_; | 182 scoped_ptr<views::Widget> host_; |
183 | 183 |
184 // A flag to manually manage visibility. GTK/X11 is asynchronous and | 184 // A flag to manually manage visibility. GTK/X11 is asynchronous and |
185 // the state of the widget can be out of sync. | 185 // the state of the widget can be out of sync. |
186 bool is_visible_; | 186 bool is_visible_; |
187 | 187 |
188 DISALLOW_COPY_AND_ASSIGN(DropdownBarHost); | 188 DISALLOW_COPY_AND_ASSIGN(DropdownBarHost); |
189 }; | 189 }; |
190 | 190 |
191 #endif // CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_HOST_H_ | 191 #endif // CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_HOST_H_ |
OLD | NEW |