| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_platform_bridge_mac.h" | 5 #include "chrome/browser/notifications/notification_platform_bridge_mac.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 // The connection to the XPC server in charge of delivering alerts. | 429 // The connection to the XPC server in charge of delivering alerts. |
| 430 base::scoped_nsobject<NSXPCConnection> xpcConnection_; | 430 base::scoped_nsobject<NSXPCConnection> xpcConnection_; |
| 431 } | 431 } |
| 432 | 432 |
| 433 - (instancetype)init { | 433 - (instancetype)init { |
| 434 if ((self = [super init])) { | 434 if ((self = [super init])) { |
| 435 xpcConnection_.reset([[NSXPCConnection alloc] | 435 xpcConnection_.reset([[NSXPCConnection alloc] |
| 436 initWithServiceName: | 436 initWithServiceName: |
| 437 [NSString | 437 [NSString |
| 438 stringWithFormat:notification_constants::kAlertXPCServiceName, | 438 stringWithFormat:notification_constants::kAlertXPCServiceName, |
| 439 [base::mac::OuterBundle() bundleIdentifier]]]); | 439 [base::mac::FrameworkBundle() |
| 440 bundleIdentifier]]]); |
| 440 xpcConnection_.get().remoteObjectInterface = | 441 xpcConnection_.get().remoteObjectInterface = |
| 441 [NSXPCInterface interfaceWithProtocol:@protocol(NotificationDelivery)]; | 442 [NSXPCInterface interfaceWithProtocol:@protocol(NotificationDelivery)]; |
| 442 | 443 |
| 443 xpcConnection_.get().interruptionHandler = ^{ | 444 xpcConnection_.get().interruptionHandler = ^{ |
| 444 LOG(WARNING) << "connection interrupted: interruptionHandler: "; | 445 LOG(WARNING) << "connection interrupted: interruptionHandler: "; |
| 445 // TODO(miguelg): perhaps add some UMA here. | 446 // TODO(miguelg): perhaps add some UMA here. |
| 446 // We will be getting this handler both when the XPC server crashes or | 447 // We will be getting this handler both when the XPC server crashes or |
| 447 // when it decides to close the connection. | 448 // when it decides to close the connection. |
| 448 }; | 449 }; |
| 449 xpcConnection_.get().invalidationHandler = ^{ | 450 xpcConnection_.get().invalidationHandler = ^{ |
| (...skipping 26 matching lines...) Expand all Loading... |
| 476 [[xpcConnection_ remoteObjectProxy] closeAllNotifications]; | 477 [[xpcConnection_ remoteObjectProxy] closeAllNotifications]; |
| 477 } | 478 } |
| 478 | 479 |
| 479 // NotificationReply implementation | 480 // NotificationReply implementation |
| 480 - (void)notificationClick:(NSDictionary*)notificationResponseData { | 481 - (void)notificationClick:(NSDictionary*)notificationResponseData { |
| 481 NotificationPlatformBridgeMac::ProcessNotificationResponse( | 482 NotificationPlatformBridgeMac::ProcessNotificationResponse( |
| 482 notificationResponseData); | 483 notificationResponseData); |
| 483 } | 484 } |
| 484 | 485 |
| 485 @end | 486 @end |
| OLD | NEW |