| OLD | NEW |
| 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 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // Implements OmniboxPopupView using a raw NSWindow containing an | 25 // Implements OmniboxPopupView using a raw NSWindow containing an |
| 26 // NSTableView. | 26 // NSTableView. |
| 27 class OmniboxPopupViewMac : public OmniboxPopupView, | 27 class OmniboxPopupViewMac : public OmniboxPopupView, |
| 28 public OmniboxPopupMatrixObserver { | 28 public OmniboxPopupMatrixObserver { |
| 29 public: | 29 public: |
| 30 OmniboxPopupViewMac(OmniboxView* omnibox_view, | 30 OmniboxPopupViewMac(OmniboxView* omnibox_view, |
| 31 OmniboxEditModel* edit_model, | 31 OmniboxEditModel* edit_model, |
| 32 NSTextField* field); | 32 NSTextField* field); |
| 33 ~OmniboxPopupViewMac() override; | 33 ~OmniboxPopupViewMac() override; |
| 34 | 34 |
| 35 // Return the OmniboxPopupViewMac background color. |
| 36 static NSColor* BackgroundColor(bool is_dark_theme); |
| 37 |
| 35 // Overridden from OmniboxPopupView: | 38 // Overridden from OmniboxPopupView: |
| 36 bool IsOpen() const override; | 39 bool IsOpen() const override; |
| 37 void InvalidateLine(size_t line) override {} | 40 void InvalidateLine(size_t line) override {} |
| 38 void OnLineSelected(size_t line) override {} | 41 void OnLineSelected(size_t line) override {} |
| 39 void UpdatePopupAppearance() override; | 42 void UpdatePopupAppearance() override; |
| 40 gfx::Rect GetTargetBounds() override; | 43 gfx::Rect GetTargetBounds() override; |
| 41 // This is only called by model in SetSelectedLine() after updating | 44 // This is only called by model in SetSelectedLine() after updating |
| 42 // everything. Popup should already be visible. | 45 // everything. Popup should already be visible. |
| 43 void PaintUpdatesNow() override; | 46 void PaintUpdatesNow() override; |
| 44 void OnDragCanceled() override {} | 47 void OnDragCanceled() override {} |
| 45 | 48 |
| 46 // Overridden from OmniboxPopupMatrixDelegate: | 49 // Overridden from OmniboxPopupMatrixDelegate: |
| 47 void OnMatrixRowSelected(OmniboxPopupMatrix* matrix, size_t row) override; | 50 void OnMatrixRowSelected(OmniboxPopupMatrix* matrix, size_t row) override; |
| 48 void OnMatrixRowClicked(OmniboxPopupMatrix* matrix, size_t row) override; | 51 void OnMatrixRowClicked(OmniboxPopupMatrix* matrix, size_t row) override; |
| 49 void OnMatrixRowMiddleClicked(OmniboxPopupMatrix* matrix, | 52 void OnMatrixRowMiddleClicked(OmniboxPopupMatrix* matrix, |
| 50 size_t row) override; | 53 size_t row) override; |
| 51 | 54 |
| 52 // Returns the NSImage that should be used as an icon for the given match. | 55 // Returns the NSImage that should be used as an icon for the given match. |
| 53 NSImage* ImageForMatch(const AutocompleteMatch& match) const; | 56 NSImage* ImageForMatch(const AutocompleteMatch& match, |
| 57 BOOL ignore_dark_theme) const; |
| 54 | 58 |
| 55 OmniboxPopupMatrix* matrix() { return matrix_; } | 59 OmniboxPopupMatrix* matrix() { return matrix_; } |
| 56 | 60 |
| 57 protected: | 61 protected: |
| 58 // Gets the autocomplete results. This is virtual so that it can be overridden | 62 // Gets the autocomplete results. This is virtual so that it can be overridden |
| 59 // by tests. | 63 // by tests. |
| 60 virtual const AutocompleteResult& GetResult() const; | 64 virtual const AutocompleteResult& GetResult() const; |
| 61 | 65 |
| 62 private: | 66 private: |
| 63 // Create the popup_ instance if needed. | 67 // Create the popup_ instance if needed. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 84 | 88 |
| 85 base::scoped_nsobject<OmniboxPopupMatrix> matrix_; | 89 base::scoped_nsobject<OmniboxPopupMatrix> matrix_; |
| 86 base::scoped_nsobject<NSView> top_separator_view_; | 90 base::scoped_nsobject<NSView> top_separator_view_; |
| 87 base::scoped_nsobject<NSView> bottom_separator_view_; | 91 base::scoped_nsobject<NSView> bottom_separator_view_; |
| 88 base::scoped_nsobject<NSBox> background_view_; | 92 base::scoped_nsobject<NSBox> background_view_; |
| 89 | 93 |
| 90 DISALLOW_COPY_AND_ASSIGN(OmniboxPopupViewMac); | 94 DISALLOW_COPY_AND_ASSIGN(OmniboxPopupViewMac); |
| 91 }; | 95 }; |
| 92 | 96 |
| 93 #endif // CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_VIEW_MAC_H_ | 97 #endif // CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_VIEW_MAC_H_ |
| OLD | NEW |