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

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

Issue 10384007: First stab at touch optimized omnibox auto-complete per sgabriel's mocks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 8 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.cc
diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
index 1954346ec3501afa314c194caa583947b4b084d5..ee560b0820d903844dfb54bb0d0a05ab76ceb295 100644
--- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
+++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
@@ -18,10 +18,12 @@
#include "chrome/browser/ui/omnibox/omnibox_view.h"
#include "chrome/browser/ui/views/autocomplete/autocomplete_result_view.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
+#include "chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "third_party/skia/include/core/SkShader.h"
+#include "ui/base/layout.h"
Peter Kasting 2012/05/04 23:33:31 Nit: I think this goes below the next #include?
Jói 2012/05/07 16:26:18 Fixed here and checked other files to be sure ther
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/theme_provider.h"
@@ -77,6 +79,28 @@ class AutocompletePopupContentsView::AutocompletePopupWidget
////////////////////////////////////////////////////////////////////////////////
// AutocompletePopupContentsView, public:
+AutocompletePopupContentsView*
+AutocompletePopupContentsView::CreateForEnvironment(
Peter Kasting 2012/05/04 23:33:31 Nit: Indent 4
Jói 2012/05/07 16:26:18 Done.
+ const gfx::Font& font,
+ OmniboxView* omnibox_view,
+ AutocompleteEditModel* edit_model,
+ views::View* location_bar) {
+ AutocompletePopupContentsView* view = NULL;
+ switch (ui::GetDisplayLayout()) {
Peter Kasting 2012/05/04 23:33:31 Nit: Use if/else rather than switch
Jói 2012/05/07 16:26:18 Done.
+ case ui::LAYOUT_TOUCH:
+ view = new TouchAutocompletePopupContentsView(
+ font, omnibox_view, edit_model, location_bar);
+ break;
+
+ default:
+ view = new AutocompletePopupContentsView(
+ font, omnibox_view, edit_model, location_bar);
+ }
+
+ view->Init();
+ return view;
+}
+
AutocompletePopupContentsView::AutocompletePopupContentsView(
const gfx::Font& font,
OmniboxView* omnibox_view,
@@ -99,7 +123,12 @@ AutocompletePopupContentsView::AutocompletePopupContentsView(
set_border(bubble_border);
// The contents is owned by the LocationBarView.
set_parent_owned(false);
+}
+void AutocompletePopupContentsView::Init() {
+ // This can't be done in the constructor as at that point we aren't
+ // necessarily our final class yet, and we may have subclasses
+ // overriding CreateResultView.
for (size_t i = 0; i < AutocompleteResult::kMaxMatches; ++i) {
AutocompleteResultView* result_view =
CreateResultView(this, i, result_font_, result_bold_font_);

Powered by Google App Engine
This is Rietveld 408576698