| 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/guest_view/guest_view_base.h" | 5 #include "chrome/browser/guest_view/guest_view_base.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/guest_view/guest_view_constants.h" | 9 #include "chrome/browser/guest_view/guest_view_constants.h" |
| 10 #include "chrome/browser/guest_view/guest_view_manager.h" | 10 #include "chrome/browser/guest_view/guest_view_manager.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } | 249 } |
| 250 | 250 |
| 251 if (!attached()) { | 251 if (!attached()) { |
| 252 pending_events_.push_back(linked_ptr<Event>(event_ptr.release())); | 252 pending_events_.push_back(linked_ptr<Event>(event_ptr.release())); |
| 253 return; | 253 return; |
| 254 } | 254 } |
| 255 | 255 |
| 256 Profile* profile = Profile::FromBrowserContext(browser_context_); | 256 Profile* profile = Profile::FromBrowserContext(browser_context_); |
| 257 | 257 |
| 258 extensions::EventFilteringInfo info; | 258 extensions::EventFilteringInfo info; |
| 259 info.SetInstanceID(guest_instance_id_); | 259 info.SetInstanceID(view_instance_id_); |
| 260 scoped_ptr<base::ListValue> args(new base::ListValue()); | 260 scoped_ptr<base::ListValue> args(new base::ListValue()); |
| 261 args->Append(event->GetArguments().release()); | 261 args->Append(event->GetArguments().release()); |
| 262 | 262 |
| 263 extensions::EventRouter::DispatchEvent( | 263 extensions::EventRouter::DispatchEvent( |
| 264 embedder_web_contents_, | 264 embedder_web_contents_, |
| 265 profile, | 265 profile, |
| 266 embedder_extension_id_, | 266 embedder_extension_id_, |
| 267 event->name(), | 267 event->name(), |
| 268 args.Pass(), | 268 args.Pass(), |
| 269 extensions::EventRouter::USER_GESTURE_UNKNOWN, | 269 extensions::EventRouter::USER_GESTURE_UNKNOWN, |
| 270 info); | 270 info); |
| 271 } | 271 } |
| 272 | 272 |
| 273 void GuestViewBase::SendQueuedEvents() { | 273 void GuestViewBase::SendQueuedEvents() { |
| 274 if (!attached()) | 274 if (!attached()) |
| 275 return; | 275 return; |
| 276 while (!pending_events_.empty()) { | 276 while (!pending_events_.empty()) { |
| 277 linked_ptr<Event> event_ptr = pending_events_.front(); | 277 linked_ptr<Event> event_ptr = pending_events_.front(); |
| 278 pending_events_.pop_front(); | 278 pending_events_.pop_front(); |
| 279 DispatchEvent(event_ptr.release()); | 279 DispatchEvent(event_ptr.release()); |
| 280 } | 280 } |
| 281 } | 281 } |
| OLD | NEW |