From 74b9879d2ed5a67e2935703e171059d40924e462 Mon Sep 17 00:00:00 2001 From: "shess@chromium.org" Date: Tue, 14 Apr 2009 20:54:28 +0000 Subject: Implement OnBeforePossibleChange() and OnAfterPossibleChange() to fix delete in Mac Omnibox. BUG=10030 Review URL: http://codereview.chromium.org/67136 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13700 0039d316-1c4b-4281-b951-d872f2087c98 --- .../browser/autocomplete/autocomplete_edit_view_mac.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'chrome/browser/autocomplete/autocomplete_edit_view_mac.h') diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h index 8a6147e..d6b0928 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h @@ -78,8 +78,8 @@ class AutocompleteEditViewMac : public AutocompleteEditView { virtual bool OnInlineAutocompleteTextMaybeChanged( const std::wstring& display_text, size_t user_text_length); virtual void OnRevertTemporaryText(); - virtual void OnBeforePossibleChange() { NOTIMPLEMENTED(); } - virtual bool OnAfterPossibleChange() { NOTIMPLEMENTED(); return false; } + virtual void OnBeforePossibleChange(); + virtual bool OnAfterPossibleChange(); // Helper functions which forward to our private: model_. void OnUpOrDownKeyPressed(int dir); @@ -87,11 +87,6 @@ class AutocompleteEditViewMac : public AutocompleteEditView { void OnSetFocus(bool f); void OnKillFocus(); void AcceptInput(WindowOpenDisposition disposition, bool for_drop); - void OnAfterPossibleChange(const std::wstring& new_text, - bool selection_differs, - bool text_differs, - bool just_deleted_text, - bool at_end_of_edit); // TODO(shess): Get rid of this. Right now it's needed because of // the ordering of initialization in tab_contents_controller.mm. @@ -101,6 +96,10 @@ class AutocompleteEditViewMac : public AutocompleteEditView { void FocusLocation(); private: + // Returns the field's currently selected range. Only valid if the + // field has focus. + NSRange GetSelectedRange() const; + scoped_ptr model_; scoped_ptr popup_view_; @@ -118,6 +117,11 @@ class AutocompleteEditViewMac : public AutocompleteEditView { std::wstring saved_temporary_text_; + // Tracking state before and after a possible change for reporting + // to model_. + NSRange selection_before_change_; + std::wstring text_before_change_; + DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewMac); }; -- cgit v1.1