| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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_ |
| OLD | NEW |