Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / location_bar / star_decoration.h
blob20a0741d7024a27b832dd18c5c23c1c103abb319
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_STAR_DECORATION_H_
6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_STAR_DECORATION_H_
8 #import <Cocoa/Cocoa.h>
10 #include "chrome/browser/ui/cocoa/location_bar/image_decoration.h"
12 class CommandUpdater;
14 // Star icon on the right side of the field.
16 class StarDecoration : public ImageDecoration {
17 public:
18 explicit StarDecoration(CommandUpdater* command_updater);
19 ~StarDecoration() override;
21 // Sets the image and tooltip based on |starred|.
22 void SetStarred(bool starred);
24 // Returns true if the star is lit.
25 bool starred() const { return starred_; }
27 // Implement |LocationBarDecoration|.
28 bool AcceptsMousePress() override;
29 bool OnMousePressed(NSRect frame, NSPoint location) override;
30 NSString* GetToolTip() override;
31 NSPoint GetBubblePointInFrame(NSRect frame) override;
33 private:
34 // For bringing up bookmark bar.
35 CommandUpdater* command_updater_; // Weak, owned by Browser.
37 // The string to show for a tooltip.
38 base::scoped_nsobject<NSString> tooltip_;
40 // Whether the star icon is lit.
41 bool starred_;
43 DISALLOW_COPY_AND_ASSIGN(StarDecoration);
46 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_STAR_DECORATION_H_