OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/guest_view/browser/guest_view_event.h" | 5 #include "components/guest_view/browser/guest_view_event.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
| 9 #include "base/logging.h" |
9 #include "components/guest_view/browser/guest_view_base.h" | 10 #include "components/guest_view/browser/guest_view_base.h" |
10 #include "components/guest_view/browser/guest_view_manager.h" | 11 #include "components/guest_view/browser/guest_view_manager.h" |
11 | 12 |
12 namespace guest_view { | 13 namespace guest_view { |
13 | 14 |
14 GuestViewEvent::GuestViewEvent(const std::string& name, | 15 GuestViewEvent::GuestViewEvent(const std::string& name, |
15 scoped_ptr<base::DictionaryValue> args) | 16 scoped_ptr<base::DictionaryValue> args) |
16 : name_(name), args_(std::move(args)) {} | 17 : name_(name), args_(std::move(args)) {} |
17 | 18 |
18 GuestViewEvent::~GuestViewEvent() { | 19 GuestViewEvent::~GuestViewEvent() { |
19 } | 20 } |
20 | 21 |
21 void GuestViewEvent::Dispatch(GuestViewBase* guest, int instance_id) { | 22 void GuestViewEvent::Dispatch(GuestViewBase* guest, int instance_id) { |
| 23 DCHECK(args_) << "Dispatch was probably invoked twice!"; |
22 GuestViewManager::FromBrowserContext(guest->browser_context()) | 24 GuestViewManager::FromBrowserContext(guest->browser_context()) |
23 ->DispatchEvent(name_, std::move(args_), guest, instance_id); | 25 ->DispatchEvent(name_, std::move(args_), guest, instance_id); |
24 | |
25 delete this; | |
26 } | 26 } |
27 | 27 |
28 } // namespace guest_view | 28 } // namespace guest_view |
OLD | NEW |