| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2009, 2011, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2009, 2011, 2012 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 #if ENABLE(LEGACY_NOTIFICATIONS) | 62 #if ENABLE(LEGACY_NOTIFICATIONS) |
| 63 Notification::Notification(const KURL& url, ScriptExecutionContext* context, Exc
eptionCode& ec, PassRefPtr<NotificationCenter> provider) | 63 Notification::Notification(const KURL& url, ScriptExecutionContext* context, Exc
eptionCode& ec, PassRefPtr<NotificationCenter> provider) |
| 64 : ActiveDOMObject(context) | 64 : ActiveDOMObject(context) |
| 65 , m_isHTML(true) | 65 , m_isHTML(true) |
| 66 , m_state(Idle) | 66 , m_state(Idle) |
| 67 , m_notificationCenter(provider) | 67 , m_notificationCenter(provider) |
| 68 { | 68 { |
| 69 ScriptWrappable::init(this); | 69 ScriptWrappable::init(this); |
| 70 if (m_notificationCenter->checkPermission() != NotificationClient::Permissio
nAllowed) { | 70 if (m_notificationCenter->checkPermission() != NotificationClient::Permissio
nAllowed) { |
| 71 ec = SECURITY_ERR; | 71 ec = SecurityError; |
| 72 return; | 72 return; |
| 73 } | 73 } |
| 74 | 74 |
| 75 if (url.isEmpty() || !url.isValid()) { | 75 if (url.isEmpty() || !url.isValid()) { |
| 76 ec = SYNTAX_ERR; | 76 ec = SyntaxError; |
| 77 return; | 77 return; |
| 78 } | 78 } |
| 79 | 79 |
| 80 m_notificationURL = url; | 80 m_notificationURL = url; |
| 81 } | 81 } |
| 82 #endif | 82 #endif |
| 83 | 83 |
| 84 #if ENABLE(LEGACY_NOTIFICATIONS) | 84 #if ENABLE(LEGACY_NOTIFICATIONS) |
| 85 Notification::Notification(const String& title, const String& body, const String
& iconURI, ScriptExecutionContext* context, ExceptionCode& ec, PassRefPtr<Notifi
cationCenter> provider) | 85 Notification::Notification(const String& title, const String& body, const String
& iconURI, ScriptExecutionContext* context, ExceptionCode& ec, PassRefPtr<Notifi
cationCenter> provider) |
| 86 : ActiveDOMObject(context) | 86 : ActiveDOMObject(context) |
| 87 , m_isHTML(false) | 87 , m_isHTML(false) |
| 88 , m_title(title) | 88 , m_title(title) |
| 89 , m_body(body) | 89 , m_body(body) |
| 90 , m_state(Idle) | 90 , m_state(Idle) |
| 91 , m_notificationCenter(provider) | 91 , m_notificationCenter(provider) |
| 92 { | 92 { |
| 93 ScriptWrappable::init(this); | 93 ScriptWrappable::init(this); |
| 94 if (m_notificationCenter->checkPermission() != NotificationClient::Permissio
nAllowed) { | 94 if (m_notificationCenter->checkPermission() != NotificationClient::Permissio
nAllowed) { |
| 95 ec = SECURITY_ERR; | 95 ec = SecurityError; |
| 96 return; | 96 return; |
| 97 } | 97 } |
| 98 | 98 |
| 99 m_icon = iconURI.isEmpty() ? KURL() : scriptExecutionContext()->completeURL(
iconURI); | 99 m_icon = iconURI.isEmpty() ? KURL() : scriptExecutionContext()->completeURL(
iconURI); |
| 100 if (!m_icon.isEmpty() && !m_icon.isValid()) { | 100 if (!m_icon.isEmpty() && !m_icon.isValid()) { |
| 101 ec = SYNTAX_ERR; | 101 ec = SyntaxError; |
| 102 return; | 102 return; |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 #endif | 105 #endif |
| 106 | 106 |
| 107 #if ENABLE(NOTIFICATIONS) | 107 #if ENABLE(NOTIFICATIONS) |
| 108 Notification::Notification(ScriptExecutionContext* context, const String& title) | 108 Notification::Notification(ScriptExecutionContext* context, const String& title) |
| 109 : ActiveDOMObject(context) | 109 : ActiveDOMObject(context) |
| 110 , m_isHTML(false) | 110 , m_isHTML(false) |
| 111 , m_title(title) | 111 , m_title(title) |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 void Notification::requestPermission(ScriptExecutionContext* context, PassRefPtr
<NotificationPermissionCallback> callback) | 288 void Notification::requestPermission(ScriptExecutionContext* context, PassRefPtr
<NotificationPermissionCallback> callback) |
| 289 { | 289 { |
| 290 ASSERT(toDocument(context)->page()); | 290 ASSERT(toDocument(context)->page()); |
| 291 NotificationController::from(toDocument(context)->page())->client()->request
Permission(context, callback); | 291 NotificationController::from(toDocument(context)->page())->client()->request
Permission(context, callback); |
| 292 } | 292 } |
| 293 #endif | 293 #endif |
| 294 | 294 |
| 295 } // namespace WebCore | 295 } // namespace WebCore |
| 296 | 296 |
| 297 #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) | 297 #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) |
| OLD | NEW |