OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/notifications/notification_database.h" | 5 #include "content/browser/notifications/notification_database.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 ¬ification_database_data); | 321 ¬ification_database_data); |
322 if (status != STATUS_OK) | 322 if (status != STATUS_OK) |
323 return status; | 323 return status; |
324 | 324 |
325 if (service_worker_registration_id != kInvalidServiceWorkerRegistrationId && | 325 if (service_worker_registration_id != kInvalidServiceWorkerRegistrationId && |
326 notification_database_data.service_worker_registration_id != | 326 notification_database_data.service_worker_registration_id != |
327 service_worker_registration_id) { | 327 service_worker_registration_id) { |
328 continue; | 328 continue; |
329 } | 329 } |
330 | 330 |
| 331 // Silently ignore the notification if it doesn't have an ID assigned. |
| 332 // TODO(peter): Remove this clause when Chrome 55 has branched. |
| 333 if (notification_database_data.notification_id.empty()) |
| 334 continue; |
| 335 |
331 notification_data_vector->push_back(notification_database_data); | 336 notification_data_vector->push_back(notification_database_data); |
332 } | 337 } |
333 | 338 |
334 return LevelDBStatusToStatus(iter->status()); | 339 return LevelDBStatusToStatus(iter->status()); |
335 } | 340 } |
336 | 341 |
337 NotificationDatabase::Status | 342 NotificationDatabase::Status |
338 NotificationDatabase::DeleteAllNotificationDataInternal( | 343 NotificationDatabase::DeleteAllNotificationDataInternal( |
339 const GURL& origin, | 344 const GURL& origin, |
340 const std::string& tag, | 345 const std::string& tag, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 notification_database_data.notification_id); | 388 notification_database_data.notification_id); |
384 } | 389 } |
385 | 390 |
386 if (deleted_notification_ids->empty()) | 391 if (deleted_notification_ids->empty()) |
387 return STATUS_OK; | 392 return STATUS_OK; |
388 | 393 |
389 return LevelDBStatusToStatus(db_->Write(leveldb::WriteOptions(), &batch)); | 394 return LevelDBStatusToStatus(db_->Write(leveldb::WriteOptions(), &batch)); |
390 } | 395 } |
391 | 396 |
392 } // namespace content | 397 } // namespace content |
OLD | NEW |