| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/notification_provider.h" | 5 #include "content/renderer/notification_provider.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "content/common/desktop_notification_messages.h" | 8 #include "content/common/desktop_notification_messages.h" |
| 9 #include "content/common/frame_messages.h" | 9 #include "content/common/frame_messages.h" |
| 10 #include "content/renderer/render_frame_impl.h" | 10 #include "content/renderer/render_frame_impl.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 const WebNotification& notification) { | 60 const WebNotification& notification) { |
| 61 int id; | 61 int id; |
| 62 bool id_found = manager_.GetId(notification, id); | 62 bool id_found = manager_.GetId(notification, id); |
| 63 // Won't be found if the notification has already been closed by the user. | 63 // Won't be found if the notification has already been closed by the user. |
| 64 if (id_found) | 64 if (id_found) |
| 65 manager_.UnregisterNotification(id); | 65 manager_.UnregisterNotification(id); |
| 66 } | 66 } |
| 67 | 67 |
| 68 WebNotificationPresenter::Permission NotificationProvider::checkPermission( | 68 WebNotificationPresenter::Permission NotificationProvider::checkPermission( |
| 69 const WebSecurityOrigin& origin) { | 69 const WebSecurityOrigin& origin) { |
| 70 int permission; | 70 int permission = WebNotificationPresenter::PermissionNotAllowed; |
| 71 Send(new DesktopNotificationHostMsg_CheckPermission( | 71 Send(new DesktopNotificationHostMsg_CheckPermission( |
| 72 routing_id(), | 72 routing_id(), |
| 73 GURL(origin.toString()), | 73 GURL(origin.toString()), |
| 74 &permission)); | 74 &permission)); |
| 75 return static_cast<WebNotificationPresenter::Permission>(permission); | 75 return static_cast<WebNotificationPresenter::Permission>(permission); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void NotificationProvider::requestPermission( | 78 void NotificationProvider::requestPermission( |
| 79 const WebSecurityOrigin& origin, | 79 const WebSecurityOrigin& origin, |
| 80 WebNotificationPermissionCallback* callback) { | 80 WebNotificationPermissionCallback* callback) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 DCHECK(callback); | 145 DCHECK(callback); |
| 146 callback->permissionRequestComplete(); | 146 callback->permissionRequestComplete(); |
| 147 manager_.OnPermissionRequestComplete(id); | 147 manager_.OnPermissionRequestComplete(id); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void NotificationProvider::OnNavigate() { | 150 void NotificationProvider::OnNavigate() { |
| 151 manager_.Clear(); | 151 manager_.Clear(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace content | 154 } // namespace content |
| OLD | NEW |