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/platform_notification_context_impl.h" | 5 #include "content/browser/notifications/platform_notification_context_impl.h" |
6 | 6 |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // Synchronize the notifications stored in the database with the set of | 62 // Synchronize the notifications stored in the database with the set of |
63 // displaying notifications in |displayed_notifications|. This is necessary | 63 // displaying notifications in |displayed_notifications|. This is necessary |
64 // because flakiness may cause a platform to inform Chrome of a notification | 64 // because flakiness may cause a platform to inform Chrome of a notification |
65 // that has since been closed, or because the platform does not support | 65 // that has since been closed, or because the platform does not support |
66 // notifications that exceed the lifetime of the browser process. | 66 // notifications that exceed the lifetime of the browser process. |
67 | 67 |
68 // TODO(peter): Synchronizing the actual notifications will be done when the | 68 // TODO(peter): Synchronizing the actual notifications will be done when the |
69 // persistent notification ids are stable. For M44 we need to support the | 69 // persistent notification ids are stable. For M44 we need to support the |
70 // case where there may be no notifications after a Chrome restart. | 70 // case where there may be no notifications after a Chrome restart. |
71 if (notification_synchronization_supported && | 71 if (notification_synchronization_supported && |
72 !displayed_notifications.size()) { | 72 displayed_notifications.empty()) { |
73 prune_database_on_open_ = true; | 73 prune_database_on_open_ = true; |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 BrowserThread::PostTask( | 77 BrowserThread::PostTask( |
78 BrowserThread::IO, FROM_HERE, | 78 BrowserThread::IO, FROM_HERE, |
79 base::Bind(&PlatformNotificationContextImpl::InitializeOnIO, this)); | 79 base::Bind(&PlatformNotificationContextImpl::InitializeOnIO, this)); |
80 } | 80 } |
81 | 81 |
82 void PlatformNotificationContextImpl::InitializeOnIO() { | 82 void PlatformNotificationContextImpl::InitializeOnIO() { |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 | 439 |
440 return path_.Append(kPlatformNotificationsDirectory); | 440 return path_.Append(kPlatformNotificationsDirectory); |
441 } | 441 } |
442 | 442 |
443 void PlatformNotificationContextImpl::SetTaskRunnerForTesting( | 443 void PlatformNotificationContextImpl::SetTaskRunnerForTesting( |
444 const scoped_refptr<base::SequencedTaskRunner>& task_runner) { | 444 const scoped_refptr<base::SequencedTaskRunner>& task_runner) { |
445 task_runner_ = task_runner; | 445 task_runner_ = task_runner; |
446 } | 446 } |
447 | 447 |
448 } // namespace content | 448 } // namespace content |
OLD | NEW |