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

Unified Diff: chrome/browser/autocomplete/autocomplete_edit_view_win.cc

Issue 6036004: Refactor AutocompleteEditViewGtk so that AutocompleteEditView impl can be swapped. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 11 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/autocomplete/autocomplete_edit_view_win.cc
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
index cc2a486e3239977255d6fba54d1c1ad10b1365f1..df2a8ba4eba28d0a0073ca87537cac856617957d 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
@@ -498,10 +498,6 @@ AutocompleteEditViewWin::~AutocompleteEditViewWin() {
g_paint_patcher.Pointer()->DerefPatch();
}
-int AutocompleteEditViewWin::TextWidth() {
- return WidthNeededToDisplay(GetText());
-}
-
int AutocompleteEditViewWin::WidthOfTextAfterCursor() {
CHARRANGE selection;
GetSelection(selection);
@@ -913,6 +909,30 @@ CommandUpdater* AutocompleteEditViewWin::GetCommandUpdater() {
return command_updater_;
}
+views::View* AutocompleteEditViewWin::AddToView(views::View* parent) {
+ views::NativeViewHost* host = new views::NativeViewHost;
+ parent->AddChildView(host);
+ host->set_focus_view(parent);
+ host->Attach(GetNativeView());
+ return host;
+}
+
+bool AutocompleteEditViewWin::CommitInstantSuggestion(
+ const std::wstring& typed_text,
+ const std::wstring& suggested_text) {
+ model_->FinalizeInstantQuery(typed_text, suggested_text);
+ return true;
+}
+
+void AutocompleteEditViewWin::SetInstantSuggestion(const string16& suggestion) {
+ // Win shows the suggestion in LocationBarView.
+ NOTREACHED();
+}
+
+int AutocompleteEditViewWin::TextWidth() const {
+ return WidthNeededToDisplay(GetText());
+}
+
void AutocompleteEditViewWin::PasteAndGo(const std::wstring& text) {
if (CanPasteAndGo(text))
model_->PasteAndGo();
@@ -2570,7 +2590,7 @@ void AutocompleteEditViewWin::TrackMousePosition(MouseButton button,
}
}
-int AutocompleteEditViewWin::GetHorizontalMargin() {
+int AutocompleteEditViewWin::GetHorizontalMargin() const {
RECT rect;
GetRect(&rect);
RECT client_rect;
@@ -2578,7 +2598,8 @@ int AutocompleteEditViewWin::GetHorizontalMargin() {
return (rect.left - client_rect.left) + (client_rect.right - rect.right);
}
-int AutocompleteEditViewWin::WidthNeededToDisplay(const std::wstring& text) {
+int AutocompleteEditViewWin::WidthNeededToDisplay(
+ const std::wstring& text) const {
// Use font_.GetStringWidth() instead of
// PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is
// apparently buggy. In both LTR UI and RTL UI with left-to-right layout,

Powered by Google App Engine
This is Rietveld 408576698