OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/notification_object_proxy.h" | 5 #include "chrome/browser/notifications/notification_object_proxy.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/guid.h" | 9 #include "base/guid.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "chrome/browser/notifications/notification_operation_common.h" |
11 #include "chrome/browser/notifications/platform_notification_service_impl.h" | 12 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
12 #include "content/public/browser/desktop_notification_delegate.h" | 13 #include "content/public/browser/desktop_notification_delegate.h" |
13 | 14 |
14 NotificationObjectProxy::NotificationObjectProxy( | 15 NotificationObjectProxy::NotificationObjectProxy( |
15 content::BrowserContext* browser_context, | 16 content::BrowserContext* browser_context, |
16 std::unique_ptr<content::DesktopNotificationDelegate> delegate) | 17 std::unique_ptr<content::DesktopNotificationDelegate> delegate) |
17 : browser_context_(browser_context), | 18 : browser_context_(browser_context), |
18 delegate_(std::move(delegate)), | 19 delegate_(std::move(delegate)), |
19 displayed_(false), | 20 displayed_(false), |
20 id_(base::GenerateGUID()) {} | 21 id_(base::GenerateGUID()) {} |
(...skipping 14 matching lines...) Expand all Loading... |
35 delegate_->NotificationClosed(); | 36 delegate_->NotificationClosed(); |
36 } | 37 } |
37 | 38 |
38 void NotificationObjectProxy::Click() { | 39 void NotificationObjectProxy::Click() { |
39 delegate_->NotificationClick(); | 40 delegate_->NotificationClick(); |
40 } | 41 } |
41 | 42 |
42 void NotificationObjectProxy::ButtonClick(int button_index) { | 43 void NotificationObjectProxy::ButtonClick(int button_index) { |
43 // Notification buttons not are supported for non persistent notifications. | 44 // Notification buttons not are supported for non persistent notifications. |
44 DCHECK_EQ(button_index, 0); | 45 DCHECK_EQ(button_index, 0); |
45 PlatformNotificationServiceImpl::GetInstance()->OpenNotificationSettings( | 46 notification_operation_common::OpenNotificationSettings(browser_context_); |
46 browser_context_); | |
47 } | 47 } |
48 | 48 |
49 void NotificationObjectProxy::SettingsClick() { | 49 void NotificationObjectProxy::SettingsClick() { |
50 PlatformNotificationServiceImpl::GetInstance()->OpenNotificationSettings( | 50 notification_operation_common::OpenNotificationSettings(browser_context_); |
51 browser_context_); | |
52 return; | 51 return; |
53 } | 52 } |
54 | 53 |
55 bool NotificationObjectProxy::ShouldDisplaySettingsButton() { | 54 bool NotificationObjectProxy::ShouldDisplaySettingsButton() { |
56 return true; | 55 return true; |
57 } | 56 } |
58 | 57 |
59 std::string NotificationObjectProxy::id() const { | 58 std::string NotificationObjectProxy::id() const { |
60 return id_; | 59 return id_; |
61 } | 60 } |
OLD | NEW |