| 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 "content/public/browser/browser_thread.h" | 7 #include "content/public/browser/browser_thread.h" |
| 8 #include "chrome/browser/extensions/event_names.h" | 8 #include "chrome/browser/extensions/event_names.h" |
| 9 #include "chrome/browser/extensions/event_router.h" | 9 #include "chrome/browser/extensions/event_router.h" |
| 10 #include "chrome/browser/extensions/extension_system.h" | 10 #include "chrome/browser/extensions/extension_system.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 TabCaptureRegistry::TabCaptureRequest& request_info = | 74 TabCaptureRegistry::TabCaptureRequest& request_info = |
| 75 requests_[device.device_id]; | 75 requests_[device.device_id]; |
| 76 request_info.status = state; | 76 request_info.status = state; |
| 77 | 77 |
| 78 scoped_ptr<tab_capture::CaptureInfo> info(new tab_capture::CaptureInfo()); | 78 scoped_ptr<tab_capture::CaptureInfo> info(new tab_capture::CaptureInfo()); |
| 79 info->tab_id = request_info.tab_id; | 79 info->tab_id = request_info.tab_id; |
| 80 info->status = request_info.status; | 80 info->status = request_info.status; |
| 81 | 81 |
| 82 scoped_ptr<base::ListValue> args(new ListValue()); | 82 scoped_ptr<base::ListValue> args(new ListValue()); |
| 83 args->Append(info->ToValue().release()); | 83 args->Append(info->ToValue().release()); |
| 84 router->DispatchEventToExtension(request_info.extension_id, | 84 scoped_ptr<Event> event(new Event( |
| 85 events::kOnTabCaptureStatusChanged, args.Pass(), profile_, GURL()); | 85 events::kOnTabCaptureStatusChanged, args.Pass())); |
| 86 event->restrict_to_profile = profile_; |
| 87 router->DispatchEventToExtension(request_info.extension_id, event.Pass()); |
| 86 } | 88 } |
| 87 | 89 |
| 88 const TabCaptureRegistry::CaptureRequestList | 90 const TabCaptureRegistry::CaptureRequestList |
| 89 TabCaptureRegistry::GetCapturedTabs(const std::string& extension_id) { | 91 TabCaptureRegistry::GetCapturedTabs(const std::string& extension_id) { |
| 90 CaptureRequestList list; | 92 CaptureRequestList list; |
| 91 for (DeviceCaptureRequestMap::iterator it = requests_.begin(); | 93 for (DeviceCaptureRequestMap::iterator it = requests_.begin(); |
| 92 it != requests_.end(); ++it) { | 94 it != requests_.end(); ++it) { |
| 93 if (it->second.extension_id == extension_id) { | 95 if (it->second.extension_id == extension_id) { |
| 94 list.push_back(it->second); | 96 list.push_back(it->second); |
| 95 } | 97 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 184 } |
| 183 | 185 |
| 184 void TabCaptureRegistry::MediaObserverProxy::UpdateOnUIThread( | 186 void TabCaptureRegistry::MediaObserverProxy::UpdateOnUIThread( |
| 185 const content::MediaStreamDevice& device, | 187 const content::MediaStreamDevice& device, |
| 186 const content::MediaRequestState new_state) { | 188 const content::MediaRequestState new_state) { |
| 187 if (handler_) | 189 if (handler_) |
| 188 handler_->HandleRequestUpdateOnUIThread(device, new_state); | 190 handler_->HandleRequestUpdateOnUIThread(device, new_state); |
| 189 } | 191 } |
| 190 | 192 |
| 191 } // namespace extensions | 193 } // namespace extensions |
| OLD | NEW |