diff options
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit.cc | 13 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit.h | 3 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_popup_model.cc | 7 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_popup_model.h | 6 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_popup_view.h | 5 | ||||
-rwxr-xr-x | chrome/browser/autocomplete/autocomplete_popup_view_win.cc | 229 | ||||
-rwxr-xr-x | chrome/browser/autocomplete/autocomplete_popup_view_win.h | 205 | ||||
-rw-r--r-- | chrome/browser/browser.vcproj | 4 | ||||
-rw-r--r-- | chrome/chrome.gyp | 1 |
9 files changed, 245 insertions, 228 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc index 35f7dad..3a0f56b 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.cc +++ b/chrome/browser/autocomplete/autocomplete_edit.cc @@ -17,6 +17,7 @@ #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/autocomplete/autocomplete_accessibility.h" #include "chrome/browser/autocomplete/autocomplete_popup_model.h" +#include "chrome/browser/autocomplete/autocomplete_popup_view_win.h" #include "chrome/browser/autocomplete/edit_drop_target.h" #include "chrome/browser/autocomplete/keyword_provider.h" #include "chrome/browser/browser_process.h" @@ -720,8 +721,8 @@ AutocompleteEditView::AutocompleteEditView( CommandUpdater* command_updater, bool popup_window_mode) : model_(new AutocompleteEditModel(this, controller, profile)), - popup_model_(new AutocompletePopupModel(font, this, model_.get(), - profile)), + popup_view_(new AutocompletePopupViewWin(font, this, model_.get(), + profile)), controller_(controller), parent_view_(parent_view), toolbar_model_(toolbar_model), @@ -738,7 +739,7 @@ AutocompleteEditView::AutocompleteEditView( drop_highlight_position_(-1), background_color_(0), scheme_security_level_(ToolbarModel::NORMAL) { - model_->set_popup_model(popup_model_.get()); + model_->set_popup_model(popup_view_->model()); saved_selection_for_focus_change_.cpMin = -1; @@ -1038,7 +1039,7 @@ void AutocompleteEditView::UpdatePopup() { } void AutocompleteEditView::ClosePopup() { - popup_model_->StopAutocomplete(); + popup_view_->model()->StopAutocomplete(); } IAccessible* AutocompleteEditView::GetIAccessible() { @@ -1954,12 +1955,12 @@ bool AutocompleteEditView::OnKeyDownOnlyWritable(TCHAR key, OnBeforePossibleChange(); Cut(); OnAfterPossibleChange(); - } else if (popup_model_->IsOpen()) { + } else if (popup_view_->model()->IsOpen()) { // This is a bit overloaded, but we hijack Shift-Delete in this // case to delete the current item from the pop-up. We prefer cutting // to this when possible since that's the behavior more people expect // from Shift-Delete, and it's more commonly useful. - popup_model_->TryDeletingCurrentItem(); + popup_view_->model()->TryDeletingCurrentItem(); } } return true; diff --git a/chrome/browser/autocomplete/autocomplete_edit.h b/chrome/browser/autocomplete/autocomplete_edit.h index d343e91..782f85d 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.h +++ b/chrome/browser/autocomplete/autocomplete_edit.h @@ -31,6 +31,7 @@ class View; class AutocompleteEditController; class AutocompleteEditModel; class AutocompleteEditView; +class AutocompletePopupViewWin; struct AutocompleteEditState; // TODO(pkasting): http://b/1343512 The names and contents of the classes in @@ -796,7 +797,7 @@ class AutocompleteEditView scoped_ptr<AutocompleteEditModel> model_; - scoped_ptr<AutocompletePopupModel> popup_model_; + scoped_ptr<AutocompletePopupViewWin> popup_view_; AutocompleteEditController* controller_; diff --git a/chrome/browser/autocomplete/autocomplete_popup_model.cc b/chrome/browser/autocomplete/autocomplete_popup_model.cc index 1d41c14..f6a5ffb 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_model.cc +++ b/chrome/browser/autocomplete/autocomplete_popup_model.cc @@ -10,7 +10,7 @@ #include "base/scoped_ptr.h" #include "base/string_util.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" -#include "chrome/browser/autocomplete/autocomplete_popup_view.h" +#include "chrome/browser/autocomplete/autocomplete_popup_view_win.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/net/dns_global.h" #include "chrome/browser/profile.h" @@ -25,11 +25,10 @@ #include "third_party/icu38/public/common/unicode/ubidi.h" AutocompletePopupModel::AutocompletePopupModel( - const ChromeFont& font, - AutocompleteEditView* edit_view, + AutocompletePopupView* popup_view, AutocompleteEditModel* edit_model, Profile* profile) - : view_(AutocompletePopupView::CreatePopupView(this, font, edit_view)), + : view_(popup_view), edit_model_(edit_model), controller_(new AutocompleteController(profile)), profile_(profile), diff --git a/chrome/browser/autocomplete/autocomplete_popup_model.h b/chrome/browser/autocomplete/autocomplete_popup_model.h index bab0c0a..fa2c81e 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_model.h +++ b/chrome/browser/autocomplete/autocomplete_popup_model.h @@ -10,15 +10,13 @@ class AutocompleteEditModel; class AutocompleteEditView; -class ChromeFont; class Profile; class AutocompletePopupView; class AutocompletePopupModel : public NotificationObserver { public: - AutocompletePopupModel(const ChromeFont& font, - AutocompleteEditView* edit_view, + AutocompletePopupModel(AutocompletePopupView* popup_view, AutocompleteEditModel* edit_model, Profile* profile); ~AutocompletePopupModel(); @@ -145,7 +143,7 @@ class AutocompletePopupModel : public NotificationObserver { const NotificationSource& source, const NotificationDetails& details); - scoped_ptr<AutocompletePopupView> view_; + AutocompletePopupView* view_; AutocompleteEditModel* edit_model_; scoped_ptr<AutocompleteController> controller_; diff --git a/chrome/browser/autocomplete/autocomplete_popup_view.h b/chrome/browser/autocomplete/autocomplete_popup_view.h index e0562d1..7c3db76 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_view.h +++ b/chrome/browser/autocomplete/autocomplete_popup_view.h @@ -17,11 +17,6 @@ class ChromeFont; class AutocompletePopupView { public: - static AutocompletePopupView* CreatePopupView( - AutocompletePopupModel* model, - const ChromeFont& font, - AutocompleteEditView* edit_view); - virtual ~AutocompletePopupView() { } // Returns true if the popup is currently open. diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_win.cc b/chrome/browser/autocomplete/autocomplete_popup_view_win.cc index c357fa7..a583154 100755 --- a/chrome/browser/autocomplete/autocomplete_popup_view_win.cc +++ b/chrome/browser/autocomplete/autocomplete_popup_view_win.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/autocomplete/autocomplete_popup_view.h" +#include "chrome/browser/autocomplete/autocomplete_popup_view_win.h" // TODO(deanm): Clean up these includes, not going to fight it now. #include <atlbase.h> @@ -32,14 +32,12 @@ #include "grit/theme_resources.h" #include "third_party/icu38/public/common/unicode/ubidi.h" -namespace { - // Padding between text and the star indicator, in pixels. -const int kStarPadding = 4; +static const int kStarPadding = 4; // This class implements a utility used for mirroring x-coordinates when the // application language is a right-to-left one. -class MirroringContext { +class AutocompletePopupViewWin::MirroringContext { public: MirroringContext() : min_x_(0), center_x_(0), max_x_(0), enabled_(false) { } @@ -70,61 +68,24 @@ class MirroringContext { DISALLOW_EVIL_CONSTRUCTORS(MirroringContext); }; -void MirroringContext::Initialize(int x1, int x2, bool enabled) { +void AutocompletePopupViewWin::MirroringContext::Initialize(int x1, + int x2, + bool enabled) { min_x_ = std::min(x1, x2); max_x_ = std::max(x1, x2); center_x_ = min_x_ + (max_x_ - min_x_) / 2; enabled_ = enabled; } -int MirroringContext::GetLeft(int x1, int x2) const { +int AutocompletePopupViewWin::MirroringContext::GetLeft(int x1, int x2) const { return enabled_ ? (center_x_ + (center_x_ - std::max(x1, x2))) : std::min(x1, x2); } -// Caches GDI objects and information for drawing. -struct DrawLineInfo { - enum LineStatus { - NORMAL = 0, - HOVERED, - SELECTED, - MAX_STATUS_ENTRIES - }; - - explicit DrawLineInfo(const ChromeFont& font); - ~DrawLineInfo(); - - static COLORREF AlphaBlend(COLORREF foreground, - COLORREF background, - BYTE alpha); - - static const wchar_t ellipsis_str[]; - - ChromeFont regular_font; // Fonts used for rendering AutocompleteMatches. - ChromeFont bold_font; - int font_height; // Height (in pixels) of a line of text w/o - // padding. - int line_height; // Height (in pixels) of a line of text w/padding. - int ave_char_width; // Width (in pixels) of an average character of - // the regular font. - int ellipsis_width; // Width (in pixels) of the ellipsis_str. - - // colors - COLORREF background_colors[MAX_STATUS_ENTRIES]; - COLORREF text_colors[MAX_STATUS_ENTRIES]; - COLORREF url_colors[MAX_STATUS_ENTRIES]; - - // brushes - HBRUSH brushes[MAX_STATUS_ENTRIES]; - - private: - static double LuminosityContrast(COLORREF color1, COLORREF color2); - static double Luminosity(COLORREF color); -}; +const wchar_t AutocompletePopupViewWin::DrawLineInfo::ellipsis_str[] = + L"\x2026"; -const wchar_t DrawLineInfo::ellipsis_str[] = L"\x2026"; - -DrawLineInfo::DrawLineInfo(const ChromeFont& font) { +AutocompletePopupViewWin::DrawLineInfo::DrawLineInfo(const ChromeFont& font) { // Create regular and bold fonts. regular_font = font.DeriveFont(-1); bold_font = regular_font.DeriveFont(0, ChromeFont::BOLD); @@ -164,13 +125,13 @@ DrawLineInfo::DrawLineInfo(const ChromeFont& font) { } } -DrawLineInfo::~DrawLineInfo() { +AutocompletePopupViewWin::DrawLineInfo::~DrawLineInfo() { for (int i = 0; i < MAX_STATUS_ENTRIES; ++i) DeleteObject(brushes[i]); } // static -double DrawLineInfo::LuminosityContrast( +double AutocompletePopupViewWin::DrawLineInfo::LuminosityContrast( COLORREF color1, COLORREF color2) { // This algorithm was adapted from the following text at @@ -192,7 +153,7 @@ double DrawLineInfo::LuminosityContrast( } // static -double DrawLineInfo::Luminosity(COLORREF color) { +double AutocompletePopupViewWin::DrawLineInfo::Luminosity(COLORREF color) { // See comments in LuminosityContrast(). const double linearised_r = pow(static_cast<double>(GetRValue(color)) / 255.0, 2.2); @@ -204,9 +165,10 @@ double DrawLineInfo::Luminosity(COLORREF color) { (0.0722 * linearised_b); } -COLORREF DrawLineInfo::AlphaBlend(COLORREF foreground, - COLORREF background, - BYTE alpha) { +COLORREF AutocompletePopupViewWin::DrawLineInfo::AlphaBlend( + COLORREF foreground, + COLORREF background, + BYTE alpha) { if (alpha == 0) return background; else if (alpha == 0xff) @@ -221,149 +183,12 @@ COLORREF DrawLineInfo::AlphaBlend(COLORREF foreground, (GetBValue(background) * (0xff - alpha))) / 0xff); } -#define AUTOCOMPLETEPOPUPVIEW_CLASSNAME L"Chrome_AutocompletePopupView" - -// This class implements a popup window used to display autocomplete results. -class AutocompletePopupViewWin - : public CWindowImpl<AutocompletePopupViewWin, CWindow, CControlWinTraits>, - public AutocompletePopupView { - public: - DECLARE_WND_CLASS_EX(AUTOCOMPLETEPOPUPVIEW_CLASSNAME, - ((win_util::GetWinVersion() < win_util::WINVERSION_XP) ? - 0 : CS_DROPSHADOW), COLOR_WINDOW) - - BEGIN_MSG_MAP(AutocompletePopupViewWin) - MSG_WM_ERASEBKGND(OnEraseBkgnd) - MSG_WM_LBUTTONDOWN(OnLButtonDown) - MSG_WM_MBUTTONDOWN(OnMButtonDown) - MSG_WM_LBUTTONUP(OnLButtonUp) - MSG_WM_MBUTTONUP(OnMButtonUp) - MSG_WM_MOUSEACTIVATE(OnMouseActivate) - MSG_WM_MOUSELEAVE(OnMouseLeave) - MSG_WM_MOUSEMOVE(OnMouseMove) - MSG_WM_PAINT(OnPaint) - END_MSG_MAP() - - AutocompletePopupViewWin(AutocompletePopupModel* model, - const ChromeFont& font, - AutocompleteEditView* edit_view); - - // Returns true if the popup is currently open. - virtual bool IsOpen() const { return m_hWnd != NULL; } - - // Invalidates one line of the autocomplete popup. - virtual void InvalidateLine(size_t line); - - // Redraws the popup window to match any changes in the result set; this may - // mean opening or closing the window. - virtual void UpdatePopupAppearance(); - - // Called by the model when hover is enabled or disabled. - virtual void OnHoverEnabledOrDisabled(bool disabled); - - virtual void PaintUpdatesNow() { UpdateWindow(); } - - private: - - // message handlers - LRESULT OnEraseBkgnd(HDC hdc) { - // We do all needed erasing ourselves in OnPaint, so the only thing that - // WM_ERASEBKGND will do is cause flicker. Disable it by just returning - // nonzero here ("erase completed") without doing anything. - return 1; - } - void OnLButtonDown(UINT keys, const CPoint& point); - void OnMButtonDown(UINT keys, const CPoint& point); - void OnLButtonUp(UINT keys, const CPoint& point); - void OnMButtonUp(UINT keys, const CPoint& point); - LRESULT OnMouseActivate(HWND window, UINT hit_test, UINT mouse_message); - void OnMouseLeave(); - void OnMouseMove(UINT keys, const CPoint& point); - void OnPaint(HDC hdc); - - // Called by On*ButtonUp() to do the actual work of handling a button - // release. Opens the item at the given coordinate, using the supplied - // disposition. - void OnButtonUp(const CPoint& point, WindowOpenDisposition disposition); - - // Gives the topmost y coordinate within |line|, which should be within the - // range of valid lines. - int LineTopPixel(size_t line) const; - - // Converts the given y-coordinate to a line. Due to drawing slop (window - // borders, etc.), |y| might be within the window but outside the range of - // pixels which correspond to lines; in this case the result will be clamped, - // i.e., the top and bottom lines will be treated as extending to the top and - // bottom edges of the window, respectively. - size_t PixelToLine(int y) const; - - // Draws a light border around the inside of the window with the given client - // rectangle and DC. - void DrawBorder(const RECT& rc, HDC dc); - - // Draws a single run of text with a particular style. Handles both LTR and - // RTL text as well as eliding. Returns the width, in pixels, of the string - // as it was actually displayed. - int DrawString(HDC dc, - int x, - int y, - int max_x, - const wchar_t* text, - int length, - int style, - const DrawLineInfo::LineStatus status, - const MirroringContext* context, - bool text_direction_is_rtl) const; - - // Draws a string from the autocomplete controller which can have specially - // marked "match" portions. - void DrawMatchFragments(HDC dc, - const std::wstring& text, - const ACMatchClassifications& classifications, - int x, - int y, - int max_x, - DrawLineInfo::LineStatus status) const; - - // Draws one line of the text in the box. - void DrawEntry(HDC dc, - const RECT& client_rect, - size_t line, - DrawLineInfo::LineStatus status, - bool all_descriptions_empty, - bool starred) const; - - // Draws the star at the specified location - void DrawStar(HDC dc, int x, int y) const; - - AutocompletePopupModel* model_; - - AutocompleteEditView* edit_view_; - - // Cached GDI information for drawing. - DrawLineInfo line_info_; - - // Bitmap for the star. This is owned by the ResourceBundle. - SkBitmap* star_; - - // A context used for mirroring regions. - scoped_ptr<MirroringContext> mirroring_context_; - - // When hovered_line_ is kNoMatch, this holds the screen coordinates of the - // mouse position when hover tracking was turned off. If the mouse moves to a - // point over the popup that has different coordinates, hover tracking will be - // re-enabled. When hovered_line_ is a valid line, the value here is - // out-of-date and should be ignored. - CPoint last_hover_coordinates_; - - DISALLOW_COPY_AND_ASSIGN(AutocompletePopupViewWin); -}; - AutocompletePopupViewWin::AutocompletePopupViewWin( - AutocompletePopupModel* model, const ChromeFont& font, - AutocompleteEditView* edit_view) - : model_(model), + AutocompleteEditView* edit_view, + AutocompleteEditModel* edit_model, + Profile* profile) + : model_(new AutocompletePopupModel(this, edit_model, profile)), edit_view_(edit_view), line_info_(font), mirroring_context_(new MirroringContext()), @@ -839,15 +664,3 @@ void AutocompletePopupViewWin::DrawStar(HDC dc, int x, int y) const { canvas.getTopPlatformDevice().drawToHDC( dc, mirroring_context_->GetLeft(x, x + star_->width()), y, NULL); } - -} // namespace - -// static -// NOTE: The annoying name CreatePopupView is because otherwise multiple -// inheritance conflicts with another Create method. -AutocompletePopupView* AutocompletePopupView::CreatePopupView( - AutocompletePopupModel* model, - const ChromeFont& font, - AutocompleteEditView* edit_view) { - return new AutocompletePopupViewWin(model, font, edit_view); -} diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_win.h b/chrome/browser/autocomplete/autocomplete_popup_view_win.h new file mode 100755 index 0000000..dcfd505 --- /dev/null +++ b/chrome/browser/autocomplete/autocomplete_popup_view_win.h @@ -0,0 +1,205 @@ +// Copyright (c) 2006-2008 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. + +#include <atlbase.h> +#include <atlapp.h> +#include <atlcrack.h> +#include <atlmisc.h> + +#include <string> + +#include "base/scoped_ptr.h" +#include "base/win_util.h" +#include "chrome/browser/autocomplete/autocomplete.h" +#include "chrome/browser/autocomplete/autocomplete_popup_view.h" +#include "chrome/common/gfx/chrome_font.h" +#include "webkit/glue/window_open_disposition.h" + +class AutocompletePopupModel; +class AutocompleteEditModel; +class AutocompleteEditView; +class Profile; +class SkBitmap; + +#define AUTOCOMPLETEPOPUPVIEW_CLASSNAME L"Chrome_AutocompletePopupView" + +// This class implements a popup window used to display autocomplete results. +class AutocompletePopupViewWin + : public CWindowImpl<AutocompletePopupViewWin, CWindow, CControlWinTraits>, + public AutocompletePopupView { + public: + DECLARE_WND_CLASS_EX(AUTOCOMPLETEPOPUPVIEW_CLASSNAME, + ((win_util::GetWinVersion() < win_util::WINVERSION_XP) ? + 0 : CS_DROPSHADOW), COLOR_WINDOW) + + BEGIN_MSG_MAP(AutocompletePopupViewWin) + MSG_WM_ERASEBKGND(OnEraseBkgnd) + MSG_WM_LBUTTONDOWN(OnLButtonDown) + MSG_WM_MBUTTONDOWN(OnMButtonDown) + MSG_WM_LBUTTONUP(OnLButtonUp) + MSG_WM_MBUTTONUP(OnMButtonUp) + MSG_WM_MOUSEACTIVATE(OnMouseActivate) + MSG_WM_MOUSELEAVE(OnMouseLeave) + MSG_WM_MOUSEMOVE(OnMouseMove) + MSG_WM_PAINT(OnPaint) + END_MSG_MAP() + + AutocompletePopupViewWin(const ChromeFont& font, + AutocompleteEditView* edit_view, + AutocompleteEditModel* edit_model, + Profile* profile); + + // Returns true if the popup is currently open. + virtual bool IsOpen() const { return m_hWnd != NULL; } + + // Invalidates one line of the autocomplete popup. + virtual void InvalidateLine(size_t line); + + // Redraws the popup window to match any changes in the result set; this may + // mean opening or closing the window. + virtual void UpdatePopupAppearance(); + + // Called by the model when hover is enabled or disabled. + virtual void OnHoverEnabledOrDisabled(bool disabled); + + virtual void PaintUpdatesNow() { UpdateWindow(); } + + AutocompletePopupModel* model() { return model_.get(); } + + private: + class MirroringContext; + + // Caches GDI objects and information for drawing. + struct DrawLineInfo { + enum LineStatus { + NORMAL = 0, + HOVERED, + SELECTED, + MAX_STATUS_ENTRIES + }; + + explicit DrawLineInfo(const ChromeFont& font); + ~DrawLineInfo(); + + static COLORREF AlphaBlend(COLORREF foreground, + COLORREF background, + BYTE alpha); + + static const wchar_t ellipsis_str[]; + + ChromeFont regular_font; // Fonts used for rendering AutocompleteMatches. + ChromeFont bold_font; + int font_height; // Height (in pixels) of a line of text w/o + // padding. + int line_height; // Height (in pixels) of a line of text w/padding. + int ave_char_width; // Width (in pixels) of an average character of + // the regular font. + int ellipsis_width; // Width (in pixels) of the ellipsis_str. + + // colors + COLORREF background_colors[MAX_STATUS_ENTRIES]; + COLORREF text_colors[MAX_STATUS_ENTRIES]; + COLORREF url_colors[MAX_STATUS_ENTRIES]; + + // brushes + HBRUSH brushes[MAX_STATUS_ENTRIES]; + + private: + static double LuminosityContrast(COLORREF color1, COLORREF color2); + static double Luminosity(COLORREF color); + }; + + // message handlers + LRESULT OnEraseBkgnd(HDC hdc) { + // We do all needed erasing ourselves in OnPaint, so the only thing that + // WM_ERASEBKGND will do is cause flicker. Disable it by just returning + // nonzero here ("erase completed") without doing anything. + return 1; + } + void OnLButtonDown(UINT keys, const CPoint& point); + void OnMButtonDown(UINT keys, const CPoint& point); + void OnLButtonUp(UINT keys, const CPoint& point); + void OnMButtonUp(UINT keys, const CPoint& point); + LRESULT OnMouseActivate(HWND window, UINT hit_test, UINT mouse_message); + void OnMouseLeave(); + void OnMouseMove(UINT keys, const CPoint& point); + void OnPaint(HDC hdc); + + // Called by On*ButtonUp() to do the actual work of handling a button + // release. Opens the item at the given coordinate, using the supplied + // disposition. + void OnButtonUp(const CPoint& point, WindowOpenDisposition disposition); + + // Gives the topmost y coordinate within |line|, which should be within the + // range of valid lines. + int LineTopPixel(size_t line) const; + + // Converts the given y-coordinate to a line. Due to drawing slop (window + // borders, etc.), |y| might be within the window but outside the range of + // pixels which correspond to lines; in this case the result will be clamped, + // i.e., the top and bottom lines will be treated as extending to the top and + // bottom edges of the window, respectively. + size_t PixelToLine(int y) const; + + // Draws a light border around the inside of the window with the given client + // rectangle and DC. + void DrawBorder(const RECT& rc, HDC dc); + + // Draws a single run of text with a particular style. Handles both LTR and + // RTL text as well as eliding. Returns the width, in pixels, of the string + // as it was actually displayed. + int DrawString(HDC dc, + int x, + int y, + int max_x, + const wchar_t* text, + int length, + int style, + const DrawLineInfo::LineStatus status, + const MirroringContext* context, + bool text_direction_is_rtl) const; + + // Draws a string from the autocomplete controller which can have specially + // marked "match" portions. + void DrawMatchFragments(HDC dc, + const std::wstring& text, + const ACMatchClassifications& classifications, + int x, + int y, + int max_x, + DrawLineInfo::LineStatus status) const; + + // Draws one line of the text in the box. + void DrawEntry(HDC dc, + const RECT& client_rect, + size_t line, + DrawLineInfo::LineStatus status, + bool all_descriptions_empty, + bool starred) const; + + // Draws the star at the specified location + void DrawStar(HDC dc, int x, int y) const; + + scoped_ptr<AutocompletePopupModel> model_; + + AutocompleteEditView* edit_view_; + + // Cached GDI information for drawing. + DrawLineInfo line_info_; + + // Bitmap for the star. This is owned by the ResourceBundle. + SkBitmap* star_; + + // A context used for mirroring regions. + scoped_ptr<MirroringContext> mirroring_context_; + + // When hovered_line_ is kNoMatch, this holds the screen coordinates of the + // mouse position when hover tracking was turned off. If the mouse moves to a + // point over the popup that has different coordinates, hover tracking will be + // re-enabled. When hovered_line_ is a valid line, the value here is + // out-of-date and should be ignored. + CPoint last_hover_coordinates_; + + DISALLOW_COPY_AND_ASSIGN(AutocompletePopupViewWin); +}; diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj index 49c6eff..735c51b 100644 --- a/chrome/browser/browser.vcproj +++ b/chrome/browser/browser.vcproj @@ -170,6 +170,10 @@ > </File> <File + RelativePath=".\autocomplete\autocomplete_popup_view_win.h" + > + </File> + <File RelativePath=".\autocomplete\autocomplete_popup_view.h" > </File> diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 3756118..598c43f 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -334,6 +334,7 @@ 'browser/autocomplete/autocomplete_popup_model.h', 'browser/autocomplete/autocomplete_popup_view.h', 'browser/autocomplete/autocomplete_popup_view_win.cc', + 'browser/autocomplete/autocomplete_popup_view_win.h', 'browser/autocomplete/edit_drop_target.cc', 'browser/autocomplete/edit_drop_target.h', 'browser/autocomplete/history_contents_provider.cc', |