| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/blink_notification_service_impl.h" | 5 #include "content/browser/notifications/blink_notification_service_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/browser/notifications/platform_notification_context_impl.h" | 8 #include "content/browser/notifications/platform_notification_context_impl.h" |
| 9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "content/public/browser/content_browser_client.h" | 10 #include "content/public/browser/content_browser_client.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 binding_.set_connection_error_handler( | 40 binding_.set_connection_error_handler( |
| 41 base::Bind(&BlinkNotificationServiceImpl::OnConnectionError, | 41 base::Bind(&BlinkNotificationServiceImpl::OnConnectionError, |
| 42 base::Unretained(this) /* the channel is owned by this */)); | 42 base::Unretained(this) /* the channel is owned by this */)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 BlinkNotificationServiceImpl::~BlinkNotificationServiceImpl() { | 45 BlinkNotificationServiceImpl::~BlinkNotificationServiceImpl() { |
| 46 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 46 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void BlinkNotificationServiceImpl::GetPermissionStatus( | 49 void BlinkNotificationServiceImpl::GetPermissionStatus( |
| 50 const mojo::String& origin, | 50 const std::string& origin, |
| 51 const GetPermissionStatusCallback& callback) { | 51 const GetPermissionStatusCallback& callback) { |
| 52 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 52 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 53 | 53 |
| 54 if (!Service()) { | 54 if (!Service()) { |
| 55 callback.Run(blink::mojom::PermissionStatus::DENIED); | 55 callback.Run(blink::mojom::PermissionStatus::DENIED); |
| 56 return; | 56 return; |
| 57 } | 57 } |
| 58 | 58 |
| 59 blink::mojom::PermissionStatus permission_status = | 59 blink::mojom::PermissionStatus permission_status = |
| 60 Service()->CheckPermissionOnIOThread( | 60 Service()->CheckPermissionOnIOThread(resource_context_, GURL(origin), |
| 61 resource_context_, GURL(origin.get()), render_process_id_); | 61 render_process_id_); |
| 62 | 62 |
| 63 callback.Run(permission_status); | 63 callback.Run(permission_status); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void BlinkNotificationServiceImpl::OnConnectionError() { | 66 void BlinkNotificationServiceImpl::OnConnectionError() { |
| 67 notification_context_->RemoveService(this); | 67 notification_context_->RemoveService(this); |
| 68 // |this| has now been deleted. | 68 // |this| has now been deleted. |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace content | 71 } // namespace content |
| OLD | NEW |