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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 317 |
318 void TabCaptureRegistry::DispatchStatusChangeEvent( | 318 void TabCaptureRegistry::DispatchStatusChangeEvent( |
319 const LiveRequest* request) const { | 319 const LiveRequest* request) const { |
320 if (request->is_anonymous()) | 320 if (request->is_anonymous()) |
321 return; | 321 return; |
322 | 322 |
323 EventRouter* router = EventRouter::Get(browser_context_); | 323 EventRouter* router = EventRouter::Get(browser_context_); |
324 if (!router) | 324 if (!router) |
325 return; | 325 return; |
326 | 326 |
327 scoped_ptr<base::ListValue> args(new base::ListValue()); | 327 std::unique_ptr<base::ListValue> args(new base::ListValue()); |
328 tab_capture::CaptureInfo info; | 328 tab_capture::CaptureInfo info; |
329 request->GetCaptureInfo(&info); | 329 request->GetCaptureInfo(&info); |
330 args->Append(info.ToValue().release()); | 330 args->Append(info.ToValue().release()); |
331 scoped_ptr<Event> event(new Event(events::TAB_CAPTURE_ON_STATUS_CHANGED, | 331 std::unique_ptr<Event> event( |
332 tab_capture::OnStatusChanged::kEventName, | 332 new Event(events::TAB_CAPTURE_ON_STATUS_CHANGED, |
333 std::move(args))); | 333 tab_capture::OnStatusChanged::kEventName, std::move(args))); |
334 event->restrict_to_browser_context = browser_context_; | 334 event->restrict_to_browser_context = browser_context_; |
335 | 335 |
336 router->DispatchEventToExtension(request->extension_id(), std::move(event)); | 336 router->DispatchEventToExtension(request->extension_id(), std::move(event)); |
337 } | 337 } |
338 | 338 |
339 TabCaptureRegistry::LiveRequest* TabCaptureRegistry::FindRequest( | 339 TabCaptureRegistry::LiveRequest* TabCaptureRegistry::FindRequest( |
340 const content::WebContents* target_contents) const { | 340 const content::WebContents* target_contents) const { |
341 for (ScopedVector<LiveRequest>::const_iterator it = requests_.begin(); | 341 for (ScopedVector<LiveRequest>::const_iterator it = requests_.begin(); |
342 it != requests_.end(); ++it) { | 342 it != requests_.end(); ++it) { |
343 if ((*it)->web_contents() == target_contents) | 343 if ((*it)->web_contents() == target_contents) |
(...skipping 20 matching lines...) Expand all Loading... |
364 it != requests_.end(); ++it) { | 364 it != requests_.end(); ++it) { |
365 if ((*it) == request) { | 365 if ((*it) == request) { |
366 requests_.erase(it); | 366 requests_.erase(it); |
367 return; | 367 return; |
368 } | 368 } |
369 } | 369 } |
370 NOTREACHED(); | 370 NOTREACHED(); |
371 } | 371 } |
372 | 372 |
373 } // namespace extensions | 373 } // namespace extensions |
OLD | NEW |