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/extensions/api/notification_provider/notification_provi
der_api.h" | 5 #include "chrome/browser/extensions/api/notification_provider/notification_provi
der_api.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/guid.h" | 8 #include "base/guid.h" |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 void NotificationProviderEventRouter::Create( | 58 void NotificationProviderEventRouter::Create( |
59 const std::string& notification_provider_id, | 59 const std::string& notification_provider_id, |
60 const std::string& sender_id, | 60 const std::string& sender_id, |
61 const std::string& notification_id, | 61 const std::string& notification_id, |
62 const api::notifications::NotificationOptions& options) { | 62 const api::notifications::NotificationOptions& options) { |
63 scoped_ptr<base::ListValue> args = | 63 scoped_ptr<base::ListValue> args = |
64 api::notification_provider::OnCreated::Create( | 64 api::notification_provider::OnCreated::Create( |
65 sender_id, notification_id, options); | 65 sender_id, notification_id, options); |
66 | 66 |
67 scoped_ptr<Event> event(new Event( | 67 scoped_ptr<Event> event(new Event( |
68 api::notification_provider::OnCreated::kEventName, args.Pass())); | 68 events::UNKNOWN, api::notification_provider::OnCreated::kEventName, |
| 69 args.Pass())); |
69 | 70 |
70 EventRouter::Get(profile_) | 71 EventRouter::Get(profile_) |
71 ->DispatchEventToExtension(notification_provider_id, event.Pass()); | 72 ->DispatchEventToExtension(notification_provider_id, event.Pass()); |
72 } | 73 } |
73 | 74 |
74 void NotificationProviderEventRouter::Update( | 75 void NotificationProviderEventRouter::Update( |
75 const std::string& notification_provider_id, | 76 const std::string& notification_provider_id, |
76 const std::string& sender_id, | 77 const std::string& sender_id, |
77 const std::string& notification_id, | 78 const std::string& notification_id, |
78 const api::notifications::NotificationOptions& options) { | 79 const api::notifications::NotificationOptions& options) { |
79 scoped_ptr<base::ListValue> args = | 80 scoped_ptr<base::ListValue> args = |
80 api::notification_provider::OnUpdated::Create( | 81 api::notification_provider::OnUpdated::Create( |
81 sender_id, notification_id, options); | 82 sender_id, notification_id, options); |
82 | 83 |
83 scoped_ptr<Event> event(new Event( | 84 scoped_ptr<Event> event(new Event( |
84 api::notification_provider::OnUpdated::kEventName, args.Pass())); | 85 events::UNKNOWN, api::notification_provider::OnUpdated::kEventName, |
| 86 args.Pass())); |
85 | 87 |
86 EventRouter::Get(profile_) | 88 EventRouter::Get(profile_) |
87 ->DispatchEventToExtension(notification_provider_id, event.Pass()); | 89 ->DispatchEventToExtension(notification_provider_id, event.Pass()); |
88 } | 90 } |
89 | 91 |
90 void NotificationProviderEventRouter::Clear( | 92 void NotificationProviderEventRouter::Clear( |
91 const std::string& notification_provider_id, | 93 const std::string& notification_provider_id, |
92 const std::string& sender_id, | 94 const std::string& sender_id, |
93 const std::string& notification_id) { | 95 const std::string& notification_id) { |
94 scoped_ptr<base::ListValue> args = | 96 scoped_ptr<base::ListValue> args = |
95 api::notification_provider::OnCleared::Create(sender_id, notification_id); | 97 api::notification_provider::OnCleared::Create(sender_id, notification_id); |
96 | 98 |
97 scoped_ptr<Event> event(new Event( | 99 scoped_ptr<Event> event(new Event( |
98 api::notification_provider::OnCleared::kEventName, args.Pass())); | 100 events::UNKNOWN, api::notification_provider::OnCleared::kEventName, |
| 101 args.Pass())); |
99 | 102 |
100 EventRouter::Get(profile_) | 103 EventRouter::Get(profile_) |
101 ->DispatchEventToExtension(notification_provider_id, event.Pass()); | 104 ->DispatchEventToExtension(notification_provider_id, event.Pass()); |
102 } | 105 } |
103 | 106 |
104 NotificationProviderNotifyOnClearedFunction:: | 107 NotificationProviderNotifyOnClearedFunction:: |
105 NotificationProviderNotifyOnClearedFunction() { | 108 NotificationProviderNotifyOnClearedFunction() { |
106 } | 109 } |
107 | 110 |
108 NotificationProviderNotifyOnClearedFunction:: | 111 NotificationProviderNotifyOnClearedFunction:: |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 295 |
293 ExtensionFunction::ResponseAction | 296 ExtensionFunction::ResponseAction |
294 NotificationProviderGetAllNotifiersFunction::Run() { | 297 NotificationProviderGetAllNotifiersFunction::Run() { |
295 std::vector<linked_ptr<api::notification_provider::Notifier> > notifiers; | 298 std::vector<linked_ptr<api::notification_provider::Notifier> > notifiers; |
296 | 299 |
297 return RespondNow(ArgumentList( | 300 return RespondNow(ArgumentList( |
298 api::notification_provider::GetAllNotifiers::Results::Create(notifiers))); | 301 api::notification_provider::GetAllNotifiers::Results::Create(notifiers))); |
299 } | 302 } |
300 | 303 |
301 } // namespace extensions | 304 } // namespace extensions |
OLD | NEW |