| 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;
|
| + }
|
| +}
|
|
|