OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // contents and description. Result will be in |font|, with the | 95 // contents and description. Result will be in |font|, with the |
96 // boldfaced version used for matches. | 96 // boldfaced version used for matches. |
97 static NSAttributedString* MatchText(const AutocompleteMatch& match, | 97 static NSAttributedString* MatchText(const AutocompleteMatch& match, |
98 gfx::Font& font, | 98 gfx::Font& font, |
99 float cellWidth); | 99 float cellWidth); |
100 | 100 |
101 // Helper for MatchText() to allow sharing code between the contents | 101 // Helper for MatchText() to allow sharing code between the contents |
102 // and description cases. Returns NSMutableAttributedString as a | 102 // and description cases. Returns NSMutableAttributedString as a |
103 // convenience for MatchText(). | 103 // convenience for MatchText(). |
104 static NSMutableAttributedString* DecorateMatchedString( | 104 static NSMutableAttributedString* DecorateMatchedString( |
105 const std::wstring &matchString, | 105 const string16 &matchString, |
106 const AutocompleteMatch::ACMatchClassifications &classifications, | 106 const AutocompleteMatch::ACMatchClassifications &classifications, |
107 NSColor* textColor, NSColor* dimTextColor, gfx::Font& font); | 107 NSColor* textColor, NSColor* dimTextColor, gfx::Font& font); |
108 | 108 |
109 // Helper for MatchText() to elide a marked-up string using | 109 // Helper for MatchText() to elide a marked-up string using |
110 // gfx::ElideText() as a model. Modifies |aString| in place. | 110 // gfx::ElideText() as a model. Modifies |aString| in place. |
111 // TODO(shess): Consider breaking AutocompleteButtonCell out of this | 111 // TODO(shess): Consider breaking AutocompleteButtonCell out of this |
112 // code, and modifying it to have something like -setMatch:, so that | 112 // code, and modifying it to have something like -setMatch:, so that |
113 // these convolutions to expose internals for testing can be | 113 // these convolutions to expose internals for testing can be |
114 // cleaner. | 114 // cleaner. |
115 static NSMutableAttributedString* ElideString( | 115 static NSMutableAttributedString* ElideString( |
116 NSMutableAttributedString* aString, | 116 NSMutableAttributedString* aString, |
117 const std::wstring originalString, | 117 const string16 originalString, |
118 const gfx::Font& font, | 118 const gfx::Font& font, |
119 const float cellWidth); | 119 const float cellWidth); |
120 | 120 |
121 private: | 121 private: |
122 // Returns the AutocompleteMatrix for this popup view. | 122 // Returns the AutocompleteMatrix for this popup view. |
123 AutocompleteMatrix* GetAutocompleteMatrix(); | 123 AutocompleteMatrix* GetAutocompleteMatrix(); |
124 | 124 |
125 // Create the popup_ instance if needed. | 125 // Create the popup_ instance if needed. |
126 void CreatePopupIfNeeded(); | 126 void CreatePopupIfNeeded(); |
127 | 127 |
(...skipping 17 matching lines...) Expand all Loading... |
145 | 145 |
146 // Child window containing a matrix which implements the popup. | 146 // Child window containing a matrix which implements the popup. |
147 scoped_nsobject<NSWindow> popup_; | 147 scoped_nsobject<NSWindow> popup_; |
148 scoped_nsobject<InstantOptInController> opt_in_controller_; | 148 scoped_nsobject<InstantOptInController> opt_in_controller_; |
149 NSRect targetPopupFrame_; | 149 NSRect targetPopupFrame_; |
150 | 150 |
151 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupViewMac); | 151 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupViewMac); |
152 }; | 152 }; |
153 | 153 |
154 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_MAC_H_ | 154 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_MAC_H_ |
OLD | NEW |