OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 28 matching lines...) Expand all Loading... |
39 #include "modules/notifications/NotificationClient.h" | 39 #include "modules/notifications/NotificationClient.h" |
40 #include "modules/notifications/NotificationController.h" | 40 #include "modules/notifications/NotificationController.h" |
41 #include "modules/notifications/NotificationOptions.h" | 41 #include "modules/notifications/NotificationOptions.h" |
42 #include "modules/notifications/NotificationPermissionClient.h" | 42 #include "modules/notifications/NotificationPermissionClient.h" |
43 | 43 |
44 namespace blink { | 44 namespace blink { |
45 | 45 |
46 Notification* Notification::create(ExecutionContext* context, const String& titl
e, const NotificationOptions& options) | 46 Notification* Notification::create(ExecutionContext* context, const String& titl
e, const NotificationOptions& options) |
47 { | 47 { |
48 NotificationClient& client = NotificationController::clientFrom(context); | 48 NotificationClient& client = NotificationController::clientFrom(context); |
49 Notification* notification = adoptRefCountedGarbageCollectedWillBeNoop(new N
otification(title, context, &client)); | 49 Notification* notification = new Notification(title, context, &client); |
50 | 50 |
51 notification->setBody(options.body()); | 51 notification->setBody(options.body()); |
52 notification->setTag(options.tag()); | 52 notification->setTag(options.tag()); |
53 notification->setLang(options.lang()); | 53 notification->setLang(options.lang()); |
54 notification->setDir(options.dir()); | 54 notification->setDir(options.dir()); |
55 if (options.hasIcon()) { | 55 if (options.hasIcon()) { |
56 KURL iconUrl = options.icon().isEmpty() ? KURL() : context->completeURL(
options.icon()); | 56 KURL iconUrl = options.icon().isEmpty() ? KURL() : context->completeURL(
options.icon()); |
57 if (!iconUrl.isEmpty() && iconUrl.isValid()) | 57 if (!iconUrl.isEmpty() && iconUrl.isValid()) |
58 notification->setIconUrl(iconUrl); | 58 notification->setIconUrl(iconUrl); |
59 } | 59 } |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 198 |
199 m_asyncRunner.stop(); | 199 m_asyncRunner.stop(); |
200 } | 200 } |
201 | 201 |
202 bool Notification::hasPendingActivity() const | 202 bool Notification::hasPendingActivity() const |
203 { | 203 { |
204 return m_state == NotificationStateShowing || m_asyncRunner.isActive(); | 204 return m_state == NotificationStateShowing || m_asyncRunner.isActive(); |
205 } | 205 } |
206 | 206 |
207 } // namespace blink | 207 } // namespace blink |
OLD | NEW |