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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 } | 62 } |
63 virtual void UpdatePopupAppearance(); | 63 virtual void UpdatePopupAppearance(); |
64 | 64 |
65 // This is only called by model in SetSelectedLine() after updating | 65 // This is only called by model in SetSelectedLine() after updating |
66 // everything. Popup should already be visible. | 66 // everything. Popup should already be visible. |
67 virtual void PaintUpdatesNow(); | 67 virtual void PaintUpdatesNow(); |
68 | 68 |
69 // Returns the popup's model. | 69 // Returns the popup's model. |
70 virtual AutocompletePopupModel* GetModel(); | 70 virtual AutocompletePopupModel* GetModel(); |
71 | 71 |
72 // Updates model_'s sense of selected line from the UI before | 72 // Called when the user clicks an item. Opens the hovered item and |
73 // calling edit_view_'s AcceptInput(). Used by internal Objective-C | 73 // potentially dismisses the popup without formally selecting anything in the |
74 // helper object. | 74 // model. |
75 void AcceptInput(); | 75 void OnClick(); |
76 | 76 |
77 // Called when the user middle-clicks an item. Opens the hovered | 77 // Called when the user middle-clicks an item. Opens the hovered |
78 // item in a background tab. | 78 // item in a background tab. |
79 void OnMiddleClick(); | 79 void OnMiddleClick(); |
80 | 80 |
81 // Return the text to show for the match, based on the match's | 81 // Return the text to show for the match, based on the match's |
82 // contents and description. Result will be in |font|, with the | 82 // contents and description. Result will be in |font|, with the |
83 // boldfaced version used for matches. | 83 // boldfaced version used for matches. |
84 static NSAttributedString* MatchText(const AutocompleteMatch& match, | 84 static NSAttributedString* MatchText(const AutocompleteMatch& match, |
85 gfx::Font& font, | 85 gfx::Font& font, |
(...skipping 16 matching lines...) Expand all Loading... |
102 static NSMutableAttributedString* ElideString( | 102 static NSMutableAttributedString* ElideString( |
103 NSMutableAttributedString* aString, | 103 NSMutableAttributedString* aString, |
104 const std::wstring originalString, | 104 const std::wstring originalString, |
105 const gfx::Font& font, | 105 const gfx::Font& font, |
106 const float cellWidth); | 106 const float cellWidth); |
107 | 107 |
108 private: | 108 private: |
109 // Create the popup_ instance if needed. | 109 // Create the popup_ instance if needed. |
110 void CreatePopupIfNeeded(); | 110 void CreatePopupIfNeeded(); |
111 | 111 |
| 112 // Opens the URL corresponding to the given |row|. If |force_background| is |
| 113 // true, forces the URL to open in a background tab. Otherwise, determines |
| 114 // the proper window open disposition from the modifier flags on |[NSEvent |
| 115 // currentEvent]|. |
| 116 void OpenURLForRow(int row, bool force_background); |
| 117 |
112 scoped_ptr<AutocompletePopupModel> model_; | 118 scoped_ptr<AutocompletePopupModel> model_; |
113 AutocompleteEditViewMac* edit_view_; | 119 AutocompleteEditViewMac* edit_view_; |
114 const BubblePositioner* bubble_positioner_; // owned by toolbar controller | 120 const BubblePositioner* bubble_positioner_; // owned by toolbar controller |
115 NSTextField* field_; // owned by tab controller | 121 NSTextField* field_; // owned by tab controller |
116 | 122 |
117 scoped_nsobject<AutocompleteMatrixTarget> matrix_target_; | 123 scoped_nsobject<AutocompleteMatrixTarget> matrix_target_; |
118 // TODO(shess): Before checkin review implementation to make sure | 124 // TODO(shess): Before checkin review implementation to make sure |
119 // that popup_'s object hierarchy doesn't keep references to | 125 // that popup_'s object hierarchy doesn't keep references to |
120 // destructed objects. | 126 // destructed objects. |
121 scoped_nsobject<NSWindow> popup_; | 127 scoped_nsobject<NSWindow> popup_; |
122 | 128 |
123 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupViewMac); | 129 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupViewMac); |
124 }; | 130 }; |
125 | 131 |
126 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_MAC_H_ | 132 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_MAC_H_ |
OLD | NEW |