| 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 15 matching lines...) Expand all Loading... |
| 68 // Moves the widget to the provided location, moves it to top | 68 // Moves the widget to the provided location, moves it to top |
| 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 FocusWillChange(views::View* focused_before, | 74 virtual void FocusWillChange(views::View* focused_before, |
| 75 views::View* focused_now); | 75 views::View* focused_now); |
| 76 | 76 |
| 77 // Overridden from views::AcceleratorTarget: | 77 // Overridden from views::AcceleratorTarget: |
| 78 virtual bool AcceleratorPressed(const views::Accelerator& accelerator) = 0; | 78 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) = 0; |
| 79 | 79 |
| 80 // ui::AnimationDelegate implementation: | 80 // ui::AnimationDelegate implementation: |
| 81 virtual void AnimationProgressed(const ui::Animation* animation); | 81 virtual void AnimationProgressed(const ui::Animation* animation); |
| 82 virtual void AnimationEnded(const ui::Animation* animation); | 82 virtual void AnimationEnded(const ui::Animation* animation); |
| 83 | 83 |
| 84 // During testing we can disable animations by setting this flag to true, | 84 // During testing we can disable animations by setting this flag to true, |
| 85 // so that opening and closing the dropdown bar is shown instantly, instead of | 85 // so that opening and closing the dropdown bar is shown instantly, instead of |
| 86 // having to poll it while it animates to open/closed status. | 86 // having to poll it while it animates to open/closed status. |
| 87 static bool disable_animations_during_testing_; | 87 static bool disable_animations_during_testing_; |
| 88 | 88 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 scoped_ptr<views::Widget> host_; | 180 scoped_ptr<views::Widget> host_; |
| 181 | 181 |
| 182 // A flag to manually manage visibility. GTK/X11 is asynchronous and | 182 // A flag to manually manage visibility. GTK/X11 is asynchronous and |
| 183 // the state of the widget can be out of sync. | 183 // the state of the widget can be out of sync. |
| 184 bool is_visible_; | 184 bool is_visible_; |
| 185 | 185 |
| 186 DISALLOW_COPY_AND_ASSIGN(DropdownBarHost); | 186 DISALLOW_COPY_AND_ASSIGN(DropdownBarHost); |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 #endif // CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_HOST_H_ | 189 #endif // CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_HOST_H_ |
| OLD | NEW |