| 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/extensions/api/notifications/notifications_api.h" | 5 #include "chrome/browser/extensions/api/notifications/notifications_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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 private: | 178 private: |
| 179 ~NotificationsApiDelegate() override {} | 179 ~NotificationsApiDelegate() override {} |
| 180 | 180 |
| 181 void SendEvent(const std::string& name, | 181 void SendEvent(const std::string& name, |
| 182 EventRouter::UserGestureState user_gesture, | 182 EventRouter::UserGestureState user_gesture, |
| 183 scoped_ptr<base::ListValue> args) { | 183 scoped_ptr<base::ListValue> args) { |
| 184 if (!event_router_) | 184 if (!event_router_) |
| 185 return; | 185 return; |
| 186 | 186 |
| 187 scoped_ptr<Event> event(new Event(name, args.Pass())); | 187 scoped_ptr<Event> event(new Event(events::UNKNOWN, name, args.Pass())); |
| 188 event->user_gesture = user_gesture; | 188 event->user_gesture = user_gesture; |
| 189 event_router_->DispatchEventToExtension(extension_id_, event.Pass()); | 189 event_router_->DispatchEventToExtension(extension_id_, event.Pass()); |
| 190 } | 190 } |
| 191 | 191 |
| 192 void Shutdown() { | 192 void Shutdown() { |
| 193 event_router_ = nullptr; | 193 event_router_ = nullptr; |
| 194 shutdown_notifier_subscription_.reset(); | 194 shutdown_notifier_subscription_.reset(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 scoped_ptr<base::ListValue> CreateBaseEventArgs() { | 197 scoped_ptr<base::ListValue> CreateBaseEventArgs() { |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 ? api::notifications::PERMISSION_LEVEL_GRANTED | 683 ? api::notifications::PERMISSION_LEVEL_GRANTED |
| 684 : api::notifications::PERMISSION_LEVEL_DENIED; | 684 : api::notifications::PERMISSION_LEVEL_DENIED; |
| 685 | 685 |
| 686 SetResult(new base::StringValue(api::notifications::ToString(result))); | 686 SetResult(new base::StringValue(api::notifications::ToString(result))); |
| 687 SendResponse(true); | 687 SendResponse(true); |
| 688 | 688 |
| 689 return true; | 689 return true; |
| 690 } | 690 } |
| 691 | 691 |
| 692 } // namespace extensions | 692 } // namespace extensions |
| OLD | NEW |