| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete.h" | 10 #include "chrome/browser/autocomplete/autocomplete.h" |
| 11 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 11 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 // Calculates the height needed to show all the results in the model. | 82 // Calculates the height needed to show all the results in the model. |
| 83 virtual int CalculatePopupHeight(); | 83 virtual int CalculatePopupHeight(); |
| 84 virtual AutocompleteResultView* CreateResultView( | 84 virtual AutocompleteResultView* CreateResultView( |
| 85 AutocompleteResultViewModel* model, | 85 AutocompleteResultViewModel* model, |
| 86 int model_index, | 86 int model_index, |
| 87 const gfx::Font& font, | 87 const gfx::Font& font, |
| 88 const gfx::Font& bold_font); | 88 const gfx::Font& bold_font); |
| 89 | 89 |
| 90 // Overridden from views::View: | 90 // Overridden from views::View: |
| 91 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 91 virtual void OnPaint(gfx::CanvasSkia* canvas) OVERRIDE; |
| 92 // This method should not be triggered directly as we paint our children | 92 // This method should not be triggered directly as we paint our children |
| 93 // in an un-conventional way inside OnPaint. We use a separate canvas to | 93 // in an un-conventional way inside OnPaint. We use a separate canvas to |
| 94 // paint the children. Hence we override this method to a no-op so that | 94 // paint the children. Hence we override this method to a no-op so that |
| 95 // the view hierarchy does not "accidentally" trigger this. | 95 // the view hierarchy does not "accidentally" trigger this. |
| 96 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; | 96 virtual void PaintChildren(gfx::CanvasSkia* canvas) OVERRIDE; |
| 97 | 97 |
| 98 scoped_ptr<AutocompletePopupModel> model_; | 98 scoped_ptr<AutocompletePopupModel> model_; |
| 99 | 99 |
| 100 // The "Opt-in to Instant" promo view, if there is one. | 100 // The "Opt-in to Instant" promo view, if there is one. |
| 101 views::View* opt_in_view_; | 101 views::View* opt_in_view_; |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 class AutocompletePopupWidget; | 104 class AutocompletePopupWidget; |
| 105 class InstantOptInView; | 105 class InstantOptInView; |
| 106 | 106 |
| 107 // Returns true if the model has a match at the specified index. | 107 // Returns true if the model has a match at the specified index. |
| 108 bool HasMatchAt(size_t index) const; | 108 bool HasMatchAt(size_t index) const; |
| 109 | 109 |
| 110 // Returns the match at the specified index within the popup model. | 110 // Returns the match at the specified index within the popup model. |
| 111 const AutocompleteMatch& GetMatchAtIndex(size_t index) const; | 111 const AutocompleteMatch& GetMatchAtIndex(size_t index) const; |
| 112 | 112 |
| 113 // Fill a path for the contents' roundrect. |bounding_rect| is the rect that | 113 // Fill a path for the contents' roundrect. |bounding_rect| is the rect that |
| 114 // bounds the path. | 114 // bounds the path. |
| 115 void MakeContentsPath(gfx::Path* path, const gfx::Rect& bounding_rect); | 115 void MakeContentsPath(gfx::Path* path, const gfx::Rect& bounding_rect); |
| 116 | 116 |
| 117 // Updates the window's blur region for the current size. | 117 // Updates the window's blur region for the current size. |
| 118 void UpdateBlurRegion(); | 118 void UpdateBlurRegion(); |
| 119 | 119 |
| 120 // Makes the contents of the canvas slightly transparent. | 120 // Makes the contents of the canvas slightly transparent. |
| 121 void MakeCanvasTransparent(gfx::Canvas* canvas); | 121 void MakeCanvasTransparent(gfx::CanvasSkia* canvas); |
| 122 | 122 |
| 123 // Called when the line at the specified index should be opened with the | 123 // Called when the line at the specified index should be opened with the |
| 124 // provided disposition. | 124 // provided disposition. |
| 125 void OpenIndex(size_t index, WindowOpenDisposition disposition); | 125 void OpenIndex(size_t index, WindowOpenDisposition disposition); |
| 126 | 126 |
| 127 // Find the index of the match under the given |point|, specified in window | 127 // Find the index of the match under the given |point|, specified in window |
| 128 // coordinates. Returns AutocompletePopupModel::kNoMatch if there isn't a | 128 // coordinates. Returns AutocompletePopupModel::kNoMatch if there isn't a |
| 129 // match at the specified point. | 129 // match at the specified point. |
| 130 size_t GetIndexForPoint(const gfx::Point& point); | 130 size_t GetIndexForPoint(const gfx::Point& point); |
| 131 | 131 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // The popup sizes vertically using an animation when the popup is getting | 171 // The popup sizes vertically using an animation when the popup is getting |
| 172 // shorter (not larger, that makes it look "slow"). | 172 // shorter (not larger, that makes it look "slow"). |
| 173 ui::SlideAnimation size_animation_; | 173 ui::SlideAnimation size_animation_; |
| 174 gfx::Rect start_bounds_; | 174 gfx::Rect start_bounds_; |
| 175 gfx::Rect target_bounds_; | 175 gfx::Rect target_bounds_; |
| 176 | 176 |
| 177 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView); | 177 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView); |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 #endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW
_H_ | 180 #endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW
_H_ |
| OLD | NEW |