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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_edit_view_mac.h

Issue 67136: Fix delete in Mac Omnibox. (Closed)
Patch Set: Created 11 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_edit_view_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 virtual void RevertAll(); 71 virtual void RevertAll();
72 virtual void UpdatePopup(); 72 virtual void UpdatePopup();
73 virtual void ClosePopup(); 73 virtual void ClosePopup();
74 void UpdateAndStyleText(const std::wstring& display_text, 74 void UpdateAndStyleText(const std::wstring& display_text,
75 size_t user_text_length); 75 size_t user_text_length);
76 virtual void OnTemporaryTextMaybeChanged(const std::wstring& display_text, 76 virtual void OnTemporaryTextMaybeChanged(const std::wstring& display_text,
77 bool save_original_selection); 77 bool save_original_selection);
78 virtual bool OnInlineAutocompleteTextMaybeChanged( 78 virtual bool OnInlineAutocompleteTextMaybeChanged(
79 const std::wstring& display_text, size_t user_text_length); 79 const std::wstring& display_text, size_t user_text_length);
80 virtual void OnRevertTemporaryText(); 80 virtual void OnRevertTemporaryText();
81 virtual void OnBeforePossibleChange() { NOTIMPLEMENTED(); } 81 virtual void OnBeforePossibleChange();
82 virtual bool OnAfterPossibleChange() { NOTIMPLEMENTED(); return false; } 82 virtual bool OnAfterPossibleChange();
83 83
84 // Helper functions which forward to our private: model_. 84 // Helper functions which forward to our private: model_.
85 void OnUpOrDownKeyPressed(int dir); 85 void OnUpOrDownKeyPressed(int dir);
86 void OnEscapeKeyPressed(); 86 void OnEscapeKeyPressed();
87 void OnSetFocus(bool f); 87 void OnSetFocus(bool f);
88 void OnKillFocus(); 88 void OnKillFocus();
89 void AcceptInput(WindowOpenDisposition disposition, bool for_drop); 89 void AcceptInput(WindowOpenDisposition disposition, bool for_drop);
90 void OnAfterPossibleChange(const std::wstring& new_text,
91 bool selection_differs,
92 bool text_differs,
93 bool just_deleted_text,
94 bool at_end_of_edit);
95 90
96 // TODO(shess): Get rid of this. Right now it's needed because of 91 // TODO(shess): Get rid of this. Right now it's needed because of
97 // the ordering of initialization in tab_contents_controller.mm. 92 // the ordering of initialization in tab_contents_controller.mm.
98 void SetField(NSTextField* field); 93 void SetField(NSTextField* field);
99 94
100 // Helper for LocationBarBridge. 95 // Helper for LocationBarBridge.
101 void FocusLocation(); 96 void FocusLocation();
102 97
103 private: 98 private:
99 // Returns the field's currently selected range. Only valid if the
100 // field has focus.
101 NSRange GetSelectedRange() const;
102
104 scoped_ptr<AutocompleteEditModel> model_; 103 scoped_ptr<AutocompleteEditModel> model_;
105 scoped_ptr<AutocompletePopupViewMac> popup_view_; 104 scoped_ptr<AutocompletePopupViewMac> popup_view_;
106 105
107 AutocompleteEditController* controller_; 106 AutocompleteEditController* controller_;
108 ToolbarModel* toolbar_model_; 107 ToolbarModel* toolbar_model_;
109 108
110 // The object that handles additional command functionality exposed on the 109 // The object that handles additional command functionality exposed on the
111 // edit, such as invoking the keyword editor. 110 // edit, such as invoking the keyword editor.
112 CommandUpdater* command_updater_; 111 CommandUpdater* command_updater_;
113 112
114 NSTextField* field_; // owned by tab controller 113 NSTextField* field_; // owned by tab controller
115 114
116 // Objective-C object to bridge field_ delegate calls to C++. 115 // Objective-C object to bridge field_ delegate calls to C++.
117 scoped_nsobject<AutocompleteEditHelper> edit_helper_; 116 scoped_nsobject<AutocompleteEditHelper> edit_helper_;
118 117
119 std::wstring saved_temporary_text_; 118 std::wstring saved_temporary_text_;
120 119
120 // Tracking state before and after a possible change for reporting
121 // to model_.
122 NSRange selection_before_change_;
123 std::wstring text_before_change_;
124
121 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewMac); 125 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewMac);
122 }; 126 };
123 127
124 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ 128 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_edit_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698