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> |
| 8 |
7 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/values.h" | 11 #include "base/values.h" |
10 #include "chrome/browser/sessions/session_tab_helper.h" | 12 #include "chrome/browser/sessions/session_tab_helper.h" |
11 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 13 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
12 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
13 #include "content/public/browser/render_frame_host.h" | 15 #include "content/public/browser/render_frame_host.h" |
14 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
15 #include "content/public/browser/web_contents_observer.h" | 17 #include "content/public/browser/web_contents_observer.h" |
16 #include "extensions/browser/event_router.h" | 18 #include "extensions/browser/event_router.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 EventRouter* router = EventRouter::Get(browser_context_); | 322 EventRouter* router = EventRouter::Get(browser_context_); |
321 if (!router) | 323 if (!router) |
322 return; | 324 return; |
323 | 325 |
324 scoped_ptr<base::ListValue> args(new base::ListValue()); | 326 scoped_ptr<base::ListValue> args(new base::ListValue()); |
325 tab_capture::CaptureInfo info; | 327 tab_capture::CaptureInfo info; |
326 request->GetCaptureInfo(&info); | 328 request->GetCaptureInfo(&info); |
327 args->Append(info.ToValue().release()); | 329 args->Append(info.ToValue().release()); |
328 scoped_ptr<Event> event(new Event(events::TAB_CAPTURE_ON_STATUS_CHANGED, | 330 scoped_ptr<Event> event(new Event(events::TAB_CAPTURE_ON_STATUS_CHANGED, |
329 tab_capture::OnStatusChanged::kEventName, | 331 tab_capture::OnStatusChanged::kEventName, |
330 args.Pass())); | 332 std::move(args))); |
331 event->restrict_to_browser_context = browser_context_; | 333 event->restrict_to_browser_context = browser_context_; |
332 | 334 |
333 router->DispatchEventToExtension(request->extension_id(), event.Pass()); | 335 router->DispatchEventToExtension(request->extension_id(), std::move(event)); |
334 } | 336 } |
335 | 337 |
336 TabCaptureRegistry::LiveRequest* TabCaptureRegistry::FindRequest( | 338 TabCaptureRegistry::LiveRequest* TabCaptureRegistry::FindRequest( |
337 const content::WebContents* target_contents) const { | 339 const content::WebContents* target_contents) const { |
338 for (ScopedVector<LiveRequest>::const_iterator it = requests_.begin(); | 340 for (ScopedVector<LiveRequest>::const_iterator it = requests_.begin(); |
339 it != requests_.end(); ++it) { | 341 it != requests_.end(); ++it) { |
340 if ((*it)->web_contents() == target_contents) | 342 if ((*it)->web_contents() == target_contents) |
341 return *it; | 343 return *it; |
342 } | 344 } |
343 return NULL; | 345 return NULL; |
(...skipping 17 matching lines...) Expand all Loading... |
361 it != requests_.end(); ++it) { | 363 it != requests_.end(); ++it) { |
362 if ((*it) == request) { | 364 if ((*it) == request) { |
363 requests_.erase(it); | 365 requests_.erase(it); |
364 return; | 366 return; |
365 } | 367 } |
366 } | 368 } |
367 NOTREACHED(); | 369 NOTREACHED(); |
368 } | 370 } |
369 | 371 |
370 } // namespace extensions | 372 } // namespace extensions |
OLD | NEW |