1 /* 2 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: 7 * 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above 11 * copyright notice, this list of conditions and the following disclaimer 12 * in the documentation and/or other materials provided with the 13 * distribution. 14 * * Neither the name of Google Inc. nor the names of its 15 * contributors may be used to endorse or promote products derived from 16 * this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 #ifndef DO_NO_IMPORTS 32 import "oaidl.idl"; 33 import "ocidl.idl"; 34 #endif 35 36 /*! 37 @category WebDesktopNotification 38 @discussion A class that represents a notification being shown 39 on the user's desktop. It provides the contents of the notification 40 and receives events related to the display. 41 @interface NSObject (WebDesktopNotificationProvider) 42 */ 43 [ 44 object, 45 oleautomation, 46 uuid(0A0AAFA8-C698-4cff-BD28-39614622EEA4), 47 pointer_default(unique) 48 ] 49 interface IWebDesktopNotification : IUnknown 50 { 51 HRESULT isHTML([out, retval] BOOL* result); 52 HRESULT contentsURL([out, retval] BSTR* result); 53 HRESULT iconURL([out, retval] BSTR* result); 54 HRESULT title([out, retval] BSTR* result); 55 HRESULT text([out, retval] BSTR* result); 56 57 HRESULT notifyDisplay(); 58 HRESULT notifyError(); 59 HRESULT notifyClose([in] BOOL xplicit); 60 } 61 62 /*! 63 @category WebDesktopNotificationsDelegate 64 @discussion A class that implements WebDesktopNotificationProvider provides 65 methods that may be used by Javascript to display notifications ("toasts") 66 on the user's desktop. 67 @interface NSObject (WebDesktopNotificationProvider) 68 */ 69 [ 70 object, 71 oleautomation, 72 uuid(09DA073E-38B3-466a-9828-B2915FDD2ECB), 73 pointer_default(unique) 74 ] 75 76 interface IWebDesktopNotificationsDelegate : IUnknown 77 { 78 /*! 79 @method showDesktopNotification: 80 @abstract Show a notification. 81 @param notification The Notification to be shown. 82 */ 83 HRESULT showDesktopNotification([in] IWebDesktopNotification* notification); 84 85 /*! 86 @method cancelDesktopNotification: 87 @abstract Cancel showing a notification (or take it down if it's shown). 88 @param notification The Notification to be canceled. 89 */ 90 HRESULT cancelDesktopNotification([in] IWebDesktopNotification* notification); 91 92 /*! 93 @method notificationDestroyed: 94 @abstract Notify the presenter that the object has been destroyed. The 95 notification need not be un-shown, but events should not be invoked. 96 @param notification The Notification that was destroyed. 97 */ 98 HRESULT notificationDestroyed([in] IWebDesktopNotification* notification); 99 100 /*! 101 @method checkNotificationPermission: 102 @abstract See if the origin context is allowed to show notifications. 103 @param origin The origin to be checked. 104 @param result A value from WebCore::NotificationProvider::Permission enum. 105 */ 106 HRESULT checkNotificationPermission([in] BSTR origin, [out, retval] int* result); 107 108 /*! 109 @method requestNotificationPermission: 110 @abstract Request permission to show notifications on a given origin. 111 @param origin The origin to be requested. 112 */ 113 HRESULT requestNotificationPermission([in] BSTR origin); 114 } 115