OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 26 matching lines...) Expand all Loading... |
37 class OmniboxPopupViewMac : public AutocompletePopupView, | 37 class OmniboxPopupViewMac : public AutocompletePopupView, |
38 public InstantOptInControllerDelegate { | 38 public InstantOptInControllerDelegate { |
39 public: | 39 public: |
40 OmniboxPopupViewMac(OmniboxViewMac* omnibox_view, | 40 OmniboxPopupViewMac(OmniboxViewMac* omnibox_view, |
41 AutocompleteEditModel* edit_model, | 41 AutocompleteEditModel* edit_model, |
42 Profile* profile, | 42 Profile* profile, |
43 NSTextField* field); | 43 NSTextField* field); |
44 virtual ~OmniboxPopupViewMac(); | 44 virtual ~OmniboxPopupViewMac(); |
45 | 45 |
46 // Implement the InstantOptInControllerDelegate interface. | 46 // Implement the InstantOptInControllerDelegate interface. |
47 virtual void UserPressedOptIn(bool opt_in); | 47 virtual void UserPressedOptIn(bool opt_in) OVERRIDE; |
48 | 48 |
49 // Implement the AutocompletePopupView interface. | 49 // Implement the AutocompletePopupView interface. |
50 virtual bool IsOpen() const; | 50 virtual bool IsOpen() const OVERRIDE; |
51 virtual void InvalidateLine(size_t line) { | 51 virtual void InvalidateLine(size_t line) OVERRIDE { |
52 // TODO(shess): Verify that there is no need to implement this. | 52 // TODO(shess): Verify that there is no need to implement this. |
53 // This is currently used in two places in the model: | 53 // This is currently used in two places in the model: |
54 // | 54 // |
55 // When setting the selected line, the selected line is | 55 // When setting the selected line, the selected line is |
56 // invalidated, then the selected line is changed, then the new | 56 // invalidated, then the selected line is changed, then the new |
57 // selected line is invalidated, then PaintUpdatesNow() is called. | 57 // selected line is invalidated, then PaintUpdatesNow() is called. |
58 // For us PaintUpdatesNow() should be sufficient. | 58 // For us PaintUpdatesNow() should be sufficient. |
59 // | 59 // |
60 // Same thing happens when changing the hovered line, except with | 60 // Same thing happens when changing the hovered line, except with |
61 // no call to PaintUpdatesNow(). Since this code does not | 61 // no call to PaintUpdatesNow(). Since this code does not |
62 // currently support special display of the hovered line, there's | 62 // currently support special display of the hovered line, there's |
63 // nothing to do here. | 63 // nothing to do here. |
64 // | 64 // |
65 // deanm indicates that this is an anti-flicker optimization, | 65 // deanm indicates that this is an anti-flicker optimization, |
66 // which we probably cannot utilize (and may not need) so long as | 66 // which we probably cannot utilize (and may not need) so long as |
67 // we're using NSTableView to implement the popup contents. We | 67 // we're using NSTableView to implement the popup contents. We |
68 // may need to move away from NSTableView to implement hover, | 68 // may need to move away from NSTableView to implement hover, |
69 // though. | 69 // though. |
70 } | 70 } |
71 virtual void UpdatePopupAppearance(); | 71 virtual void UpdatePopupAppearance() OVERRIDE; |
72 | 72 |
73 virtual gfx::Rect GetTargetBounds(); | 73 virtual gfx::Rect GetTargetBounds() OVERRIDE; |
74 | 74 |
75 // Set |line| to be selected. | 75 // Set |line| to be selected. |
76 void SetSelectedLine(size_t line); | 76 void SetSelectedLine(size_t line); |
77 | 77 |
78 // This is only called by model in SetSelectedLine() after updating | 78 // This is only called by model in SetSelectedLine() after updating |
79 // everything. Popup should already be visible. | 79 // everything. Popup should already be visible. |
80 virtual void PaintUpdatesNow(); | 80 virtual void PaintUpdatesNow() OVERRIDE; |
81 | 81 |
82 virtual void OnDragCanceled() {} | 82 virtual void OnDragCanceled() OVERRIDE {} |
83 | 83 |
84 // Opens the URL corresponding to the given |row|. If |force_background| is | 84 // Opens the URL corresponding to the given |row|. If |force_background| is |
85 // true, forces the URL to open in a background tab. Otherwise, determines | 85 // true, forces the URL to open in a background tab. Otherwise, determines |
86 // the proper window open disposition from the modifier flags on |[NSApp | 86 // the proper window open disposition from the modifier flags on |[NSApp |
87 // currentEvent]|. | 87 // currentEvent]|. |
88 void OpenURLForRow(int row, bool force_background); | 88 void OpenURLForRow(int row, bool force_background); |
89 | 89 |
90 // Return the text to show for the match, based on the match's | 90 // Return the text to show for the match, based on the match's |
91 // contents and description. Result will be in |font|, with the | 91 // contents and description. Result will be in |font|, with the |
92 // boldfaced version used for matches. | 92 // boldfaced version used for matches. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 // Child window containing a matrix which implements the popup. | 143 // Child window containing a matrix which implements the popup. |
144 scoped_nsobject<NSWindow> popup_; | 144 scoped_nsobject<NSWindow> popup_; |
145 scoped_nsobject<InstantOptInController> opt_in_controller_; | 145 scoped_nsobject<InstantOptInController> opt_in_controller_; |
146 NSRect targetPopupFrame_; | 146 NSRect targetPopupFrame_; |
147 | 147 |
148 DISALLOW_COPY_AND_ASSIGN(OmniboxPopupViewMac); | 148 DISALLOW_COPY_AND_ASSIGN(OmniboxPopupViewMac); |
149 }; | 149 }; |
150 | 150 |
151 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_MAC_H_ | 151 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_MAC_H_ |
OLD | NEW |