- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / notifications / message_center_tray_bridge.h
1 // Copyright (c) 2013 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.
4
5 #ifndef CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_MESSAGE_CENTER_TRAY_BRIDGE_H_
6 #define CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_MESSAGE_CENTER_TRAY_BRIDGE_H_
7
8 #import <AppKit/AppKit.h>
9
10 #include "base/basictypes.h"
11 #include "base/mac/scoped_nsobject.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
14 #include "ui/message_center/message_center_tray_delegate.h"
15
16 @class MCPopupCollection;
17 @class MCStatusItemView;
18 @class MCTrayController;
19
20 namespace message_center {
21 class MessageCenter;
22 class MessageCenterTray;
23 }
24
25 // MessageCenterTrayBridge is the owner of all the Cocoa UI objects for the
26 // message_center. It bridges C++ notifications from the MessageCenterTray to
27 // the various UI objects.
28 class MessageCenterTrayBridge :
29     public message_center::MessageCenterTrayDelegate {
30  public:
31   explicit MessageCenterTrayBridge(
32       message_center::MessageCenter* message_center);
33   virtual ~MessageCenterTrayBridge();
34
35   // message_center::MessageCenterTrayDelegate:
36   virtual void OnMessageCenterTrayChanged() OVERRIDE;
37   virtual bool ShowPopups() OVERRIDE;
38   virtual void HidePopups() OVERRIDE;
39   virtual bool ShowMessageCenter() OVERRIDE;
40   virtual void HideMessageCenter() OVERRIDE;
41   virtual bool ShowNotifierSettings() OVERRIDE;
42   virtual message_center::MessageCenterTray* GetMessageCenterTray() OVERRIDE;
43
44   message_center::MessageCenter* message_center() { return message_center_; }
45
46  private:
47   friend class MessageCenterTrayBridgeTest;
48
49   // Updates the unread count on the status item.
50   void UpdateStatusItem();
51
52   // Opens the message center tray.
53   void OpenTrayWindow();
54
55   // The global, singleton message center model object. Weak.
56   message_center::MessageCenter* message_center_;
57
58   // C++ controller for the notification tray UI.
59   scoped_ptr<message_center::MessageCenterTray> tray_;
60
61   // Obj-C window controller for the notification tray.
62   base::scoped_nsobject<MCTrayController> tray_controller_;
63
64   // View that is displayed on the system menu bar item.
65   base::scoped_nsobject<MCStatusItemView> status_item_view_;
66
67   // Obj-C controller for the on-screen popup notifications.
68   base::scoped_nsobject<MCPopupCollection> popup_collection_;
69
70   // Weak pointer factory to posts tasks to self.
71   base::WeakPtrFactory<MessageCenterTrayBridge> weak_ptr_factory_;
72
73   DISALLOW_COPY_AND_ASSIGN(MessageCenterTrayBridge);
74 };
75
76 #endif  // CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_MESSAGE_CENTER_TRAY_BRIDGE_H_