| 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_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 "chrome/browser/autocomplete/autocomplete.h" | 9 #include "chrome/browser/autocomplete/autocomplete.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 10 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| 11 #include "chrome/browser/autocomplete/autocomplete_popup_view.h" | 11 #include "chrome/browser/autocomplete/autocomplete_popup_view.h" |
| 12 #include "chrome/browser/ui/views/autocomplete/autocomplete_result_view_model.h" | 12 #include "chrome/browser/ui/views/autocomplete/autocomplete_result_view_model.h" |
| 13 #include "ui/base/animation/animation_delegate.h" | 13 #include "ui/base/animation/animation_delegate.h" |
| 14 #include "ui/base/animation/slide_animation.h" | 14 #include "ui/base/animation/slide_animation.h" |
| 15 #include "ui/gfx/font.h" | 15 #include "ui/gfx/font.h" |
| 16 #include "views/view.h" | 16 #include "views/view.h" |
| 17 #include "webkit/glue/window_open_disposition.h" | 17 #include "webkit/glue/window_open_disposition.h" |
| 18 | 18 |
| 19 #if defined(OS_WIN) | |
| 20 #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_win.h" | |
| 21 #elif defined(TOOLKIT_USES_GTK) | |
| 22 #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_gtk.h" | |
| 23 #endif | |
| 24 | |
| 25 class AutocompleteEditModel; | 19 class AutocompleteEditModel; |
| 26 struct AutocompleteMatch; | 20 struct AutocompleteMatch; |
| 27 class AutocompleteResultView; | 21 class AutocompleteResultView; |
| 28 class BubbleBorder; | 22 class BubbleBorder; |
| 29 class Profile; | 23 class Profile; |
| 30 | 24 |
| 31 namespace gfx { | 25 namespace gfx { |
| 32 class CanvasSkia; | 26 class CanvasSkia; |
| 33 class Insets; | 27 class Insets; |
| 34 } | 28 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // paint the children. Hence we override this method to a no-op so that | 92 // paint the children. Hence we override this method to a no-op so that |
| 99 // the view hierarchy does not "accidentally" trigger this. | 93 // the view hierarchy does not "accidentally" trigger this. |
| 100 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; | 94 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; |
| 101 | 95 |
| 102 scoped_ptr<AutocompletePopupModel> model_; | 96 scoped_ptr<AutocompletePopupModel> model_; |
| 103 | 97 |
| 104 // The "Opt-in to Instant" promo view, if there is one. | 98 // The "Opt-in to Instant" promo view, if there is one. |
| 105 views::View* opt_in_view_; | 99 views::View* opt_in_view_; |
| 106 | 100 |
| 107 private: | 101 private: |
| 108 #if defined(OS_WIN) | 102 class AutocompletePopupWidget; |
| 109 typedef AutocompletePopupWin AutocompletePopupClass; | |
| 110 #elif defined(TOOLKIT_USES_GTK) | |
| 111 typedef AutocompletePopupGtk AutocompletePopupClass; | |
| 112 #endif | |
| 113 class InstantOptInView; | 103 class InstantOptInView; |
| 114 | 104 |
| 115 // Returns true if the model has a match at the specified index. | 105 // Returns true if the model has a match at the specified index. |
| 116 bool HasMatchAt(size_t index) const; | 106 bool HasMatchAt(size_t index) const; |
| 117 | 107 |
| 118 // Returns the match at the specified index within the popup model. | 108 // Returns the match at the specified index within the popup model. |
| 119 const AutocompleteMatch& GetMatchAtIndex(size_t index) const; | 109 const AutocompleteMatch& GetMatchAtIndex(size_t index) const; |
| 120 | 110 |
| 121 // Fill a path for the contents' roundrect. |bounding_rect| is the rect that | 111 // Fill a path for the contents' roundrect. |bounding_rect| is the rect that |
| 122 // bounds the path. | 112 // bounds the path. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 141 gfx::Rect CalculateTargetBounds(int h); | 131 gfx::Rect CalculateTargetBounds(int h); |
| 142 | 132 |
| 143 // Invoked if the user clicks on one of the opt-in buttons. Removes the opt-in | 133 // Invoked if the user clicks on one of the opt-in buttons. Removes the opt-in |
| 144 // view. | 134 // view. |
| 145 void UserPressedOptIn(bool opt_in); | 135 void UserPressedOptIn(bool opt_in); |
| 146 | 136 |
| 147 // The popup that contains this view. We create this, but it deletes itself | 137 // The popup that contains this view. We create this, but it deletes itself |
| 148 // when its window is destroyed. This is a WeakPtr because it's possible for | 138 // when its window is destroyed. This is a WeakPtr because it's possible for |
| 149 // the OS to destroy the window and thus delete this object before we're | 139 // the OS to destroy the window and thus delete this object before we're |
| 150 // deleted, or without our knowledge. | 140 // deleted, or without our knowledge. |
| 151 base::WeakPtr<AutocompletePopupClass> popup_; | 141 base::WeakPtr<AutocompletePopupWidget> popup_; |
| 152 | 142 |
| 153 // The edit view that invokes us. | 143 // The edit view that invokes us. |
| 154 OmniboxView* omnibox_view_; | 144 OmniboxView* omnibox_view_; |
| 155 | 145 |
| 156 // An object that the popup positions itself against. | 146 // An object that the popup positions itself against. |
| 157 const views::View* location_bar_; | 147 const views::View* location_bar_; |
| 158 | 148 |
| 159 // Our border, which can compute our desired bounds. | 149 // Our border, which can compute our desired bounds. |
| 160 const BubbleBorder* bubble_border_; | 150 const BubbleBorder* bubble_border_; |
| 161 | 151 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 177 // The popup sizes vertically using an animation when the popup is getting | 167 // The popup sizes vertically using an animation when the popup is getting |
| 178 // shorter (not larger, that makes it look "slow"). | 168 // shorter (not larger, that makes it look "slow"). |
| 179 ui::SlideAnimation size_animation_; | 169 ui::SlideAnimation size_animation_; |
| 180 gfx::Rect start_bounds_; | 170 gfx::Rect start_bounds_; |
| 181 gfx::Rect target_bounds_; | 171 gfx::Rect target_bounds_; |
| 182 | 172 |
| 183 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView); | 173 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView); |
| 184 }; | 174 }; |
| 185 | 175 |
| 186 #endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW
_H_ | 176 #endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW
_H_ |
| OLD | NEW |