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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 base::Bind(&PlatformNotificationContextImpl::CreateServiceOnIO, this, | 113 base::Bind(&PlatformNotificationContextImpl::CreateServiceOnIO, this, |
114 render_process_id, browser_context_->GetResourceContext(), | 114 render_process_id, browser_context_->GetResourceContext(), |
115 base::Passed(&request))); | 115 base::Passed(&request))); |
116 } | 116 } |
117 | 117 |
118 void PlatformNotificationContextImpl::CreateServiceOnIO( | 118 void PlatformNotificationContextImpl::CreateServiceOnIO( |
119 int render_process_id, | 119 int render_process_id, |
120 ResourceContext* resource_context, | 120 ResourceContext* resource_context, |
121 mojo::InterfaceRequest<blink::mojom::NotificationService> request) { | 121 mojo::InterfaceRequest<blink::mojom::NotificationService> request) { |
122 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 122 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
123 services_.push_back(base::WrapUnique(new BlinkNotificationServiceImpl( | 123 services_.push_back(base::MakeUnique<BlinkNotificationServiceImpl>( |
124 this, resource_context, render_process_id, std::move(request)))); | 124 this, resource_context, render_process_id, std::move(request))); |
125 } | 125 } |
126 | 126 |
127 void PlatformNotificationContextImpl::RemoveService( | 127 void PlatformNotificationContextImpl::RemoveService( |
128 BlinkNotificationServiceImpl* service) { | 128 BlinkNotificationServiceImpl* service) { |
129 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 129 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
130 auto services_to_remove = std::remove_if( | 130 auto services_to_remove = std::remove_if( |
131 services_.begin(), services_.end(), | 131 services_.begin(), services_.end(), |
132 [service](const std::unique_ptr<BlinkNotificationServiceImpl>& ptr) { | 132 [service](const std::unique_ptr<BlinkNotificationServiceImpl>& ptr) { |
133 return ptr.get() == service; | 133 return ptr.get() == service; |
134 }); | 134 }); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 | 464 |
465 return path_.Append(kPlatformNotificationsDirectory); | 465 return path_.Append(kPlatformNotificationsDirectory); |
466 } | 466 } |
467 | 467 |
468 void PlatformNotificationContextImpl::SetTaskRunnerForTesting( | 468 void PlatformNotificationContextImpl::SetTaskRunnerForTesting( |
469 const scoped_refptr<base::SequencedTaskRunner>& task_runner) { | 469 const scoped_refptr<base::SequencedTaskRunner>& task_runner) { |
470 task_runner_ = task_runner; | 470 task_runner_ = task_runner; |
471 } | 471 } |
472 | 472 |
473 } // namespace content | 473 } // namespace content |
OLD | NEW |