Chromium Code Reviews| 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_UI_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_ | 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/mac/scoped_nsobject.h" | 11 #include "base/mac/scoped_nsobject.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" | 13 #include "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" |
| 14 #import "ui/base/cocoa/appkit_utils.h" | 14 #import "ui/base/cocoa/appkit_utils.h" |
|
Peter Kasting
2017/03/07 03:11:07
Nit: This #import shouldn't be in this header, eve
tfarina
2017/03/07 03:17:59
Done.
| |
| 15 | 15 |
| 16 // Draws an outlined rounded rect, with an optional image to the left | 16 // Draws an outlined rounded rect, with an optional image to the left |
| 17 // and an optional text label to the right. | 17 // and an optional text label to the right. |
| 18 | 18 |
| 19 class BubbleDecoration : public LocationBarDecoration { | 19 class BubbleDecoration : public LocationBarDecoration { |
| 20 public: | 20 public: |
| 21 BubbleDecoration(); | 21 BubbleDecoration(); |
| 22 ~BubbleDecoration() override; | 22 ~BubbleDecoration() override; |
| 23 | 23 |
| 24 // Setup the drawing parameters. | 24 // Setup the drawing parameters. |
| 25 NSImage* GetImage(); | 25 NSImage* GetImage(); |
| 26 virtual NSColor* GetBackgroundBorderColor() = 0; | 26 virtual NSColor* GetBackgroundBorderColor() = 0; |
| 27 void SetImage(NSImage* image); | 27 void SetImage(NSImage* image); |
| 28 void SetLabel(NSString* label); | 28 void SetLabel(NSString* label); |
| 29 void SetTextColor(NSColor* text_color); | 29 void SetTextColor(NSColor* text_color); |
| 30 void SetFont(NSFont* font); | 30 void SetFont(NSFont* font); |
| 31 void SetRetinaBaselineOffset(CGFloat offset); | 31 void SetRetinaBaselineOffset(CGFloat offset); |
| 32 virtual ui::NinePartImageIds GetBubbleImageIds() = 0; | |
| 33 | 32 |
| 34 // Implement |LocationBarDecoration|. | 33 // Implement |LocationBarDecoration|. |
| 35 CGFloat GetWidthForSpace(CGFloat width) override; | 34 CGFloat GetWidthForSpace(CGFloat width) override; |
| 36 NSRect GetBackgroundFrame(NSRect frame) override; | 35 NSRect GetBackgroundFrame(NSRect frame) override; |
| 37 void DrawInFrame(NSRect frame, NSView* control_view) override; | 36 void DrawInFrame(NSRect frame, NSView* control_view) override; |
| 38 NSFont* GetFont() const override; | 37 NSFont* GetFont() const override; |
| 39 | 38 |
| 40 protected: | 39 protected: |
| 41 // Returns the amount of padding between the divider and the omnibox text. | 40 // Returns the amount of padding between the divider and the omnibox text. |
| 42 // Returns 0 in non-MD since there's no divider. | 41 // Returns 0 in non-MD since there's no divider. |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 67 FRIEND_TEST_ALL_PREFIXES(SelectedKeywordDecorationTest, | 66 FRIEND_TEST_ALL_PREFIXES(SelectedKeywordDecorationTest, |
| 68 UsesPartialKeywordIfNarrow); | 67 UsesPartialKeywordIfNarrow); |
| 69 | 68 |
| 70 // Contains any Retina-only baseline adjustment for |label_|. | 69 // Contains any Retina-only baseline adjustment for |label_|. |
| 71 CGFloat retina_baseline_offset_; | 70 CGFloat retina_baseline_offset_; |
| 72 | 71 |
| 73 DISALLOW_COPY_AND_ASSIGN(BubbleDecoration); | 72 DISALLOW_COPY_AND_ASSIGN(BubbleDecoration); |
| 74 }; | 73 }; |
| 75 | 74 |
| 76 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_ | 75 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_ |
| OLD | NEW |