| 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 30 matching lines...) Expand all Loading... |
| 41 is_fullscreened_(false), | 41 is_fullscreened_(false), |
| 42 render_process_id_(-1), | 42 render_process_id_(-1), |
| 43 render_frame_id_(-1) { | 43 render_frame_id_(-1) { |
| 44 DCHECK(web_contents()); | 44 DCHECK(web_contents()); |
| 45 DCHECK(registry_); | 45 DCHECK(registry_); |
| 46 } | 46 } |
| 47 | 47 |
| 48 virtual ~LiveRequest() {} | 48 virtual ~LiveRequest() {} |
| 49 | 49 |
| 50 // Accessors. | 50 // Accessors. |
| 51 const content::WebContents* target_contents() const { | |
| 52 return content::WebContentsObserver::web_contents(); | |
| 53 } | |
| 54 const std::string& extension_id() const { | 51 const std::string& extension_id() const { |
| 55 return extension_id_; | 52 return extension_id_; |
| 56 } | 53 } |
| 57 TabCaptureState capture_state() const { | 54 TabCaptureState capture_state() const { |
| 58 return capture_state_; | 55 return capture_state_; |
| 59 } | 56 } |
| 60 bool is_verified() const { | 57 bool is_verified() const { |
| 61 return is_verified_; | 58 return is_verified_; |
| 62 } | 59 } |
| 63 | 60 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 args.Pass())); | 317 args.Pass())); |
| 321 event->restrict_to_browser_context = browser_context_; | 318 event->restrict_to_browser_context = browser_context_; |
| 322 | 319 |
| 323 router->DispatchEventToExtension(request->extension_id(), event.Pass()); | 320 router->DispatchEventToExtension(request->extension_id(), event.Pass()); |
| 324 } | 321 } |
| 325 | 322 |
| 326 TabCaptureRegistry::LiveRequest* TabCaptureRegistry::FindRequest( | 323 TabCaptureRegistry::LiveRequest* TabCaptureRegistry::FindRequest( |
| 327 const content::WebContents* target_contents) const { | 324 const content::WebContents* target_contents) const { |
| 328 for (ScopedVector<LiveRequest>::const_iterator it = requests_.begin(); | 325 for (ScopedVector<LiveRequest>::const_iterator it = requests_.begin(); |
| 329 it != requests_.end(); ++it) { | 326 it != requests_.end(); ++it) { |
| 330 if ((*it)->target_contents() == target_contents) | 327 if ((*it)->web_contents() == target_contents) |
| 331 return *it; | 328 return *it; |
| 332 } | 329 } |
| 333 return NULL; | 330 return NULL; |
| 334 } | 331 } |
| 335 | 332 |
| 336 TabCaptureRegistry::LiveRequest* TabCaptureRegistry::FindRequest( | 333 TabCaptureRegistry::LiveRequest* TabCaptureRegistry::FindRequest( |
| 337 int original_target_render_process_id, | 334 int original_target_render_process_id, |
| 338 int original_target_render_frame_id) const { | 335 int original_target_render_frame_id) const { |
| 339 for (ScopedVector<LiveRequest>::const_iterator it = requests_.begin(); | 336 for (ScopedVector<LiveRequest>::const_iterator it = requests_.begin(); |
| 340 it != requests_.end(); ++it) { | 337 it != requests_.end(); ++it) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 351 it != requests_.end(); ++it) { | 348 it != requests_.end(); ++it) { |
| 352 if ((*it) == request) { | 349 if ((*it) == request) { |
| 353 requests_.erase(it); | 350 requests_.erase(it); |
| 354 return; | 351 return; |
| 355 } | 352 } |
| 356 } | 353 } |
| 357 NOTREACHED(); | 354 NOTREACHED(); |
| 358 } | 355 } |
| 359 | 356 |
| 360 } // namespace extensions | 357 } // namespace extensions |
| OLD | NEW |