| 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/tab_capture/tab_capture_registry.h" | 5 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/sessions/session_tab_helper.h" | 9 #include "chrome/browser/sessions/session_tab_helper.h" |
| 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 void TabCaptureRegistry::DispatchStatusChangeEvent( | 306 void TabCaptureRegistry::DispatchStatusChangeEvent( |
| 307 const LiveRequest* request) const { | 307 const LiveRequest* request) const { |
| 308 EventRouter* router = EventRouter::Get(browser_context_); | 308 EventRouter* router = EventRouter::Get(browser_context_); |
| 309 if (!router) | 309 if (!router) |
| 310 return; | 310 return; |
| 311 | 311 |
| 312 scoped_ptr<base::ListValue> args(new base::ListValue()); | 312 scoped_ptr<base::ListValue> args(new base::ListValue()); |
| 313 tab_capture::CaptureInfo info; | 313 tab_capture::CaptureInfo info; |
| 314 request->GetCaptureInfo(&info); | 314 request->GetCaptureInfo(&info); |
| 315 args->Append(info.ToValue().release()); | 315 args->Append(info.ToValue().release()); |
| 316 scoped_ptr<Event> event(new Event(tab_capture::OnStatusChanged::kEventName, | 316 scoped_ptr<Event> event(new Event( |
| 317 args.Pass())); | 317 events::UNKNOWN, tab_capture::OnStatusChanged::kEventName, args.Pass())); |
| 318 event->restrict_to_browser_context = browser_context_; | 318 event->restrict_to_browser_context = browser_context_; |
| 319 | 319 |
| 320 router->DispatchEventToExtension(request->extension_id(), event.Pass()); | 320 router->DispatchEventToExtension(request->extension_id(), event.Pass()); |
| 321 } | 321 } |
| 322 | 322 |
| 323 TabCaptureRegistry::LiveRequest* TabCaptureRegistry::FindRequest( | 323 TabCaptureRegistry::LiveRequest* TabCaptureRegistry::FindRequest( |
| 324 const content::WebContents* target_contents) const { | 324 const content::WebContents* target_contents) const { |
| 325 for (ScopedVector<LiveRequest>::const_iterator it = requests_.begin(); | 325 for (ScopedVector<LiveRequest>::const_iterator it = requests_.begin(); |
| 326 it != requests_.end(); ++it) { | 326 it != requests_.end(); ++it) { |
| 327 if ((*it)->web_contents() == target_contents) | 327 if ((*it)->web_contents() == target_contents) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 348 it != requests_.end(); ++it) { | 348 it != requests_.end(); ++it) { |
| 349 if ((*it) == request) { | 349 if ((*it) == request) { |
| 350 requests_.erase(it); | 350 requests_.erase(it); |
| 351 return; | 351 return; |
| 352 } | 352 } |
| 353 } | 353 } |
| 354 NOTREACHED(); | 354 NOTREACHED(); |
| 355 } | 355 } |
| 356 | 356 |
| 357 } // namespace extensions | 357 } // namespace extensions |
| OLD | NEW |