Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: trunk/src/chrome/browser/notifications/notification_ui_manager_mac.mm

Issue 14631021: Revert 199625 "Remove ENABLE_MESSAGE_CENTER" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 #include "chrome/browser/notifications/notification_ui_manager_mac.h" 5 #include "chrome/browser/notifications/notification_ui_manager_mac.h"
6 6
7 #include "base/mac/cocoa_protocols.h" 7 #include "base/mac/cocoa_protocols.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/notifications/notification.h" 10 #include "chrome/browser/notifications/notification.h"
12 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" 11 #include "chrome/browser/notifications/balloon_notification_ui_manager.h"
12
13 #if defined(ENABLE_MESSAGE_CENTER)
14 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/notifications/message_center_notification_manager.h" 15 #include "chrome/browser/notifications/message_center_notification_manager.h"
14 #include "ui/message_center/message_center_util.h" 16 #include "ui/message_center/message_center_util.h"
17 #endif
15 18
16 @class NSUserNotificationCenter; 19 @class NSUserNotificationCenter;
17 20
18 // Since NSUserNotification and NSUserNotificationCenter are new classes in 21 // Since NSUserNotification and NSUserNotificationCenter are new classes in
19 // 10.8, they cannot simply be declared with an @interface. An @implementation 22 // 10.8, they cannot simply be declared with an @interface. An @implementation
20 // is needed to link, but providing one would cause a runtime conflict when 23 // is needed to link, but providing one would cause a runtime conflict when
21 // running on 10.8. Instead, provide the interface defined as a protocol and 24 // running on 10.8. Instead, provide the interface defined as a protocol and
22 // use that instead, because sizeof(id<Protocol>) == sizeof(Class*). In order to 25 // use that instead, because sizeof(id<Protocol>) == sizeof(Class*). In order to
23 // instantiate, use NSClassFromString and simply assign the alloc/init'd result 26 // instantiate, use NSClassFromString and simply assign the alloc/init'd result
24 // to an instance of the proper protocol. This way the compiler, linker, and 27 // to an instance of the proper protocol. This way the compiler, linker, and
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 93
91 NotificationUIManagerMac::ControllerNotification::~ControllerNotification() { 94 NotificationUIManagerMac::ControllerNotification::~ControllerNotification() {
92 [view release]; 95 [view release];
93 delete model; 96 delete model;
94 } 97 }
95 98
96 //////////////////////////////////////////////////////////////////////////////// 99 ////////////////////////////////////////////////////////////////////////////////
97 100
98 // static 101 // static
99 NotificationUIManager* NotificationUIManager::Create(PrefService* local_state) { 102 NotificationUIManager* NotificationUIManager::Create(PrefService* local_state) {
103 #if defined(ENABLE_MESSAGE_CENTER)
100 // TODO(rsesek): Remove this function and merge it with the one in 104 // TODO(rsesek): Remove this function and merge it with the one in
101 // notification_ui_manager.cc. 105 // notification_ui_manager.cc.
102 if (DelegatesToMessageCenter()) { 106 if (DelegatesToMessageCenter()) {
103 return new MessageCenterNotificationManager( 107 return new MessageCenterNotificationManager(
104 g_browser_process->message_center()); 108 g_browser_process->message_center());
105 } 109 }
110 #endif
106 111
107 BalloonNotificationUIManager* balloon_manager = NULL; 112 BalloonNotificationUIManager* balloon_manager = NULL;
108 if (base::mac::IsOSMountainLionOrLater()) 113 if (base::mac::IsOSMountainLionOrLater())
109 balloon_manager = new NotificationUIManagerMac(local_state); 114 balloon_manager = new NotificationUIManagerMac(local_state);
110 else 115 else
111 balloon_manager = new BalloonNotificationUIManager(local_state); 116 balloon_manager = new BalloonNotificationUIManager(local_state);
112 balloon_manager->SetBalloonCollection(BalloonCollection::Create()); 117 balloon_manager->SetBalloonCollection(BalloonCollection::Create());
113 return balloon_manager; 118 return balloon_manager;
114 } 119 }
115 120
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 notification->Click(); 312 notification->Click();
308 } 313 }
309 314
310 - (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center 315 - (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center
311 shouldPresentNotification:(id<CrUserNotification>)nsNotification { 316 shouldPresentNotification:(id<CrUserNotification>)nsNotification {
312 // Always display notifications, regardless of whether the app is foreground. 317 // Always display notifications, regardless of whether the app is foreground.
313 return YES; 318 return YES;
314 } 319 }
315 320
316 @end 321 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698