Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h

Issue 1099403005: [AiS] changing mac omnibox suggestions form NSMatrix to NSTableView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: autorelease on column data cell Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_VIEW_MAC_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_VIEW_MAC_H_
6 #define CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_VIEW_MAC_H_ 6 #define CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_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 28 matching lines...) Expand all
39 // everything. Popup should already be visible. 39 // everything. Popup should already be visible.
40 void PaintUpdatesNow() override; 40 void PaintUpdatesNow() override;
41 void OnDragCanceled() override {} 41 void OnDragCanceled() override {}
42 42
43 // Overridden from OmniboxPopupMatrixDelegate: 43 // Overridden from OmniboxPopupMatrixDelegate:
44 void OnMatrixRowSelected(OmniboxPopupMatrix* matrix, size_t row) override; 44 void OnMatrixRowSelected(OmniboxPopupMatrix* matrix, size_t row) override;
45 void OnMatrixRowClicked(OmniboxPopupMatrix* matrix, size_t row) override; 45 void OnMatrixRowClicked(OmniboxPopupMatrix* matrix, size_t row) override;
46 void OnMatrixRowMiddleClicked(OmniboxPopupMatrix* matrix, 46 void OnMatrixRowMiddleClicked(OmniboxPopupMatrix* matrix,
47 size_t row) override; 47 size_t row) override;
48 48
49 // Returns the NSImage that should be used as an icon for the given match.
50 NSImage* ImageForMatch(const AutocompleteMatch& match) const;
51
49 OmniboxPopupMatrix* matrix() { return matrix_; } 52 OmniboxPopupMatrix* matrix() { return matrix_; }
50 53
51 protected: 54 protected:
52 // Gets the autocomplete results. This is virtual so that it can be overridden 55 // Gets the autocomplete results. This is virtual so that it can be overridden
53 // by tests. 56 // by tests.
54 virtual const AutocompleteResult& GetResult() const; 57 virtual const AutocompleteResult& GetResult() const;
55 58
56 private: 59 private:
57 // Create the popup_ instance if needed. 60 // Create the popup_ instance if needed.
58 void CreatePopupIfNeeded(); 61 void CreatePopupIfNeeded();
59 62
60 // Calculate the appropriate position for the popup based on the 63 // Calculate the appropriate position for the popup based on the
61 // field's screen position and the given target for the matrix 64 // field's screen position and the given target for the matrix
62 // height, and makes the popup visible. Animates to the new frame 65 // height, and makes the popup visible. Animates to the new frame
63 // if the popup shrinks, snaps to the new frame if the popup grows, 66 // if the popup shrinks, snaps to the new frame if the popup grows,
64 // allows existing animations to continue if the size doesn't 67 // allows existing animations to continue if the size doesn't
65 // change. 68 // change.
66 void PositionPopup(const CGFloat matrixHeight); 69 void PositionPopup(const CGFloat matrixHeight);
67 70
68 // Returns the NSImage that should be used as an icon for the given match.
69 NSImage* ImageForMatch(const AutocompleteMatch& match) const;
70
71 // Opens the URL at the given row. 71 // Opens the URL at the given row.
72 void OpenURLForRow(size_t row, WindowOpenDisposition disposition); 72 void OpenURLForRow(size_t row, WindowOpenDisposition disposition);
73 73
74 OmniboxView* omnibox_view_; 74 OmniboxView* omnibox_view_;
75 scoped_ptr<OmniboxPopupModel> model_; 75 scoped_ptr<OmniboxPopupModel> model_;
76 NSTextField* field_; // owned by tab controller 76 NSTextField* field_; // owned by tab controller
77 77
78 // Child window containing a matrix which implements the popup. 78 // Child window containing a matrix which implements the popup.
79 base::scoped_nsobject<NSWindow> popup_; 79 base::scoped_nsobject<NSWindow> popup_;
80 NSRect target_popup_frame_; 80 NSRect target_popup_frame_;
81 81
82 base::scoped_nsobject<OmniboxPopupMatrix> matrix_; 82 base::scoped_nsobject<OmniboxPopupMatrix> matrix_;
83 base::scoped_nsobject<NSView> top_separator_view_; 83 base::scoped_nsobject<NSView> top_separator_view_;
84 base::scoped_nsobject<NSView> bottom_separator_view_; 84 base::scoped_nsobject<NSView> bottom_separator_view_;
85 base::scoped_nsobject<NSBox> background_view_; 85 base::scoped_nsobject<NSBox> background_view_;
86 86
87 DISALLOW_COPY_AND_ASSIGN(OmniboxPopupViewMac); 87 DISALLOW_COPY_AND_ASSIGN(OmniboxPopupViewMac);
88 }; 88 };
89 89
90 #endif // CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_VIEW_MAC_H_ 90 #endif // CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_VIEW_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698