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

Unified Diff: chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h

Issue 6349101: Create a new autocomplete popup for touch. This CL depends on (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: merged changes from refactoring CL Created 9 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h
diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h
index b1af5e32df18fc3f93952b85ae14cd27c640cb7e..3653b221e95535d177983eacd7c88ff9bd943cb8 100644
--- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h
+++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h
@@ -9,9 +9,10 @@
#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/autocomplete/autocomplete_popup_model.h"
#include "chrome/browser/autocomplete/autocomplete_popup_view.h"
+#include "chrome/browser/ui/views/autocomplete/autocomplete_result_view.h"
#include "ui/base/animation/animation_delegate.h"
#include "ui/base/animation/slide_animation.h"
-#include "ui/gfx/font.h"
+#include "ui/gfx/canvas_skia.h"
#include "views/view.h"
#include "webkit/glue/window_open_disposition.h"
@@ -27,20 +28,9 @@ struct AutocompleteMatch;
class BubbleBorder;
class Profile;
-// An interface implemented by an object that provides data to populate
-// individual result views.
-class AutocompleteResultViewModel {
- public:
- // Returns true if the index is selected.
- virtual bool IsSelectedIndex(size_t index) const = 0;
-
- // Returns true if the index is hovered.
- virtual bool IsHoveredIndex(size_t index) const = 0;
-
- // Returns the special-case icon we should use for the given index, or NULL
- // if we should use the default icon.
- virtual const SkBitmap* GetSpecialIcon(size_t index) const = 0;
-};
+namespace gfx {
+class Insets;
+}
// A view representing the contents of the autocomplete popup.
class AutocompletePopupContentsView : public views::View,
@@ -55,6 +45,9 @@ class AutocompletePopupContentsView : public views::View,
const views::View* location_bar);
virtual ~AutocompletePopupContentsView();
+ AutocompletePopupModel* model() { return model_.get(); }
Peter Kasting 2011/02/16 00:50:35 Do we need these public accessors? Wouldn't simpl
varunjain 2011/02/16 18:48:10 Done.
+ views::View* opt_in_view() { return opt_in_view_; }
+
// Returns the bounds the popup should be shown at. This is the display bounds
// and includes offsets for the dropshadow which this view's border renders.
gfx::Rect GetPopupBounds() const;
@@ -78,10 +71,9 @@ class AutocompletePopupContentsView : public views::View,
// Overridden from views::View:
virtual void Paint(gfx::Canvas* canvas);
- virtual void PaintChildren(gfx::Canvas* canvas) {
- // We paint our children inside Paint().
- }
+ virtual void PaintChildren(gfx::CanvasSkia* canvas);
virtual void Layout();
+ virtual void LayoutChildren();
virtual void OnMouseEntered(const views::MouseEvent& event);
virtual void OnMouseMoved(const views::MouseEvent& event);
virtual void OnMouseExited(const views::MouseEvent& event);
@@ -90,6 +82,15 @@ class AutocompletePopupContentsView : public views::View,
virtual bool OnMouseDragged(const views::MouseEvent& event);
virtual views::View* GetViewForPoint(const gfx::Point& point);
+ protected:
+ // Calculates the height needed to show all the results in the model.
+ virtual int CalculatePopupHeight();
+ virtual AutocompleteResultView* CreateResultView(
+ AutocompleteResultViewModel* model,
+ int model_index,
+ const gfx::Font& font,
+ const gfx::Font& bold_font);
+
private:
#if defined(OS_WIN)
typedef AutocompletePopupWin AutocompletePopupClass;

Powered by Google App Engine
This is Rietveld 408576698