Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: content/browser/notifications/notification_database.cc

Issue 2739943006: Do not delete notification ids unknown by the display service (Closed)
Patch Set: keep conent/test/* files Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/notifications/platform_notification_context_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
321 &notification_database_data); 321 &notification_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
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
OLDNEW
« no previous file with comments | « no previous file | content/browser/notifications/platform_notification_context_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698