| 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 "content/renderer/active_notification_tracker.h" | 5 #include "content/renderer/active_notification_tracker.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "third_party/WebKit/public/web/WebNotification.h" | 9 #include "third_party/WebKit/public/web/WebNotification.h" |
| 10 #include "third_party/WebKit/public/web/WebNotificationPermissionCallback.h" | |
| 11 | 10 |
| 12 using blink::WebNotification; | 11 using blink::WebNotification; |
| 13 using blink::WebNotificationPermissionCallback; | |
| 14 | 12 |
| 15 namespace content { | 13 namespace content { |
| 16 | 14 |
| 17 ActiveNotificationTracker::ActiveNotificationTracker() {} | 15 ActiveNotificationTracker::ActiveNotificationTracker() {} |
| 18 | 16 |
| 19 ActiveNotificationTracker::~ActiveNotificationTracker() {} | 17 ActiveNotificationTracker::~ActiveNotificationTracker() {} |
| 20 | 18 |
| 21 bool ActiveNotificationTracker::GetId( | 19 bool ActiveNotificationTracker::GetId( |
| 22 const WebNotification& notification, int& id) { | 20 const WebNotification& notification, int& id) { |
| 23 ReverseTable::iterator iter = reverse_notification_table_.find(notification); | 21 ReverseTable::iterator iter = reverse_notification_table_.find(notification); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 reverse_notification_table_.erase(*notification); | 57 reverse_notification_table_.erase(*notification); |
| 60 } | 58 } |
| 61 | 59 |
| 62 void ActiveNotificationTracker::Clear() { | 60 void ActiveNotificationTracker::Clear() { |
| 63 while (!reverse_notification_table_.empty()) { | 61 while (!reverse_notification_table_.empty()) { |
| 64 ReverseTable::iterator iter = reverse_notification_table_.begin(); | 62 ReverseTable::iterator iter = reverse_notification_table_.begin(); |
| 65 UnregisterNotification((*iter).second); | 63 UnregisterNotification((*iter).second); |
| 66 } | 64 } |
| 67 } | 65 } |
| 68 | 66 |
| 69 WebNotificationPermissionCallback* ActiveNotificationTracker::GetCallback( | |
| 70 int id) { | |
| 71 return callback_table_.Lookup(id); | |
| 72 } | |
| 73 | |
| 74 int ActiveNotificationTracker::RegisterPermissionRequest( | |
| 75 WebNotificationPermissionCallback* callback) { | |
| 76 return callback_table_.Add(callback); | |
| 77 } | |
| 78 | |
| 79 void ActiveNotificationTracker::OnPermissionRequestComplete(int id) { | |
| 80 callback_table_.Remove(id); | |
| 81 } | |
| 82 | |
| 83 } // namespace content | 67 } // namespace content |
| OLD | NEW |