| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "WebNotificationPresenter.h" | 38 #include "WebNotificationPresenter.h" |
| 39 | 39 |
| 40 #include "Notification.h" | 40 #include "Notification.h" |
| 41 #include "SecurityOrigin.h" | 41 #include "SecurityOrigin.h" |
| 42 #include <wtf/PassRefPtr.h> | 42 #include <wtf/PassRefPtr.h> |
| 43 | 43 |
| 44 using namespace WebCore; | 44 using namespace WebCore; |
| 45 | 45 |
| 46 namespace WebKit { | 46 namespace WebKit { |
| 47 | 47 |
| 48 // Ensure that our publicly defined enum values never get out of sync with the | |
| 49 // ones declared for use within WebCore. | |
| 50 #define COMPILE_ASSERT_MATCHING_ENUM(name) \ | |
| 51 COMPILE_ASSERT(int(WebNotificationPresenter::name) == int(NotificationPresenter::name), name) | |
| 52 | |
| 53 COMPILE_ASSERT_MATCHING_ENUM(PermissionAllowed); | |
| 54 COMPILE_ASSERT_MATCHING_ENUM(PermissionNotAllowed); | |
| 55 COMPILE_ASSERT_MATCHING_ENUM(PermissionDenied); | |
| 56 | |
| 57 class VoidCallbackClient : public WebNotificationPermissionCallback { | 48 class VoidCallbackClient : public WebNotificationPermissionCallback { |
| 58 public: | 49 public: |
| 59 VoidCallbackClient(PassRefPtr<VoidCallback> callback) | 50 VoidCallbackClient(PassRefPtr<VoidCallback> callback) |
| 60 : m_callback(callback) | 51 : m_callback(callback) |
| 61 { | 52 { |
| 62 } | 53 } |
| 63 | 54 |
| 64 virtual void permissionRequestComplete() | 55 virtual void permissionRequestComplete() |
| 65 { | 56 { |
| 66 if (m_callback) | 57 if (m_callback) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 } | 95 } |
| 105 | 96 |
| 106 void NotificationPresenterImpl::requestPermission(SecurityOrigin* origin, PassRefPtr<VoidCallback> callback) | 97 void NotificationPresenterImpl::requestPermission(SecurityOrigin* origin, PassRefPtr<VoidCallback> callback) |
| 107 { | 98 { |
| 108 m_presenter->requestPermission(origin->toString(), new VoidCallbackClient(callback)); | 99 m_presenter->requestPermission(origin->toString(), new VoidCallbackClient(callback)); |
| 109 } | 100 } |
| 110 | 101 |
| 111 } // namespace WebKit | 102 } // namespace WebKit |
| 112 | 103 |
| 113 #endif // ENABLE(NOTIFICATIONS) | 104 #endif // ENABLE(NOTIFICATIONS) |
| OLD | NEW |