OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/notifications/platform_notification_service_impl.h" | 5 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
6 | 6 |
7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 78 } |
79 | 79 |
80 PlatformNotificationServiceImpl::PlatformNotificationServiceImpl() | 80 PlatformNotificationServiceImpl::PlatformNotificationServiceImpl() |
81 : notification_ui_manager_for_tests_(nullptr) {} | 81 : notification_ui_manager_for_tests_(nullptr) {} |
82 | 82 |
83 PlatformNotificationServiceImpl::~PlatformNotificationServiceImpl() {} | 83 PlatformNotificationServiceImpl::~PlatformNotificationServiceImpl() {} |
84 | 84 |
85 void PlatformNotificationServiceImpl::OnPersistentNotificationClick( | 85 void PlatformNotificationServiceImpl::OnPersistentNotificationClick( |
86 BrowserContext* browser_context, | 86 BrowserContext* browser_context, |
87 int64_t persistent_notification_id, | 87 int64_t persistent_notification_id, |
88 const GURL& origin) const { | 88 const GURL& origin, |
| 89 int action_index) const { |
89 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 90 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
90 content::NotificationEventDispatcher::GetInstance() | 91 content::NotificationEventDispatcher::GetInstance() |
91 ->DispatchNotificationClickEvent( | 92 ->DispatchNotificationClickEvent( |
92 browser_context, | 93 browser_context, |
93 persistent_notification_id, | 94 persistent_notification_id, |
94 origin, | 95 origin, |
| 96 action_index, |
95 base::Bind(&OnEventDispatchComplete)); | 97 base::Bind(&OnEventDispatchComplete)); |
96 } | 98 } |
97 | 99 |
98 void PlatformNotificationServiceImpl::OnPersistentNotificationClose( | 100 void PlatformNotificationServiceImpl::OnPersistentNotificationClose( |
99 BrowserContext* browser_context, | 101 BrowserContext* browser_context, |
100 int64_t persistent_notification_id, | 102 int64_t persistent_notification_id, |
101 const GURL& origin) const { | 103 const GURL& origin) const { |
102 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 104 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
103 PlatformNotificationContext* context = | 105 PlatformNotificationContext* context = |
104 BrowserContext::GetStoragePartitionForSite(browser_context, origin) | 106 BrowserContext::GetStoragePartitionForSite(browser_context, origin) |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 formatted_origin.push_back(':'); | 404 formatted_origin.push_back(':'); |
403 formatted_origin.append(base::UTF8ToUTF16(origin.port())); | 405 formatted_origin.append(base::UTF8ToUTF16(origin.port())); |
404 } | 406 } |
405 return formatted_origin; | 407 return formatted_origin; |
406 } | 408 } |
407 | 409 |
408 // TODO(dewittj): Once file:// URLs are passed in to the origin | 410 // TODO(dewittj): Once file:// URLs are passed in to the origin |
409 // GURL here, begin returning the path as the display name. | 411 // GURL here, begin returning the path as the display name. |
410 return net::FormatUrl(origin, languages); | 412 return net::FormatUrl(origin, languages); |
411 } | 413 } |
OLD | NEW |