| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "app/animation_delegate.h" | |
| 10 #include "app/slide_animation.h" | |
| 11 #include "chrome/browser/autocomplete/autocomplete.h" | 9 #include "chrome/browser/autocomplete/autocomplete.h" |
| 12 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 10 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| 13 #include "chrome/browser/autocomplete/autocomplete_popup_view.h" | 11 #include "chrome/browser/autocomplete/autocomplete_popup_view.h" |
| 14 #include "gfx/font.h" | 12 #include "gfx/font.h" |
| 13 #include "ui/base/animation/animation_delegate.h" |
| 14 #include "ui/base/animation/slide_animation.h" |
| 15 #include "views/view.h" | 15 #include "views/view.h" |
| 16 #include "webkit/glue/window_open_disposition.h" | 16 #include "webkit/glue/window_open_disposition.h" |
| 17 | 17 |
| 18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
| 19 #include "chrome/browser/views/autocomplete/autocomplete_popup_win.h" | 19 #include "chrome/browser/views/autocomplete/autocomplete_popup_win.h" |
| 20 #else | 20 #else |
| 21 #include "chrome/browser/views/autocomplete/autocomplete_popup_gtk.h" | 21 #include "chrome/browser/views/autocomplete/autocomplete_popup_gtk.h" |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 class AutocompleteEditModel; | 24 class AutocompleteEditModel; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 // Returns the special-case icon we should use for the given index, or NULL | 40 // Returns the special-case icon we should use for the given index, or NULL |
| 41 // if we should use the default icon. | 41 // if we should use the default icon. |
| 42 virtual const SkBitmap* GetSpecialIcon(size_t index) const = 0; | 42 virtual const SkBitmap* GetSpecialIcon(size_t index) const = 0; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 // A view representing the contents of the autocomplete popup. | 45 // A view representing the contents of the autocomplete popup. |
| 46 class AutocompletePopupContentsView : public views::View, | 46 class AutocompletePopupContentsView : public views::View, |
| 47 public AutocompleteResultViewModel, | 47 public AutocompleteResultViewModel, |
| 48 public AutocompletePopupView, | 48 public AutocompletePopupView, |
| 49 public AnimationDelegate { | 49 public ui::AnimationDelegate { |
| 50 public: | 50 public: |
| 51 AutocompletePopupContentsView(const gfx::Font& font, | 51 AutocompletePopupContentsView(const gfx::Font& font, |
| 52 AutocompleteEditView* edit_view, | 52 AutocompleteEditView* edit_view, |
| 53 AutocompleteEditModel* edit_model, | 53 AutocompleteEditModel* edit_model, |
| 54 Profile* profile, | 54 Profile* profile, |
| 55 const views::View* location_bar); | 55 const views::View* location_bar); |
| 56 virtual ~AutocompletePopupContentsView(); | 56 virtual ~AutocompletePopupContentsView(); |
| 57 | 57 |
| 58 // Returns the bounds the popup should be shown at. This is the display bounds | 58 // Returns the bounds the popup should be shown at. This is the display bounds |
| 59 // and includes offsets for the dropshadow which this view's border renders. | 59 // and includes offsets for the dropshadow which this view's border renders. |
| 60 gfx::Rect GetPopupBounds() const; | 60 gfx::Rect GetPopupBounds() const; |
| 61 | 61 |
| 62 // Overridden from AutocompletePopupView: | 62 // Overridden from AutocompletePopupView: |
| 63 virtual bool IsOpen() const; | 63 virtual bool IsOpen() const; |
| 64 virtual void InvalidateLine(size_t line); | 64 virtual void InvalidateLine(size_t line); |
| 65 virtual void UpdatePopupAppearance(); | 65 virtual void UpdatePopupAppearance(); |
| 66 virtual gfx::Rect GetTargetBounds(); | 66 virtual gfx::Rect GetTargetBounds(); |
| 67 virtual void PaintUpdatesNow(); | 67 virtual void PaintUpdatesNow(); |
| 68 virtual void OnDragCanceled(); | 68 virtual void OnDragCanceled(); |
| 69 virtual AutocompletePopupModel* GetModel(); | 69 virtual AutocompletePopupModel* GetModel(); |
| 70 | 70 |
| 71 // Overridden from AutocompleteResultViewModel: | 71 // Overridden from AutocompleteResultViewModel: |
| 72 virtual bool IsSelectedIndex(size_t index) const; | 72 virtual bool IsSelectedIndex(size_t index) const; |
| 73 virtual bool IsHoveredIndex(size_t index) const; | 73 virtual bool IsHoveredIndex(size_t index) const; |
| 74 virtual const SkBitmap* GetSpecialIcon(size_t index) const; | 74 virtual const SkBitmap* GetSpecialIcon(size_t index) const; |
| 75 | 75 |
| 76 // Overridden from AnimationDelegate: | 76 // Overridden from ui::AnimationDelegate: |
| 77 virtual void AnimationProgressed(const Animation* animation); | 77 virtual void AnimationProgressed(const ui::Animation* animation); |
| 78 | 78 |
| 79 // Overridden from views::View: | 79 // Overridden from views::View: |
| 80 virtual void Paint(gfx::Canvas* canvas); | 80 virtual void Paint(gfx::Canvas* canvas); |
| 81 virtual void PaintChildren(gfx::Canvas* canvas) { | 81 virtual void PaintChildren(gfx::Canvas* canvas) { |
| 82 // We paint our children inside Paint(). | 82 // We paint our children inside Paint(). |
| 83 } | 83 } |
| 84 virtual void Layout(); | 84 virtual void Layout(); |
| 85 virtual void OnMouseEntered(const views::MouseEvent& event); | 85 virtual void OnMouseEntered(const views::MouseEvent& event); |
| 86 virtual void OnMouseMoved(const views::MouseEvent& event); | 86 virtual void OnMouseMoved(const views::MouseEvent& event); |
| 87 virtual void OnMouseExited(const views::MouseEvent& event); | 87 virtual void OnMouseExited(const views::MouseEvent& event); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // If the user cancels a dragging action (i.e. by pressing ESC), we don't have | 158 // If the user cancels a dragging action (i.e. by pressing ESC), we don't have |
| 159 // a convenient way to release mouse capture. Instead we use this flag to | 159 // a convenient way to release mouse capture. Instead we use this flag to |
| 160 // simply ignore all remaining drag events, and the eventual mouse release | 160 // simply ignore all remaining drag events, and the eventual mouse release |
| 161 // event. Since OnDragCanceled() can be called when we're not dragging, this | 161 // event. Since OnDragCanceled() can be called when we're not dragging, this |
| 162 // flag is reset to false on a mouse pressed event, to make sure we don't | 162 // flag is reset to false on a mouse pressed event, to make sure we don't |
| 163 // erroneously ignore the next drag. | 163 // erroneously ignore the next drag. |
| 164 bool ignore_mouse_drag_; | 164 bool ignore_mouse_drag_; |
| 165 | 165 |
| 166 // The popup sizes vertically using an animation when the popup is getting | 166 // The popup sizes vertically using an animation when the popup is getting |
| 167 // shorter (not larger, that makes it look "slow"). | 167 // shorter (not larger, that makes it look "slow"). |
| 168 SlideAnimation size_animation_; | 168 ui::SlideAnimation size_animation_; |
| 169 gfx::Rect start_bounds_; | 169 gfx::Rect start_bounds_; |
| 170 gfx::Rect target_bounds_; | 170 gfx::Rect target_bounds_; |
| 171 | 171 |
| 172 // If non-NULL the instant opt-in-view is visible. | 172 // If non-NULL the instant opt-in-view is visible. |
| 173 views::View* opt_in_view_; | 173 views::View* opt_in_view_; |
| 174 | 174 |
| 175 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView); | 175 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView); |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 #endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW
_H_ | 178 #endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW
_H_ |
| OLD | NEW |