summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.h70
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.cc4
-rw-r--r--chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc (renamed from chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc)148
-rw-r--r--chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h (renamed from chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h)38
-rw-r--r--chrome/browser/ui/views/omnibox/omnibox_result_view.cc (renamed from chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc)70
-rw-r--r--chrome/browser/ui/views/omnibox/omnibox_result_view.h (renamed from chrome/browser/ui/views/autocomplete/autocomplete_result_view.h)26
-rw-r--r--chrome/browser/ui/views/omnibox/omnibox_result_view_model.h (renamed from chrome/browser/ui/views/autocomplete/autocomplete_result_view_model.h)10
-rw-r--r--chrome/browser/ui/views/omnibox/omnibox_view_views.cc6
-rw-r--r--chrome/browser/ui/views/omnibox/omnibox_view_win.cc2
-rw-r--r--chrome/browser/ui/views/omnibox/omnibox_view_win.h2
-rw-r--r--chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.cc (renamed from chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.cc)63
-rw-r--r--chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h70
-rw-r--r--chrome/chrome_browser.gypi14
13 files changed, 256 insertions, 267 deletions
diff --git a/chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.h b/chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.h
deleted file mode 100644
index 1767289..0000000
--- a/chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_TOUCH_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_
-#define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_TOUCH_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_
-#pragma once
-
-#include "base/compiler_specific.h"
-#include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h"
-#include "chrome/browser/ui/views/autocomplete/autocomplete_result_view.h"
-
-class AutocompleteEditModel;
-class OmniboxView;
-
-namespace gfx {
-class Canvas;
-}
-
-namespace views {
-class View;
-}
-
-class TouchAutocompleteResultView : public AutocompleteResultView {
- public:
- TouchAutocompleteResultView(AutocompleteResultViewModel* model,
- int model_index,
- const gfx::Font& font,
- const gfx::Font& bold_font);
-
- private:
- virtual ~TouchAutocompleteResultView();
-
- // AutocompleteResultView:
- virtual void PaintMatch(gfx::Canvas* canvas,
- const AutocompleteMatch& match,
- int x) OVERRIDE;
- virtual int GetTextHeight() const OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(TouchAutocompleteResultView);
-};
-
-class TouchAutocompletePopupContentsView
- : public AutocompletePopupContentsView {
- public:
- TouchAutocompletePopupContentsView(const gfx::Font& font,
- OmniboxView* omnibox_view,
- AutocompleteEditModel* edit_model,
- views::View* location_bar);
- virtual ~TouchAutocompletePopupContentsView();
-
- // AutocompletePopupContentsView:
- virtual void UpdatePopupAppearance() OVERRIDE;
-
- protected:
- // AutocompletePopupContentsView:
- virtual void PaintResultViews(gfx::Canvas* canvas) OVERRIDE;
- virtual AutocompleteResultView* CreateResultView(
- AutocompleteResultViewModel* model,
- int model_index,
- const gfx::Font& font,
- const gfx::Font& bold_font) OVERRIDE;
-
- private:
- std::vector<View*> GetVisibleChildren();
-
- DISALLOW_COPY_AND_ASSIGN(TouchAutocompletePopupContentsView);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_TOUCH_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index c7f1a31..971d7728 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -43,8 +43,8 @@
#include "chrome/browser/ui/views/location_bar/selected_keyword_view.h"
#include "chrome/browser/ui/views/location_bar/star_view.h"
#include "chrome/browser/ui/views/location_bar/suggested_text_view.h"
-#include "chrome/browser/ui/views/omnibox/omnibox_views.h"
#include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
+#include "chrome/browser/ui/views/omnibox/omnibox_views.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_switch_utils.h"
@@ -806,7 +806,7 @@ void LocationBarView::OnPaint(gfx::Canvas* canvas) {
// TODO(pkasting): We need images that are transparent in the middle, so we
// can draw the border images over the background color instead of the
// reverse; this antialiases better (see comments in
- // AutocompletePopupContentsView::OnPaint()).
+ // OmniboxPopupContentsView::OnPaint()).
gfx::Rect bounds(GetContentsBounds());
bounds.Inset(0, kVerticalEdgeThickness);
SkColor color(GetColor(ToolbarModel::NONE, BACKGROUND));
diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
index 7ab2c25..79cc6c2 100644
--- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h"
+#include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h"
#if defined(OS_WIN)
#include <commctrl.h>
@@ -16,9 +16,9 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/themes/theme_service.h"
#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 "chrome/browser/ui/views/omnibox/omnibox_result_view.h"
+#include "chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
@@ -65,7 +65,7 @@ const int kEditFontAdjust = -1;
} // namespace
-class AutocompletePopupContentsView::AutocompletePopupWidget
+class OmniboxPopupContentsView::AutocompletePopupWidget
: public views::Widget,
public base::SupportsWeakPtr<AutocompletePopupWidget> {
public:
@@ -77,20 +77,19 @@ class AutocompletePopupContentsView::AutocompletePopupWidget
};
////////////////////////////////////////////////////////////////////////////////
-// AutocompletePopupContentsView, public:
-
-AutocompletePopupContentsView*
- AutocompletePopupContentsView::CreateForEnvironment(
- const gfx::Font& font,
- OmniboxView* omnibox_view,
- AutocompleteEditModel* edit_model,
- views::View* location_bar) {
- AutocompletePopupContentsView* view = NULL;
+// OmniboxPopupContentsView, public:
+
+OmniboxPopupContentsView* OmniboxPopupContentsView::CreateForEnvironment(
+ const gfx::Font& font,
+ OmniboxView* omnibox_view,
+ AutocompleteEditModel* edit_model,
+ views::View* location_bar) {
+ OmniboxPopupContentsView* view = NULL;
if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) {
- view = new TouchAutocompletePopupContentsView(
+ view = new TouchOmniboxPopupContentsView(
font, omnibox_view, edit_model, location_bar);
} else {
- view = new AutocompletePopupContentsView(
+ view = new OmniboxPopupContentsView(
font, omnibox_view, edit_model, location_bar);
}
@@ -98,7 +97,7 @@ AutocompletePopupContentsView*
return view;
}
-AutocompletePopupContentsView::AutocompletePopupContentsView(
+OmniboxPopupContentsView::OmniboxPopupContentsView(
const gfx::Font& font,
OmniboxView* omnibox_view,
AutocompleteEditModel* edit_model,
@@ -122,25 +121,25 @@ AutocompletePopupContentsView::AutocompletePopupContentsView(
set_owned_by_client();
}
-void AutocompletePopupContentsView::Init() {
+void OmniboxPopupContentsView::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 =
+ OmniboxResultView* result_view =
CreateResultView(this, i, result_font_, result_bold_font_);
result_view->SetVisible(false);
AddChildViewAt(result_view, static_cast<int>(i));
}
}
-AutocompletePopupContentsView::~AutocompletePopupContentsView() {
+OmniboxPopupContentsView::~OmniboxPopupContentsView() {
// We don't need to do anything with |popup_| here. The OS either has already
// closed the window, in which case it's been deleted, or it will soon, in
// which case there's nothing we need to do.
}
-gfx::Rect AutocompletePopupContentsView::GetPopupBounds() const {
+gfx::Rect OmniboxPopupContentsView::GetPopupBounds() const {
if (!size_animation_.is_animating())
return target_bounds_;
@@ -156,7 +155,7 @@ gfx::Rect AutocompletePopupContentsView::GetPopupBounds() const {
return current_frame_bounds;
}
-void AutocompletePopupContentsView::LayoutChildren() {
+void OmniboxPopupContentsView::LayoutChildren() {
gfx::Rect contents_rect = GetContentsBounds();
int top = contents_rect.y();
for (int i = 0; i < child_count(); ++i) {
@@ -170,14 +169,14 @@ void AutocompletePopupContentsView::LayoutChildren() {
}
////////////////////////////////////////////////////////////////////////////////
-// AutocompletePopupContentsView, AutocompletePopupView overrides:
+// OmniboxPopupContentsView, AutocompletePopupView overrides:
-bool AutocompletePopupContentsView::IsOpen() const {
- return (popup_ != NULL);
+bool OmniboxPopupContentsView::IsOpen() const {
+ return popup_ != NULL;
}
-void AutocompletePopupContentsView::InvalidateLine(size_t line) {
- AutocompleteResultView* result = static_cast<AutocompleteResultView*>(
+void OmniboxPopupContentsView::InvalidateLine(size_t line) {
+ OmniboxResultView* result = static_cast<OmniboxResultView*>(
child_at(static_cast<int>(line)));
result->Invalidate();
@@ -187,7 +186,7 @@ void AutocompletePopupContentsView::InvalidateLine(size_t line) {
}
}
-void AutocompletePopupContentsView::UpdatePopupAppearance() {
+void OmniboxPopupContentsView::UpdatePopupAppearance() {
if (model_->result().empty()) {
// No matches, close any existing popup.
if (popup_ != NULL) {
@@ -208,8 +207,7 @@ void AutocompletePopupContentsView::UpdatePopupAppearance() {
size_t child_rv_count = child_count();
const size_t result_size = model_->result().size();
for (size_t i = 0; i < result_size; ++i) {
- AutocompleteResultView* view = static_cast<AutocompleteResultView*>(
- child_at(i));
+ OmniboxResultView* view = static_cast<OmniboxResultView*>(child_at(i));
view->SetMatch(GetMatchAtIndex(i));
view->SetVisible(true);
}
@@ -267,30 +265,30 @@ void AutocompletePopupContentsView::UpdatePopupAppearance() {
SchedulePaint();
}
-gfx::Rect AutocompletePopupContentsView::GetTargetBounds() {
+gfx::Rect OmniboxPopupContentsView::GetTargetBounds() {
return target_bounds_;
}
-void AutocompletePopupContentsView::PaintUpdatesNow() {
+void OmniboxPopupContentsView::PaintUpdatesNow() {
// TODO(beng): remove this from the interface.
}
-void AutocompletePopupContentsView::OnDragCanceled() {
+void OmniboxPopupContentsView::OnDragCanceled() {
ignore_mouse_drag_ = true;
}
////////////////////////////////////////////////////////////////////////////////
-// AutocompletePopupContentsView, AutocompleteResultViewModel implementation:
+// OmniboxPopupContentsView, OmniboxResultViewModel implementation:
-bool AutocompletePopupContentsView::IsSelectedIndex(size_t index) const {
+bool OmniboxPopupContentsView::IsSelectedIndex(size_t index) const {
return index == model_->selected_line();
}
-bool AutocompletePopupContentsView::IsHoveredIndex(size_t index) const {
+bool OmniboxPopupContentsView::IsHoveredIndex(size_t index) const {
return index == model_->hovered_line();
}
-const SkBitmap* AutocompletePopupContentsView::GetIconIfExtensionMatch(
+const SkBitmap* OmniboxPopupContentsView::GetIconIfExtensionMatch(
size_t index) const {
if (!HasMatchAt(index))
return NULL;
@@ -298,9 +296,9 @@ const SkBitmap* AutocompletePopupContentsView::GetIconIfExtensionMatch(
}
////////////////////////////////////////////////////////////////////////////////
-// AutocompletePopupContentsView, AnimationDelegate implementation:
+// OmniboxPopupContentsView, AnimationDelegate implementation:
-void AutocompletePopupContentsView::AnimationProgressed(
+void OmniboxPopupContentsView::AnimationProgressed(
const ui::Animation* animation) {
// We should only be running the animation when the popup is already visible.
DCHECK(popup_ != NULL);
@@ -308,9 +306,9 @@ void AutocompletePopupContentsView::AnimationProgressed(
}
////////////////////////////////////////////////////////////////////////////////
-// AutocompletePopupContentsView, views::View overrides:
+// OmniboxPopupContentsView, views::View overrides:
-void AutocompletePopupContentsView::Layout() {
+void OmniboxPopupContentsView::Layout() {
UpdateBlurRegion();
// Size our children to the available content area.
@@ -321,12 +319,12 @@ void AutocompletePopupContentsView::Layout() {
SchedulePaint();
}
-views::View* AutocompletePopupContentsView::GetEventHandlerForPoint(
+views::View* OmniboxPopupContentsView::GetEventHandlerForPoint(
const gfx::Point& point) {
return this;
}
-bool AutocompletePopupContentsView::OnMousePressed(
+bool OmniboxPopupContentsView::OnMousePressed(
const views::MouseEvent& event) {
ignore_mouse_drag_ = false; // See comment on |ignore_mouse_drag_| in header.
if (event.IsLeftMouseButton() || event.IsMiddleMouseButton())
@@ -334,14 +332,14 @@ bool AutocompletePopupContentsView::OnMousePressed(
return true;
}
-bool AutocompletePopupContentsView::OnMouseDragged(
+bool OmniboxPopupContentsView::OnMouseDragged(
const views::MouseEvent& event) {
if (event.IsLeftMouseButton() || event.IsMiddleMouseButton())
UpdateLineEvent(event, !ignore_mouse_drag_ && event.IsLeftMouseButton());
return true;
}
-void AutocompletePopupContentsView::OnMouseReleased(
+void OmniboxPopupContentsView::OnMouseReleased(
const views::MouseEvent& event) {
if (ignore_mouse_drag_) {
OnMouseCaptureLost();
@@ -354,26 +352,26 @@ void AutocompletePopupContentsView::OnMouseReleased(
}
}
-void AutocompletePopupContentsView::OnMouseCaptureLost() {
+void OmniboxPopupContentsView::OnMouseCaptureLost() {
ignore_mouse_drag_ = false;
}
-void AutocompletePopupContentsView::OnMouseMoved(
+void OmniboxPopupContentsView::OnMouseMoved(
const views::MouseEvent& event) {
model_->SetHoveredLine(GetIndexForPoint(event.location()));
}
-void AutocompletePopupContentsView::OnMouseEntered(
+void OmniboxPopupContentsView::OnMouseEntered(
const views::MouseEvent& event) {
model_->SetHoveredLine(GetIndexForPoint(event.location()));
}
-void AutocompletePopupContentsView::OnMouseExited(
+void OmniboxPopupContentsView::OnMouseExited(
const views::MouseEvent& event) {
model_->SetHoveredLine(AutocompletePopupModel::kNoMatch);
}
-ui::GestureStatus AutocompletePopupContentsView::OnGestureEvent(
+ui::GestureStatus OmniboxPopupContentsView::OnGestureEvent(
const views::GestureEvent& event) {
switch (event.type()) {
case ui::ET_GESTURE_TAP_DOWN:
@@ -392,15 +390,15 @@ ui::GestureStatus AutocompletePopupContentsView::OnGestureEvent(
}
////////////////////////////////////////////////////////////////////////////////
-// AutocompletePopupContentsView, protected:
+// OmniboxPopupContentsView, protected:
-void AutocompletePopupContentsView::PaintResultViews(gfx::Canvas* canvas) {
- canvas->DrawColor(AutocompleteResultView::GetColor(
- AutocompleteResultView::NORMAL, AutocompleteResultView::BACKGROUND));
+void OmniboxPopupContentsView::PaintResultViews(gfx::Canvas* canvas) {
+ canvas->DrawColor(OmniboxResultView::GetColor(
+ OmniboxResultView::NORMAL, OmniboxResultView::BACKGROUND));
View::PaintChildren(canvas);
}
-int AutocompletePopupContentsView::CalculatePopupHeight() {
+int OmniboxPopupContentsView::CalculatePopupHeight() {
DCHECK_GE(static_cast<size_t>(child_count()), model_->result().size());
int popup_height = 0;
for (size_t i = 0; i < model_->result().size(); ++i)
@@ -408,18 +406,18 @@ int AutocompletePopupContentsView::CalculatePopupHeight() {
return popup_height;
}
-AutocompleteResultView* AutocompletePopupContentsView::CreateResultView(
- AutocompleteResultViewModel* model,
+OmniboxResultView* OmniboxPopupContentsView::CreateResultView(
+ OmniboxResultViewModel* model,
int model_index,
const gfx::Font& font,
const gfx::Font& bold_font) {
- return new AutocompleteResultView(model, model_index, font, bold_font);
+ return new OmniboxResultView(model, model_index, font, bold_font);
}
////////////////////////////////////////////////////////////////////////////////
-// AutocompletePopupContentsView, views::View overrides, protected:
+// OmniboxPopupContentsView, views::View overrides, protected:
-void AutocompletePopupContentsView::OnPaint(gfx::Canvas* canvas) {
+void OmniboxPopupContentsView::OnPaint(gfx::Canvas* canvas) {
gfx::Path path;
MakeContentsPath(&path, GetContentsBounds());
canvas->Save();
@@ -441,23 +439,23 @@ void AutocompletePopupContentsView::OnPaint(gfx::Canvas* canvas) {
OnPaintBorder(canvas);
}
-void AutocompletePopupContentsView::PaintChildren(gfx::Canvas* canvas) {
+void OmniboxPopupContentsView::PaintChildren(gfx::Canvas* canvas) {
// We paint our children inside OnPaint().
}
////////////////////////////////////////////////////////////////////////////////
-// AutocompletePopupContentsView, private:
+// OmniboxPopupContentsView, private:
-bool AutocompletePopupContentsView::HasMatchAt(size_t index) const {
+bool OmniboxPopupContentsView::HasMatchAt(size_t index) const {
return index < model_->result().size();
}
-const AutocompleteMatch& AutocompletePopupContentsView::GetMatchAtIndex(
+const AutocompleteMatch& OmniboxPopupContentsView::GetMatchAtIndex(
size_t index) const {
return model_->result().match_at(index);
}
-void AutocompletePopupContentsView::MakeContentsPath(
+void OmniboxPopupContentsView::MakeContentsPath(
gfx::Path* path,
const gfx::Rect& bounding_rect) {
SkRect rect;
@@ -470,7 +468,7 @@ void AutocompletePopupContentsView::MakeContentsPath(
path->addRoundRect(rect, radius, radius);
}
-void AutocompletePopupContentsView::UpdateBlurRegion() {
+void OmniboxPopupContentsView::UpdateBlurRegion() {
#if defined(OS_WIN) && !defined(USE_AURA)
// We only support background blurring on Vista with Aero-Glass enabled.
if (!views::NativeWidgetWin::IsAeroGlassEnabled() || !GetWidget())
@@ -494,19 +492,17 @@ void AutocompletePopupContentsView::UpdateBlurRegion() {
#endif
}
-void AutocompletePopupContentsView::MakeCanvasTransparent(
- gfx::Canvas* canvas) {
+void OmniboxPopupContentsView::MakeCanvasTransparent(gfx::Canvas* canvas) {
// Allow the window blur effect to show through the popup background.
SkAlpha alpha = GetThemeProvider()->ShouldUseNativeFrame() ?
kGlassPopupAlpha : kOpaquePopupAlpha;
canvas->DrawColor(SkColorSetA(
- AutocompleteResultView::GetColor(AutocompleteResultView::NORMAL,
- AutocompleteResultView::BACKGROUND), alpha), SkXfermode::kDstIn_Mode);
+ OmniboxResultView::GetColor(OmniboxResultView::NORMAL,
+ OmniboxResultView::BACKGROUND), alpha), SkXfermode::kDstIn_Mode);
}
-void AutocompletePopupContentsView::OpenIndex(
- size_t index,
- WindowOpenDisposition disposition) {
+void OmniboxPopupContentsView::OpenIndex(size_t index,
+ WindowOpenDisposition disposition) {
if (!HasMatchAt(index))
return;
@@ -517,7 +513,7 @@ void AutocompletePopupContentsView::OpenIndex(
omnibox_view_->OpenMatch(match, disposition, GURL(), index);
}
-size_t AutocompletePopupContentsView::GetIndexForPoint(
+size_t OmniboxPopupContentsView::GetIndexForPoint(
const gfx::Point& point) {
if (!HitTest(point))
return AutocompletePopupModel::kNoMatch;
@@ -534,7 +530,7 @@ size_t AutocompletePopupContentsView::GetIndexForPoint(
return AutocompletePopupModel::kNoMatch;
}
-gfx::Rect AutocompletePopupContentsView::CalculateTargetBounds(int h) {
+gfx::Rect OmniboxPopupContentsView::CalculateTargetBounds(int h) {
gfx::Rect location_bar_bounds(location_bar_->GetContentsBounds());
const views::Border* border = location_bar_->border();
if (border) {
@@ -557,7 +553,7 @@ gfx::Rect AutocompletePopupContentsView::CalculateTargetBounds(int h) {
location_bar_bounds, gfx::Size(location_bar_bounds.width(), h));
}
-void AutocompletePopupContentsView::UpdateLineEvent(
+void OmniboxPopupContentsView::UpdateLineEvent(
const views::LocatedEvent& event,
bool should_set_selected_line) {
size_t index = GetIndexForPoint(event.location());
@@ -566,7 +562,7 @@ void AutocompletePopupContentsView::UpdateLineEvent(
model_->SetSelectedLine(index, false, false);
}
-void AutocompletePopupContentsView::OpenSelectedLine(
+void OmniboxPopupContentsView::OpenSelectedLine(
const views::LocatedEvent& event,
WindowOpenDisposition disposition) {
size_t index = GetIndexForPoint(event.location());
diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h
index a8f89cb..d1e58eb 100644
--- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h
+++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h
@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_
-#define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_
+#ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_POPUP_CONTENTS_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_POPUP_CONTENTS_VIEW_H_
#pragma once
#include "base/memory/weak_ptr.h"
#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_model.h"
+#include "chrome/browser/ui/views/omnibox/omnibox_result_view_model.h"
#include "ui/base/animation/animation_delegate.h"
#include "ui/base/animation/slide_animation.h"
#include "ui/gfx/font.h"
@@ -19,7 +19,7 @@
class AutocompleteEditModel;
struct AutocompleteMatch;
-class AutocompleteResultView;
+class OmniboxResultView;
class Profile;
namespace views {
@@ -27,14 +27,14 @@ class BubbleBorder;
}
// A view representing the contents of the autocomplete popup.
-class AutocompletePopupContentsView : public views::View,
- public AutocompleteResultViewModel,
- public AutocompletePopupView,
- public ui::AnimationDelegate {
+class OmniboxPopupContentsView : public views::View,
+ public OmniboxResultViewModel,
+ public AutocompletePopupView,
+ public ui::AnimationDelegate {
public:
// Creates the appropriate type of omnibox dropdown for the
// current environment, e.g. desktop vs. touch optimized layout.
- static AutocompletePopupContentsView* CreateForEnvironment(
+ static OmniboxPopupContentsView* CreateForEnvironment(
const gfx::Font& font,
OmniboxView* omnibox_view,
AutocompleteEditModel* edit_model,
@@ -54,7 +54,7 @@ class AutocompletePopupContentsView : public views::View,
virtual void PaintUpdatesNow() OVERRIDE;
virtual void OnDragCanceled() OVERRIDE;
- // Overridden from AutocompleteResultViewModel:
+ // Overridden from OmniboxResultViewModel:
virtual bool IsSelectedIndex(size_t index) const OVERRIDE;
virtual bool IsHoveredIndex(size_t index) const OVERRIDE;
virtual const SkBitmap* GetIconIfExtensionMatch(size_t index) const OVERRIDE;
@@ -77,18 +77,18 @@ class AutocompletePopupContentsView : public views::View,
const views::GestureEvent& event) OVERRIDE;
protected:
- AutocompletePopupContentsView(const gfx::Font& font,
- OmniboxView* omnibox_view,
- AutocompleteEditModel* edit_model,
- views::View* location_bar);
- virtual ~AutocompletePopupContentsView();
+ OmniboxPopupContentsView(const gfx::Font& font,
+ OmniboxView* omnibox_view,
+ AutocompleteEditModel* edit_model,
+ views::View* location_bar);
+ virtual ~OmniboxPopupContentsView();
virtual void PaintResultViews(gfx::Canvas* canvas);
// Calculates the height needed to show all the results in the model.
virtual int CalculatePopupHeight();
- virtual AutocompleteResultView* CreateResultView(
- AutocompleteResultViewModel* model,
+ virtual OmniboxResultView* CreateResultView(
+ OmniboxResultViewModel* model,
int model_index,
const gfx::Font& font,
const gfx::Font& bold_font);
@@ -185,7 +185,7 @@ class AutocompletePopupContentsView : public views::View,
gfx::Rect start_bounds_;
gfx::Rect target_bounds_;
- DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView);
+ DISALLOW_COPY_AND_ASSIGN(OmniboxPopupContentsView);
};
-#endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_
+#endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_POPUP_CONTENTS_VIEW_H_
diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
index 5558f48..e989109 100644
--- a/chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
@@ -9,14 +9,14 @@
#include <atlwin.h> // NOLINT
#endif
-#include "chrome/browser/ui/views/autocomplete/autocomplete_result_view.h"
+#include "chrome/browser/ui/views/omnibox/omnibox_result_view.h"
#include <algorithm> // NOLINT
#include "base/i18n/bidi_line_iterator.h"
#include "chrome/browser/autocomplete/autocomplete_popup_model.h"
-#include "chrome/browser/ui/views/autocomplete/autocomplete_result_view_model.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
+#include "chrome/browser/ui/views/omnibox/omnibox_result_view_model.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h"
@@ -38,11 +38,11 @@ const int kMinimumTextVerticalPadding = 3;
} // namespace
////////////////////////////////////////////////////////////////////////////////
-// AutocompleteResultView, public:
+// OmniboxResultView, public:
// Precalculated data used to draw the portion of a match classification that
// fits entirely within one run.
-struct AutocompleteResultView::ClassificationData {
+struct OmniboxResultView::ClassificationData {
string16 text;
const gfx::Font* font;
SkColor color;
@@ -52,7 +52,7 @@ struct AutocompleteResultView::ClassificationData {
// Precalculated data used to draw a complete visual run within the match.
// This will include all or part of at leasdt one, and possibly several,
// classifications.
-struct AutocompleteResultView::RunData {
+struct OmniboxResultView::RunData {
size_t run_start; // Offset within the match text where this run begins.
int visual_order; // Where this run occurs in visual order. The earliest
// run drawn is run 0.
@@ -66,7 +66,7 @@ struct AutocompleteResultView::RunData {
// view is horizontally mirrored. The drawing functions can be written as if
// all drawing occurs left-to-right, and then use this class to get the actual
// coordinates to begin drawing onscreen.
-class AutocompleteResultView::MirroringContext {
+class OmniboxResultView::MirroringContext {
public:
MirroringContext() : center_(0), right_(0) {}
@@ -98,8 +98,8 @@ class AutocompleteResultView::MirroringContext {
DISALLOW_COPY_AND_ASSIGN(MirroringContext);
};
-AutocompleteResultView::AutocompleteResultView(
- AutocompleteResultViewModel* model,
+OmniboxResultView::OmniboxResultView(
+ OmniboxResultViewModel* model,
int model_index,
const gfx::Font& font,
const gfx::Font& bold_font)
@@ -128,12 +128,11 @@ AutocompleteResultView::AutocompleteResultView(
keyword_icon_->SizeToPreferredSize();
}
-AutocompleteResultView::~AutocompleteResultView() {
+OmniboxResultView::~OmniboxResultView() {
}
// static
-SkColor AutocompleteResultView::GetColor(ResultViewState state,
- ColorKind kind) {
+SkColor OmniboxResultView::GetColor(ResultViewState state, ColorKind kind) {
static bool initialized = false;
static SkColor colors[NUM_STATES][NUM_KINDS];
if (!initialized) {
@@ -187,7 +186,7 @@ SkColor AutocompleteResultView::GetColor(ResultViewState state,
return colors[state][kind];
}
-void AutocompleteResultView::SetMatch(const AutocompleteMatch& match) {
+void OmniboxResultView::SetMatch(const AutocompleteMatch& match) {
match_ = match;
animation_->Reset();
@@ -203,37 +202,36 @@ void AutocompleteResultView::SetMatch(const AutocompleteMatch& match) {
Layout();
}
-void AutocompleteResultView::ShowKeyword(bool show_keyword) {
+void OmniboxResultView::ShowKeyword(bool show_keyword) {
if (show_keyword)
animation_->Show();
else
animation_->Hide();
}
-void AutocompleteResultView::Invalidate() {
+void OmniboxResultView::Invalidate() {
keyword_icon_->SetImage(GetKeywordIcon());
SchedulePaint();
}
-gfx::Size AutocompleteResultView::GetPreferredSize() {
+gfx::Size OmniboxResultView::GetPreferredSize() {
return gfx::Size(0, std::max(
default_icon_size_ + (kMinimumIconVerticalPadding * 2),
GetTextHeight() + (minimum_text_vertical_padding_ * 2)));
}
////////////////////////////////////////////////////////////////////////////////
-// AutocompleteResultView, protected:
+// OmniboxResultView, protected:
-AutocompleteResultView::ResultViewState
- AutocompleteResultView::GetState() const {
+OmniboxResultView::ResultViewState OmniboxResultView::GetState() const {
if (model_->IsSelectedIndex(model_index_))
return SELECTED;
return model_->IsHoveredIndex(model_index_) ? HOVERED : NORMAL;
}
-void AutocompleteResultView::PaintMatch(gfx::Canvas* canvas,
- const AutocompleteMatch& match,
- int x) {
+void OmniboxResultView::PaintMatch(gfx::Canvas* canvas,
+ const AutocompleteMatch& match,
+ int x) {
x = DrawString(canvas, match.contents, match.contents_class, false, x,
text_bounds_.y());
@@ -257,26 +255,26 @@ void AutocompleteResultView::PaintMatch(gfx::Canvas* canvas,
}
}
-int AutocompleteResultView::GetTextHeight() const {
+int OmniboxResultView::GetTextHeight() const {
return std::max(normal_font_.GetHeight(), bold_font_.GetHeight());
}
// static
-bool AutocompleteResultView::SortRunsLogically(const RunData& lhs,
- const RunData& rhs) {
+bool OmniboxResultView::SortRunsLogically(const RunData& lhs,
+ const RunData& rhs) {
return lhs.run_start < rhs.run_start;
}
// static
-bool AutocompleteResultView::SortRunsVisually(const RunData& lhs,
- const RunData& rhs) {
+bool OmniboxResultView::SortRunsVisually(const RunData& lhs,
+ const RunData& rhs) {
return lhs.visual_order < rhs.visual_order;
}
// static
-int AutocompleteResultView::default_icon_size_ = 0;
+int OmniboxResultView::default_icon_size_ = 0;
-const SkBitmap* AutocompleteResultView::GetIcon() const {
+const SkBitmap* OmniboxResultView::GetIcon() const {
const SkBitmap* bitmap = model_->GetIconIfExtensionMatch(model_index_);
if (bitmap)
return bitmap;
@@ -305,14 +303,14 @@ const SkBitmap* AutocompleteResultView::GetIcon() const {
return ui::ResourceBundle::GetSharedInstance().GetBitmapNamed(icon);
}
-const gfx::ImageSkia* AutocompleteResultView::GetKeywordIcon() const {
+const gfx::ImageSkia* OmniboxResultView::GetKeywordIcon() const {
// NOTE: If we ever begin returning icons of varying size, then callers need
// to ensure that |keyword_icon_| is resized each time its image is reset.
return ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
(GetState() == SELECTED) ? IDR_OMNIBOX_TTS_SELECTED : IDR_OMNIBOX_TTS);
}
-int AutocompleteResultView::DrawString(
+int OmniboxResultView::DrawString(
gfx::Canvas* canvas,
const string16& text,
const ACMatchClassifications& classifications,
@@ -480,7 +478,7 @@ int AutocompleteResultView::DrawString(
return x;
}
-void AutocompleteResultView::Elide(Runs* runs, int remaining_width) const {
+void OmniboxResultView::Elide(Runs* runs, int remaining_width) const {
// The complexity of this function is due to edge cases like the following:
// We have 100 px of available space, an initial classification that takes 86
// px, and a font that has a 15 px wide ellipsis character. Now if the first
@@ -568,7 +566,7 @@ void AutocompleteResultView::Elide(Runs* runs, int remaining_width) const {
runs->clear();
}
-void AutocompleteResultView::Layout() {
+void OmniboxResultView::Layout() {
const SkBitmap* icon = GetIcon();
icon_bounds_.SetRect(edge_item_padding_ +
@@ -601,12 +599,11 @@ void AutocompleteResultView::Layout() {
std::max(text_width, 0), text_height);
}
-void AutocompleteResultView::OnBoundsChanged(
- const gfx::Rect& previous_bounds) {
+void OmniboxResultView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
animation_->SetSlideDuration(width() / 4);
}
-void AutocompleteResultView::OnPaint(gfx::Canvas* canvas) {
+void OmniboxResultView::OnPaint(gfx::Canvas* canvas) {
const ResultViewState state = GetState();
if (state != NORMAL)
canvas->DrawColor(GetColor(state, BACKGROUND));
@@ -631,8 +628,7 @@ void AutocompleteResultView::OnPaint(gfx::Canvas* canvas) {
}
}
-void AutocompleteResultView::AnimationProgressed(
- const ui::Animation* animation) {
+void OmniboxResultView::AnimationProgressed(const ui::Animation* animation) {
Layout();
SchedulePaint();
}
diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_result_view.h b/chrome/browser/ui/views/omnibox/omnibox_result_view.h
index 29e3d90..454a99f 100644
--- a/chrome/browser/ui/views/autocomplete/autocomplete_result_view.h
+++ b/chrome/browser/ui/views/omnibox/omnibox_result_view.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_
-#define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_
+#ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_
#pragma once
#include "chrome/browser/autocomplete/autocomplete_match.h"
@@ -15,14 +15,14 @@
#include "ui/views/controls/image_view.h"
#include "ui/views/view.h"
-class AutocompleteResultViewModel;
+class OmniboxResultViewModel;
namespace gfx {
class Canvas;
}
-class AutocompleteResultView : public views::View,
- private ui::AnimationDelegate {
+class OmniboxResultView : public views::View,
+ private ui::AnimationDelegate {
public:
// Keep these ordered from least dominant (normal) to most dominant
// (selected).
@@ -42,11 +42,11 @@ class AutocompleteResultView : public views::View,
NUM_KINDS
};
- AutocompleteResultView(AutocompleteResultViewModel* model,
- int model_index,
- const gfx::Font& font,
- const gfx::Font& bold_font);
- virtual ~AutocompleteResultView();
+ OmniboxResultView(OmniboxResultViewModel* model,
+ int model_index,
+ const gfx::Font& font,
+ const gfx::Font& bold_font);
+ virtual ~OmniboxResultView();
static SkColor GetColor(ResultViewState state, ColorKind kind);
@@ -138,7 +138,7 @@ class AutocompleteResultView : public views::View,
int minimum_text_vertical_padding_;
// This row's model and model index.
- AutocompleteResultViewModel* model_;
+ OmniboxResultViewModel* model_;
size_t model_index_;
const gfx::Font normal_font_;
@@ -161,7 +161,7 @@ class AutocompleteResultView : public views::View,
scoped_ptr<ui::SlideAnimation> animation_;
- DISALLOW_COPY_AND_ASSIGN(AutocompleteResultView);
+ DISALLOW_COPY_AND_ASSIGN(OmniboxResultView);
};
-#endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_
+#endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_
diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_result_view_model.h b/chrome/browser/ui/views/omnibox/omnibox_result_view_model.h
index fabea18..18cd7a4 100644
--- a/chrome/browser/ui/views/autocomplete/autocomplete_result_view_model.h
+++ b/chrome/browser/ui/views/omnibox/omnibox_result_view_model.h
@@ -1,16 +1,16 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_MODEL_H_
-#define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_MODEL_H_
+#ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_MODEL_H_
+#define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_MODEL_H_
#pragma once
class SkBitmap;
// An interface implemented by an object that provides data to populate
// individual result views.
-class AutocompleteResultViewModel {
+class OmniboxResultViewModel {
public:
// Returns true if the index is selected.
virtual bool IsSelectedIndex(size_t index) const = 0;
@@ -23,4 +23,4 @@ class AutocompleteResultViewModel {
virtual const SkBitmap* GetIconIfExtensionMatch(size_t index) const = 0;
};
-#endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_MODEL_H_
+#endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_MODEL_H_
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
index 80638f4..433bf6b 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
-#include "base/property_bag.h"
#include "base/logging.h"
+#include "base/property_bag.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
@@ -15,8 +15,8 @@
#include "chrome/browser/bookmarks/bookmark_node_data.h"
#include "chrome/browser/command_updater.h"
#include "chrome/browser/ui/view_ids.h"
-#include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
+#include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h"
#include "content/public/browser/web_contents.h"
#include "googleurl/src/gurl.h"
#include "grit/app_locale_settings.h"
@@ -229,7 +229,7 @@ void OmniboxViewViews::Init() {
// Create popup view using the same font as |textfield_|'s.
popup_view_.reset(
- AutocompletePopupContentsView::CreateForEnvironment(
+ OmniboxPopupContentsView::CreateForEnvironment(
textfield_->font(), this, model_.get(), location_bar_view_));
const int vertical_margin = !popup_window_mode_ ?
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
index 6a00d16..415bb72 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
@@ -441,7 +441,7 @@ OmniboxViewWin::OmniboxViewWin(AutocompleteEditController* controller,
views::View* location_bar)
: model_(new AutocompleteEditModel(this, controller,
parent_view->profile())),
- popup_view_(AutocompletePopupContentsView::CreateForEnvironment(
+ popup_view_(OmniboxPopupContentsView::CreateForEnvironment(
parent_view->font(), this, model_.get(), location_bar)),
controller_(controller),
parent_view_(parent_view),
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.h b/chrome/browser/ui/views/omnibox/omnibox_view_win.h
index 579816e..019aa41 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_win.h
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.h
@@ -19,7 +19,7 @@
#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/ui/omnibox/omnibox_view.h"
#include "chrome/browser/ui/toolbar/toolbar_model.h"
-#include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h"
+#include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h"
#include "ui/base/models/simple_menu_model.h"
#include "ui/base/win/extra_sdk_defines.h"
#include "ui/gfx/font.h"
diff --git a/chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.cc
index 6b1af64..a0f855f 100644
--- a/chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.cc
+++ b/chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.h"
+#include "chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h"
#include "chrome/browser/ui/omnibox/omnibox_view.h"
#include "third_party/skia/include/core/SkPaint.h"
@@ -13,66 +13,65 @@
#include "ui/gfx/size.h"
#include "ui/views/view.h"
-// TouchAutocompleteResultView ------------------------------------------------
+// TouchOmniboxResultView ------------------------------------------------
-TouchAutocompleteResultView::TouchAutocompleteResultView(
- AutocompleteResultViewModel* model,
+TouchOmniboxResultView::TouchOmniboxResultView(
+ OmniboxResultViewModel* model,
int model_index,
const gfx::Font& font,
const gfx::Font& bold_font)
- : AutocompleteResultView(model, model_index, font, bold_font) {
+ : OmniboxResultView(model, model_index, font, bold_font) {
set_edge_item_padding(8);
set_item_padding(8);
set_minimum_text_vertical_padding(10);
}
-TouchAutocompleteResultView::~TouchAutocompleteResultView() {
+TouchOmniboxResultView::~TouchOmniboxResultView() {
}
-void TouchAutocompleteResultView::PaintMatch(gfx::Canvas* canvas,
- const AutocompleteMatch& match,
- int x) {
+void TouchOmniboxResultView::PaintMatch(gfx::Canvas* canvas,
+ const AutocompleteMatch& match,
+ int x) {
int y = text_bounds().y();
if (!match.description.empty()) {
// We use our base class's GetTextHeight below because we need the height
// of a single line of text.
DrawString(canvas, match.description, match.description_class, true, x, y);
- y += AutocompleteResultView::GetTextHeight();
+ y += OmniboxResultView::GetTextHeight();
} else {
// When we have only one line of content (no description), we center the
// single line vertically on our two-lines-tall results box.
- y += AutocompleteResultView::GetTextHeight() / 2;
+ y += OmniboxResultView::GetTextHeight() / 2;
}
DrawString(canvas, match.contents, match.contents_class, false, x, y);
}
-int TouchAutocompleteResultView::GetTextHeight() const {
- return AutocompleteResultView::GetTextHeight() * 2;
+int TouchOmniboxResultView::GetTextHeight() const {
+ return OmniboxResultView::GetTextHeight() * 2;
}
-// TouchAutocompletePopupContentsView -----------------------------------------
+// TouchOmniboxPopupContentsView -----------------------------------------
-TouchAutocompletePopupContentsView::TouchAutocompletePopupContentsView(
+TouchOmniboxPopupContentsView::TouchOmniboxPopupContentsView(
const gfx::Font& font,
OmniboxView* omnibox_view,
AutocompleteEditModel* edit_model,
views::View* location_bar)
- : AutocompletePopupContentsView(font, omnibox_view, edit_model,
- location_bar) {
+ : OmniboxPopupContentsView(font, omnibox_view, edit_model, location_bar) {
}
-TouchAutocompletePopupContentsView::~TouchAutocompletePopupContentsView() {
+TouchOmniboxPopupContentsView::~TouchOmniboxPopupContentsView() {
}
-void TouchAutocompletePopupContentsView::UpdatePopupAppearance() {
- AutocompletePopupContentsView::UpdatePopupAppearance();
+void TouchOmniboxPopupContentsView::UpdatePopupAppearance() {
+ OmniboxPopupContentsView::UpdatePopupAppearance();
Layout();
}
-void TouchAutocompletePopupContentsView::PaintResultViews(gfx::Canvas* canvas) {
- AutocompletePopupContentsView::PaintResultViews(canvas);
+void TouchOmniboxPopupContentsView::PaintResultViews(gfx::Canvas* canvas) {
+ OmniboxPopupContentsView::PaintResultViews(canvas);
// Draw divider lines.
std::vector<View*> visible_children(GetVisibleChildren());
@@ -86,29 +85,27 @@ void TouchAutocompletePopupContentsView::PaintResultViews(gfx::Canvas* canvas) {
// i.e. selected > hovered > normal.
for (std::vector<View*>::const_iterator i(visible_children.begin());
i + 1 != visible_children.end(); ++i) {
- TouchAutocompleteResultView* child =
- static_cast<TouchAutocompleteResultView*>(*i);
- TouchAutocompleteResultView* next_child =
- static_cast<TouchAutocompleteResultView*>(*(i + 1));
- SkColor divider_color = AutocompleteResultView::GetColor(
+ TouchOmniboxResultView* child = static_cast<TouchOmniboxResultView*>(*i);
+ TouchOmniboxResultView* next_child =
+ static_cast<TouchOmniboxResultView*>(*(i + 1));
+ SkColor divider_color = OmniboxResultView::GetColor(
std::max(child->GetState(), next_child->GetState()),
- AutocompleteResultView::DIVIDER);
+ OmniboxResultView::DIVIDER);
int line_y = child->y() + child->height() - 1;
canvas->DrawLine(gfx::Point(bounds.x(), line_y),
gfx::Point(bounds.right(), line_y), divider_color);
}
}
-AutocompleteResultView* TouchAutocompletePopupContentsView::CreateResultView(
- AutocompleteResultViewModel* model,
+OmniboxResultView* TouchOmniboxPopupContentsView::CreateResultView(
+ OmniboxResultViewModel* model,
int model_index,
const gfx::Font& font,
const gfx::Font& bold_font) {
- return new TouchAutocompleteResultView(model, model_index, font, bold_font);
+ return new TouchOmniboxResultView(model, model_index, font, bold_font);
}
-std::vector<views::View*>
- TouchAutocompletePopupContentsView::GetVisibleChildren() {
+std::vector<views::View*> TouchOmniboxPopupContentsView::GetVisibleChildren() {
std::vector<View*> visible_children;
for (int i = 0; i < child_count(); ++i) {
View* v = child_at(i);
diff --git a/chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h b/chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h
new file mode 100644
index 0000000..35f7cf4
--- /dev/null
+++ b/chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h
@@ -0,0 +1,70 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_TOUCH_OMNIBOX_POPUP_CONTENTS_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_OMNIBOX_TOUCH_OMNIBOX_POPUP_CONTENTS_VIEW_H_
+#pragma once
+
+#include "base/compiler_specific.h"
+#include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h"
+#include "chrome/browser/ui/views/omnibox/omnibox_result_view.h"
+
+class AutocompleteEditModel;
+class OmniboxView;
+
+namespace gfx {
+class Canvas;
+}
+
+namespace views {
+class View;
+}
+
+class TouchOmniboxResultView : public OmniboxResultView {
+ public:
+ TouchOmniboxResultView(OmniboxResultViewModel* model,
+ int model_index,
+ const gfx::Font& font,
+ const gfx::Font& bold_font);
+
+ private:
+ virtual ~TouchOmniboxResultView();
+
+ // OmniboxResultView:
+ virtual void PaintMatch(gfx::Canvas* canvas,
+ const AutocompleteMatch& match,
+ int x) OVERRIDE;
+ virtual int GetTextHeight() const OVERRIDE;
+
+ DISALLOW_COPY_AND_ASSIGN(TouchOmniboxResultView);
+};
+
+class TouchOmniboxPopupContentsView
+ : public OmniboxPopupContentsView {
+ public:
+ TouchOmniboxPopupContentsView(const gfx::Font& font,
+ OmniboxView* omnibox_view,
+ AutocompleteEditModel* edit_model,
+ views::View* location_bar);
+ virtual ~TouchOmniboxPopupContentsView();
+
+ // OmniboxPopupContentsView:
+ virtual void UpdatePopupAppearance() OVERRIDE;
+
+ protected:
+ // OmniboxPopupContentsView:
+ virtual void PaintResultViews(gfx::Canvas* canvas) OVERRIDE;
+ virtual OmniboxResultView* CreateResultView(
+ OmniboxResultViewModel* model,
+ int model_index,
+ const gfx::Font& font,
+ const gfx::Font& bold_font) OVERRIDE;
+
+ private:
+ std::vector<View*> GetVisibleChildren();
+
+ DISALLOW_COPY_AND_ASSIGN(TouchOmniboxPopupContentsView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_TOUCH_OMNIBOX_POPUP_CONTENTS_VIEW_H_
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 2feb3eb..71091bd 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -3400,13 +3400,6 @@
'browser/ui/views/ash/volume_controller_chromeos.h',
'browser/ui/views/ash/window_positioner.cc',
'browser/ui/views/ash/window_positioner.h',
- 'browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc',
- 'browser/ui/views/autocomplete/autocomplete_popup_contents_view.h',
- 'browser/ui/views/autocomplete/autocomplete_result_view.cc',
- 'browser/ui/views/autocomplete/autocomplete_result_view.h',
- 'browser/ui/views/autocomplete/autocomplete_result_view_model.h',
- 'browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.cc',
- 'browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.h',
'browser/ui/views/avatar_menu_bubble_view.cc',
'browser/ui/views/avatar_menu_bubble_view.h',
'browser/ui/views/avatar_menu_button.cc',
@@ -3635,12 +3628,19 @@
'browser/ui/views/notifications/balloon_view_host.h',
'browser/ui/views/notifications/balloon_view_views.cc',
'browser/ui/views/notifications/balloon_view_views.h',
+ 'browser/ui/views/omnibox/omnibox_popup_contents_view.cc',
+ 'browser/ui/views/omnibox/omnibox_popup_contents_view.h',
+ 'browser/ui/views/omnibox/omnibox_result_view.cc',
+ 'browser/ui/views/omnibox/omnibox_result_view.h',
+ 'browser/ui/views/omnibox/omnibox_result_view_model.h',
'browser/ui/views/omnibox/omnibox_views.cc',
'browser/ui/views/omnibox/omnibox_views.h',
'browser/ui/views/omnibox/omnibox_view_views.cc',
'browser/ui/views/omnibox/omnibox_view_views.h',
'browser/ui/views/omnibox/omnibox_view_win.cc',
'browser/ui/views/omnibox/omnibox_view_win.h',
+ 'browser/ui/views/omnibox/touch_omnibox_popup_contents_view.cc',
+ 'browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h',
'browser/ui/views/page_info_bubble_view.cc',
'browser/ui/views/page_info_bubble_view.h',
'browser/ui/views/password_generation_bubble_view.cc',