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

Unified Diff: chrome/browser/ui/cocoa/notifications/xpc_service_main.mm

Issue 2047643003: DO NOT SUBMIT. Implement an XPCService for notifications. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge to use AlertNotificationService Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/notifications/xpc_service_main.mm
diff --git a/chrome/browser/ui/cocoa/notifications/xpc_service_main.mm b/chrome/browser/ui/cocoa/notifications/xpc_service_main.mm
new file mode 100644
index 0000000000000000000000000000000000000000..e4e9b34b71660ced95ade9e39dc9ecb62acc08df
--- /dev/null
+++ b/chrome/browser/ui/cocoa/notifications/xpc_service_main.mm
@@ -0,0 +1,33 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import <AppKit/AppKit.h>
+#import <Foundation/Foundation.h>
+
+#include "base/mac/scoped_nsobject.h"
+#import "chrome/browser/ui/cocoa/notifications/notification_service_delegate.h"
+
+// The main method of the notification alert xpc service.
+// It is initiaized by Chrome on demand whenever a notification of type alert
+// needs to be displayed.
+// The connection will then remain open in order to receive notification
+// clicks and so until all notifications of type alert are closed.
+int main(int argc, const char* argv[]) {
+ @autoreleasepool {
+ base::scoped_nsobject<ServiceDelegate> delegate(
+ [[ServiceDelegate alloc] init]);
+
+ NSXPCListener* listener = [NSXPCListener serviceListener];
+ listener.delegate = delegate.get();
+
+ // Keep the connection open forever since there is no xpc_transaction_end()
+ // TODO(miguelg): send xpc_transaction_end when no alerts are being
+ // displayed.
+ xpc_transaction_begin();
+
+ [listener resume];
+
+ return 0;
+ }
+}
« no previous file with comments | « chrome/browser/ui/cocoa/notifications/xpc-Info.plist ('k') | chrome/browser/ui/cocoa/profiles/avatar_base_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698