Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h

Issue 2543473005: Draw omnibox shadow with a ninebox layer.
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 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_OMNIBOX_OMNIBOX_POPUP_CONTENTS_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_POPUP_CONTENTS_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_POPUP_CONTENTS_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_POPUP_CONTENTS_VIEW_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 gfx::Rect GetTargetBounds() override; 51 gfx::Rect GetTargetBounds() override;
52 void PaintUpdatesNow() override; 52 void PaintUpdatesNow() override;
53 void OnDragCanceled() override; 53 void OnDragCanceled() override;
54 54
55 // gfx::AnimationDelegate: 55 // gfx::AnimationDelegate:
56 void AnimationProgressed(const gfx::Animation* animation) override; 56 void AnimationProgressed(const gfx::Animation* animation) override;
57 57
58 // views::View: 58 // views::View:
59 void Layout() override; 59 void Layout() override;
60 views::View* GetTooltipHandlerForPoint(const gfx::Point& point) override; 60 views::View* GetTooltipHandlerForPoint(const gfx::Point& point) override;
61 void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
61 bool OnMousePressed(const ui::MouseEvent& event) override; 62 bool OnMousePressed(const ui::MouseEvent& event) override;
62 bool OnMouseDragged(const ui::MouseEvent& event) override; 63 bool OnMouseDragged(const ui::MouseEvent& event) override;
63 void OnMouseReleased(const ui::MouseEvent& event) override; 64 void OnMouseReleased(const ui::MouseEvent& event) override;
64 void OnMouseCaptureLost() override; 65 void OnMouseCaptureLost() override;
65 void OnMouseMoved(const ui::MouseEvent& event) override; 66 void OnMouseMoved(const ui::MouseEvent& event) override;
66 void OnMouseEntered(const ui::MouseEvent& event) override; 67 void OnMouseEntered(const ui::MouseEvent& event) override;
67 void OnMouseExited(const ui::MouseEvent& event) override; 68 void OnMouseExited(const ui::MouseEvent& event) override;
68 void OnGestureEvent(ui::GestureEvent* event) override; 69 void OnGestureEvent(ui::GestureEvent* event) override;
69 70
70 bool IsSelectedIndex(size_t index) const; 71 bool IsSelectedIndex(size_t index) const;
(...skipping 15 matching lines...) Expand all
86 // Calculates the height needed to show all the results in the model. 87 // Calculates the height needed to show all the results in the model.
87 virtual int CalculatePopupHeight(); 88 virtual int CalculatePopupHeight();
88 virtual OmniboxResultView* CreateResultView(int model_index, 89 virtual OmniboxResultView* CreateResultView(int model_index,
89 const gfx::FontList& font_list); 90 const gfx::FontList& font_list);
90 91
91 private: 92 private:
92 class AutocompletePopupWidget; 93 class AutocompletePopupWidget;
93 94
94 // views::View: 95 // views::View:
95 const char* GetClassName() const override; 96 const char* GetClassName() const override;
96 void OnPaint(gfx::Canvas* canvas) override;
97 void PaintChildren(const ui::PaintContext& context) override; 97 void PaintChildren(const ui::PaintContext& context) override;
98 98
99 // views::ViewTargeterDelegate: 99 // views::ViewTargeterDelegate:
100 views::View* TargetForRect(views::View* root, const gfx::Rect& rect) override; 100 views::View* TargetForRect(views::View* root, const gfx::Rect& rect) override;
101 101
102 // Call immediately after construction. 102 // Call immediately after construction.
103 void Init(); 103 void Init();
104 104
105 // 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.
106 bool HasMatchAt(size_t index) const; 106 bool HasMatchAt(size_t index) const;
(...skipping 27 matching lines...) Expand all
134 base::WeakPtr<AutocompletePopupWidget> popup_; 134 base::WeakPtr<AutocompletePopupWidget> popup_;
135 135
136 // The edit view that invokes us. 136 // The edit view that invokes us.
137 OmniboxView* omnibox_view_; 137 OmniboxView* omnibox_view_;
138 138
139 LocationBarView* location_bar_view_; 139 LocationBarView* location_bar_view_;
140 140
141 // The font list used for result rows, based on the omnibox font list. 141 // The font list used for result rows, based on the omnibox font list.
142 gfx::FontList font_list_; 142 gfx::FontList font_list_;
143 143
144 // The ninebox layer that draws a drop shadow above and below the popup.
145 std::unique_ptr<ui::Layer> shadow_layer_;
146
144 // If the user cancels a dragging action (i.e. by pressing ESC), we don't have 147 // If the user cancels a dragging action (i.e. by pressing ESC), we don't have
145 // a convenient way to release mouse capture. Instead we use this flag to 148 // a convenient way to release mouse capture. Instead we use this flag to
146 // simply ignore all remaining drag events, and the eventual mouse release 149 // simply ignore all remaining drag events, and the eventual mouse release
147 // event. Since OnDragCanceled() can be called when we're not dragging, this 150 // event. Since OnDragCanceled() can be called when we're not dragging, this
148 // flag is reset to false on a mouse pressed event, to make sure we don't 151 // flag is reset to false on a mouse pressed event, to make sure we don't
149 // erroneously ignore the next drag. 152 // erroneously ignore the next drag.
150 bool ignore_mouse_drag_; 153 bool ignore_mouse_drag_;
151 154
152 // The popup sizes vertically using an animation when the popup is getting 155 // The popup sizes vertically using an animation when the popup is getting
153 // shorter (not larger, that makes it look "slow"). 156 // shorter (not larger, that makes it look "slow").
154 gfx::SlideAnimation size_animation_; 157 gfx::SlideAnimation size_animation_;
155 gfx::Rect start_bounds_; 158 gfx::Rect start_bounds_;
156 gfx::Rect target_bounds_; 159 gfx::Rect target_bounds_;
157 160
158 int start_margin_; 161 int start_margin_;
159 int end_margin_; 162 int end_margin_;
160 163
161 // When the dropdown is not wide enough while displaying postfix suggestions, 164 // When the dropdown is not wide enough while displaying postfix suggestions,
162 // we use the width of widest match contents to shift the suggestions so that 165 // we use the width of widest match contents to shift the suggestions so that
163 // the widest suggestion just reaches the end edge. 166 // the widest suggestion just reaches the end edge.
164 int max_match_contents_width_; 167 int max_match_contents_width_;
165 168
166 DISALLOW_COPY_AND_ASSIGN(OmniboxPopupContentsView); 169 DISALLOW_COPY_AND_ASSIGN(OmniboxPopupContentsView);
167 }; 170 };
168 171
169 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_POPUP_CONTENTS_VIEW_H_ 172 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_POPUP_CONTENTS_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698