| 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_POPUP_VIEW_MAC_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_MAC_H_ |
| 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_MAC_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_MAC_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 // Returns the popup's model. | 65 // Returns the popup's model. |
| 66 virtual AutocompletePopupModel* GetModel(); | 66 virtual AutocompletePopupModel* GetModel(); |
| 67 | 67 |
| 68 // Updates model_'s sense of selected line from the UI before | 68 // Updates model_'s sense of selected line from the UI before |
| 69 // calling edit_view_'s AcceptInput(). Used by internal Objective-C | 69 // calling edit_view_'s AcceptInput(). Used by internal Objective-C |
| 70 // helper object. | 70 // helper object. |
| 71 void AcceptInput(); | 71 void AcceptInput(); |
| 72 | 72 |
| 73 // Return the text to show for the match, based on the match's | 73 // Return the text to show for the match, based on the match's |
| 74 // contents and description. | 74 // contents and description. Result will be in |font|, with the |
| 75 static NSMutableAttributedString* MatchText(const AutocompleteMatch& match); | 75 // boldfaced version used for matches. |
| 76 static NSAttributedString* MatchText(const AutocompleteMatch& match, |
| 77 NSFont* font); |
| 76 | 78 |
| 77 // Helper for MatchText() to allow sharing code between the contents | 79 // Helper for MatchText() to allow sharing code between the contents |
| 78 // and description cases. Returns NSMutableAttributedString as a | 80 // and description cases. Returns NSMutableAttributedString as a |
| 79 // convenience for MatchText(). | 81 // convenience for MatchText(). |
| 80 static NSMutableAttributedString* DecorateMatchedString( | 82 static NSMutableAttributedString* DecorateMatchedString( |
| 81 const std::wstring &matchString, | 83 const std::wstring &matchString, |
| 82 const AutocompleteMatch::ACMatchClassifications &classifications, | 84 const AutocompleteMatch::ACMatchClassifications &classifications, |
| 83 NSColor* textColor); | 85 NSColor* textColor, NSFont* font); |
| 84 | 86 |
| 85 private: | 87 private: |
| 86 // Create the popup_ instance if needed. | 88 // Create the popup_ instance if needed. |
| 87 void CreatePopupIfNeeded(); | 89 void CreatePopupIfNeeded(); |
| 88 | 90 |
| 89 scoped_ptr<AutocompletePopupModel> model_; | 91 scoped_ptr<AutocompletePopupModel> model_; |
| 90 AutocompleteEditViewMac* edit_view_; | 92 AutocompleteEditViewMac* edit_view_; |
| 91 | 93 |
| 92 NSTextField* field_; // owned by tab controller | 94 NSTextField* field_; // owned by tab controller |
| 93 | 95 |
| 94 scoped_nsobject<AutocompleteMatrixTarget> matrix_target_; | 96 scoped_nsobject<AutocompleteMatrixTarget> matrix_target_; |
| 95 // TODO(shess): Before checkin review implementation to make sure | 97 // TODO(shess): Before checkin review implementation to make sure |
| 96 // that popup_'s object hierarchy doesn't keep references to | 98 // that popup_'s object hierarchy doesn't keep references to |
| 97 // destructed objects. | 99 // destructed objects. |
| 98 scoped_nsobject<NSWindow> popup_; | 100 scoped_nsobject<NSWindow> popup_; |
| 99 | 101 |
| 100 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupViewMac); | 102 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupViewMac); |
| 101 }; | 103 }; |
| 102 | 104 |
| 103 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_MAC_H_ | 105 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_MAC_H_ |
| OLD | NEW |