| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/tools/test_shell/notification_presenter.h" | 5 #include "webkit/tools/test_shell/notification_presenter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" |
| 7 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 8 #include "base/task.h" | 9 #include "base/task.h" |
| 9 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotification.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotification.h" |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPermis
sionCallback.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPermis
sionCallback.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" |
| 16 | 17 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 notification.iconURL().isEmpty() ? "" : | 68 notification.iconURL().isEmpty() ? "" : |
| 68 notification.iconURL().spec().data(), | 69 notification.iconURL().spec().data(), |
| 69 notification.title().isEmpty() ? "" : | 70 notification.title().isEmpty() ? "" : |
| 70 notification.title().utf8().data(), | 71 notification.title().utf8().data(), |
| 71 notification.body().isEmpty() ? "" : | 72 notification.body().isEmpty() ? "" : |
| 72 notification.body().utf8().data()); | 73 notification.body().utf8().data()); |
| 73 } | 74 } |
| 74 | 75 |
| 75 | 76 |
| 76 WebNotification event_target(notification); | 77 WebNotification event_target(notification); |
| 77 MessageLoop::current()->PostTask(FROM_HERE, | 78 MessageLoop::current()->PostTask( |
| 78 NewRunnableFunction(&DeferredDisplayDispatch, event_target)); | 79 FROM_HERE, base::Bind(&DeferredDisplayDispatch, event_target)); |
| 79 return true; | 80 return true; |
| 80 } | 81 } |
| 81 | 82 |
| 82 void TestNotificationPresenter::cancel(const WebNotification& notification) { | 83 void TestNotificationPresenter::cancel(const WebNotification& notification) { |
| 83 WebString identifier; | 84 WebString identifier; |
| 84 if (notification.isHTML()) | 85 if (notification.isHTML()) |
| 85 identifier = notification.url().spec().utf16(); | 86 identifier = notification.url().spec().utf16(); |
| 86 else | 87 else |
| 87 identifier = notification.title(); | 88 identifier = notification.title(); |
| 88 | 89 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 105 : WebNotificationPresenter::PermissionDenied; | 106 : WebNotificationPresenter::PermissionDenied; |
| 106 } | 107 } |
| 107 | 108 |
| 108 void TestNotificationPresenter::requestPermission( | 109 void TestNotificationPresenter::requestPermission( |
| 109 const WebSecurityOrigin& origin, | 110 const WebSecurityOrigin& origin, |
| 110 WebNotificationPermissionCallback* callback) { | 111 WebNotificationPermissionCallback* callback) { |
| 111 printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %s\n", | 112 printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %s\n", |
| 112 origin.toString().utf8().data()); | 113 origin.toString().utf8().data()); |
| 113 callback->permissionRequestComplete(); | 114 callback->permissionRequestComplete(); |
| 114 } | 115 } |
| OLD | NEW |