summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete/autocomplete_edit_view_mac.h
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-04 20:50:47 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-04 20:50:47 +0000
commitfe0ecbe4c6b2a4b7422c65be1967fcb019f49342 (patch)
treeeb9b5ceb8640801f0b80b433da331dad4a2f40b5 /chrome/browser/autocomplete/autocomplete_edit_view_mac.h
parent6cd3a5ffeb3b3707bee1b95374e03762d29a2711 (diff)
downloadchromium_src-fe0ecbe4c6b2a4b7422c65be1967fcb019f49342.zip
chromium_src-fe0ecbe4c6b2a4b7422c65be1967fcb019f49342.tar.gz
chromium_src-fe0ecbe4c6b2a4b7422c65be1967fcb019f49342.tar.bz2
[Mac] Route edit-state messages via observer rather than delegate.
AutocompleteTextField routes messages to AutocompleteEditViewMac via a Cocoa-style delegate and also a C++ observer class. The Cocoa-style delegate has been gradually being pruned down in favor of the observer, this CL completes the transformation. The noted bugs occur because some bit of Cocoa code was sending spurious delegate notifications. Since this code no longer depends on those notifications, the spurious notifications are no longer a problem for this case. BUG=19116, 17803 TEST=Login to gmail, select a message, j, k, and other keys should work (and not send you to the omnibox). Bring up the Print panel and cancel. Bring up a new tab and close it. gmail's accelerator keys should still work right (not send focus to omnibox). Review URL: http://codereview.chromium.org/391025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33853 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_edit_view_mac.h')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_mac.h61
1 files changed, 11 insertions, 50 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h
index c8d0bfb..f08d37f 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h
@@ -7,26 +7,16 @@
#import <Cocoa/Cocoa.h>
-#include "base/basictypes.h"
-#include "base/scoped_nsobject.h"
#include "base/scoped_ptr.h"
-#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/autocomplete/autocomplete_edit_view.h"
-#include "chrome/browser/toolbar_model.h"
#include "chrome/browser/cocoa/autocomplete_text_field.h"
-#include "chrome/common/page_transition_types.h"
-#include "grit/generated_resources.h"
-#include "webkit/glue/window_open_disposition.h"
class AutocompleteEditController;
-class AutocompleteEditModel;
-@class AutocompleteFieldDelegate;
class AutocompletePopupViewMac;
class BubblePositioner;
class Clipboard;
class CommandUpdater;
class Profile;
-class TabContents;
class ToolbarModel;
// Implements AutocompleteEditView on an AutocompleteTextField.
@@ -94,43 +84,11 @@ class AutocompleteEditViewMac : public AutocompleteEditView,
virtual int GetPasteActionStringId();
virtual void OnPasteAndGo();
virtual void OnFrameChanged();
-
- // Helper functions for use from AutocompleteEditHelper Objective-C
- // class.
-
- // Returns true if |popup_view_| is open.
- bool IsPopupOpen() const;
-
- // Trivial wrappers forwarding to |model_| methods.
- void OnEscapeKeyPressed();
- void OnUpOrDownKeyPressed(bool up, bool by_page);
-
- // Called when editing begins in the field, and before the results
- // of any editing are communicated to |model_|.
- void OnWillBeginEditing();
-
- // Called when editing ends in the field.
- void OnDidEndEditing();
-
- // Called when the window |field_| is in loses key to clean up
- // visual state (such as closing the popup).
- void OnDidResignKey();
-
- // Checks if a keyword search is possible and forwards to |model_|
- // if so. Returns true if the tab should be eaten.
- bool OnTabPressed();
-
- // Called when the user hits backspace in |field_|. Checks whether
- // keyword search is being terminated. Returns true if the
- // backspace should be intercepted (not forwarded on to the standard
- // machinery).
- bool OnBackspacePressed();
-
- // Forward to same method in |popup_view_| model. Used when
- // Shift-Delete is pressed, to delete items from the popup.
- void TryDeletingCurrentItem();
-
- void AcceptInput(WindowOpenDisposition disposition, bool for_drop);
+ virtual void OnDidResignKey(); // Closes the popup.
+ virtual void OnDidBeginEditing();
+ virtual void OnDidChange();
+ virtual void OnDidEndEditing();
+ virtual bool OnDoCommandBySelector(SEL cmd);
// Helper for LocationBarViewMac. Selects all in |field_|.
void FocusLocation();
@@ -140,6 +98,12 @@ class AutocompleteEditViewMac : public AutocompleteEditView,
static std::wstring GetClipboardText(Clipboard* clipboard);
private:
+ // Called when the user hits backspace in |field_|. Checks whether
+ // keyword search is being terminated. Returns true if the
+ // backspace should be intercepted (not forwarded on to the standard
+ // machinery).
+ bool OnBackspacePressed();
+
// Returns the field's currently selected range. Only valid if the
// field has focus.
NSRange GetSelectedRange() const;
@@ -178,9 +142,6 @@ class AutocompleteEditViewMac : public AutocompleteEditView,
AutocompleteTextField* field_; // owned by tab controller
- // Objective-C object to bridge field_ delegate calls to C++.
- scoped_nsobject<AutocompleteFieldDelegate> edit_helper_;
-
// Selection at the point where the user started using the
// arrows to move around in the popup.
NSRange saved_temporary_selection_;