Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / status_icons / status_icon_mac.h
blob8c7cbfd89d11028e1422789b058ad9b8b9af311c
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_STATUS_ICONS_STATUS_ICON_MAC_H_
6 #define CHROME_BROWSER_UI_COCOA_STATUS_ICONS_STATUS_ICON_MAC_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/compiler_specific.h"
11 #include "base/gtest_prod_util.h"
12 #include "base/mac/scoped_nsobject.h"
13 #include "base/strings/string16.h"
14 #include "chrome/browser/status_icons/desktop_notification_balloon.h"
15 #include "chrome/browser/status_icons/status_icon.h"
17 @class MenuController;
18 @class NSStatusItem;
19 @class StatusItemController;
21 class StatusIconMac : public StatusIcon {
22 public:
23 StatusIconMac();
24 ~StatusIconMac() override;
26 // Overridden from StatusIcon.
27 void SetImage(const gfx::ImageSkia& image) override;
28 void SetToolTip(const base::string16& tool_tip) override;
29 void DisplayBalloon(const gfx::ImageSkia& icon,
30 const base::string16& title,
31 const base::string16& contents) override;
33 bool HasStatusIconMenu();
35 protected:
36 // Overridden from StatusIcon.
37 void UpdatePlatformContextMenu(StatusIconMenuModel* model) override;
39 private:
40 FRIEND_TEST_ALL_PREFIXES(StatusIconMacTest, CreateMenu);
41 FRIEND_TEST_ALL_PREFIXES(StatusIconMacTest, MenuToolTip);
43 void SetToolTip(NSString* toolTip);
44 void CreateMenu(ui::MenuModel* model, NSString* toolTip);
46 // Getter for item_ that allows lazy initialization.
47 NSStatusItem* item();
48 base::scoped_nsobject<NSStatusItem> item_;
50 base::scoped_nsobject<StatusItemController> controller_;
52 // Notification balloon.
53 DesktopNotificationBalloon notification_;
55 base::scoped_nsobject<NSString> toolTip_;
57 // Status menu shown when right-clicking the system icon, if it has been
58 // created by |UpdatePlatformContextMenu|.
59 base::scoped_nsobject<MenuController> menu_;
61 DISALLOW_COPY_AND_ASSIGN(StatusIconMac);
64 #endif // CHROME_BROWSER_UI_COCOA_STATUS_ICONS_STATUS_ICON_MAC_H_