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.
5 #include "chrome/browser/ui/cocoa/notifications/message_center_tray_bridge.h"
8 #include "base/i18n/number_formatting.h"
9 #include "base/message_loop/message_loop.h"
10 #include "base/prefs/pref_service.h"
11 #include "base/profiler/scoped_tracker.h"
12 #include "chrome/browser/browser_process.h"
13 #include "chrome/common/pref_names.h"
14 #include "chrome/grit/chromium_strings.h"
15 #include "chrome/grit/generated_resources.h"
16 #include "ui/base/l10n/l10n_util.h"
17 #import "ui/base/l10n/l10n_util_mac.h"
18 #import "ui/message_center/cocoa/popup_collection.h"
19 #include "ui/message_center/message_center.h"
20 #include "ui/message_center/message_center_tray.h"
22 namespace message_center {
24 MessageCenterTrayDelegate* CreateMessageCenterTray() {
25 return new MessageCenterTrayBridge(g_browser_process->message_center());
28 } // namespace message_center
30 MessageCenterTrayBridge::MessageCenterTrayBridge(
31 message_center::MessageCenter* message_center)
32 : message_center_(message_center),
33 tray_(new message_center::MessageCenterTray(this, message_center)) {}
35 MessageCenterTrayBridge::~MessageCenterTrayBridge() {
38 void MessageCenterTrayBridge::OnMessageCenterTrayChanged() {
41 bool MessageCenterTrayBridge::ShowPopups() {
42 popup_collection_.reset(
43 [[MCPopupCollection alloc] initWithMessageCenter:message_center_]);
47 void MessageCenterTrayBridge::HidePopups() {
48 popup_collection_.reset();
51 bool MessageCenterTrayBridge::ShowMessageCenter() {
55 void MessageCenterTrayBridge::HideMessageCenter() {
58 bool MessageCenterTrayBridge::ShowNotifierSettings() {
62 bool MessageCenterTrayBridge::IsContextMenuEnabled() const {
66 message_center::MessageCenterTray*
67 MessageCenterTrayBridge::GetMessageCenterTray() {