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

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

Issue 113751: Don't make |field_| first responder in SetSelectedRange() unless |model_| has_focus already. (Closed)
Patch Set: Comment wordsmithing. Created 11 years, 7 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 private: 104 private:
105 // Returns the field's currently selected range. Only valid if the 105 // Returns the field's currently selected range. Only valid if the
106 // field has focus. 106 // field has focus.
107 NSRange GetSelectedRange() const; 107 NSRange GetSelectedRange() const;
108 108
109 // Returns true if |field_| is first-responder in the window. Used 109 // Returns true if |field_| is first-responder in the window. Used
110 // in various DCHECKS to make sure code is running in appropriate 110 // in various DCHECKS to make sure code is running in appropriate
111 // situations. 111 // situations.
112 bool IsFirstResponder() const; 112 bool IsFirstResponder() const;
113 113
114 // Grab focus if needed and set the selection to |range|. 114 // If |model_| believes it has focus, grab focus if needed and set
115 // the selection to |range|. Otherwise does nothing.
115 void SetSelectedRange(const NSRange range); 116 void SetSelectedRange(const NSRange range);
116 117
117 // Update the field with |display_text| and highlight the host and 118 // Update the field with |display_text| and highlight the host and
118 // scheme (if it's an URL or URL-fragment). 119 // scheme (if it's an URL or URL-fragment).
119 void UpdateAndStyleText(const std::wstring& display_text); 120 void UpdateAndStyleText(const std::wstring& display_text);
120 121
121 scoped_ptr<AutocompleteEditModel> model_; 122 scoped_ptr<AutocompleteEditModel> model_;
122 scoped_ptr<AutocompletePopupViewMac> popup_view_; 123 scoped_ptr<AutocompletePopupViewMac> popup_view_;
123 124
124 AutocompleteEditController* controller_; 125 AutocompleteEditController* controller_;
(...skipping 15 matching lines...) Expand all
140 141
141 // Tracking state before and after a possible change for reporting 142 // Tracking state before and after a possible change for reporting
142 // to model_. 143 // to model_.
143 NSRange selection_before_change_; 144 NSRange selection_before_change_;
144 std::wstring text_before_change_; 145 std::wstring text_before_change_;
145 146
146 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewMac); 147 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewMac);
147 }; 148 };
148 149
149 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ 150 #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