Chromium Code Reviews| 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> |
|
Robert Sesek
2016/09/29 14:23:05
Appkit seems unused.
Miguel Garcia
2016/10/03 16:07:52
Done.
|
| +#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. |
|
Robert Sesek
2016/09/29 14:23:05
Can we file a bug for this? Otherwise we leave a p
Miguel Garcia
2016/10/03 16:07:51
Make sense, crbug.com/652237 made it block the mai
|
| + xpc_transaction_begin(); |
| + |
| + [listener resume]; |
| + |
| + return 0; |
| + } |
| +} |