| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/ash/media_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/media_delegate_chromeos.h" |
| 6 | 6 |
| 7 #include "apps/app_window.h" | |
| 8 #include "apps/app_window_registry.h" | |
| 9 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 10 #include "ash/system/tray/system_tray_notifier.h" | 8 #include "ash/system/tray/system_tray_notifier.h" |
| 11 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 12 #include "chrome/browser/chromeos/extensions/media_player_api.h" | 10 #include "chrome/browser/chromeos/extensions/media_player_api.h" |
| 13 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" | 11 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" |
| 14 #include "chrome/browser/media/media_stream_capture_indicator.h" | 12 #include "chrome/browser/media/media_stream_capture_indicator.h" |
| 15 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
| 16 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
| 18 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
| 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 20 #include "content/public/browser/render_view_host.h" | 18 #include "content/public/browser/render_view_host.h" |
| 21 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 20 #include "extensions/browser/app_window/app_window.h" |
| 21 #include "extensions/browser/app_window/app_window_registry.h" |
| 22 #include "extensions/browser/extension_system.h" | 22 #include "extensions/browser/extension_system.h" |
| 23 #include "extensions/browser/process_manager.h" | 23 #include "extensions/browser/process_manager.h" |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 void GetMediaCaptureState( | 27 void GetMediaCaptureState( |
| 28 const MediaStreamCaptureIndicator* indicator, | 28 const MediaStreamCaptureIndicator* indicator, |
| 29 content::WebContents* web_contents, | 29 content::WebContents* web_contents, |
| 30 int* media_state_out) { | 30 int* media_state_out) { |
| 31 if (indicator->IsCapturingVideo(web_contents)) | 31 if (indicator->IsCapturingVideo(web_contents)) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 54 if (*media_state_out == ash::MEDIA_CAPTURE_AUDIO_VIDEO) | 54 if (*media_state_out == ash::MEDIA_CAPTURE_AUDIO_VIDEO) |
| 55 return; | 55 return; |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 void GetAppMediaCaptureState( | 60 void GetAppMediaCaptureState( |
| 61 const MediaStreamCaptureIndicator* indicator, | 61 const MediaStreamCaptureIndicator* indicator, |
| 62 content::BrowserContext* context, | 62 content::BrowserContext* context, |
| 63 int* media_state_out) { | 63 int* media_state_out) { |
| 64 const apps::AppWindowRegistry::AppWindowList& apps = | 64 const extensions::AppWindowRegistry::AppWindowList& apps = |
| 65 apps::AppWindowRegistry::Get(context)->app_windows(); | 65 extensions::AppWindowRegistry::Get(context)->app_windows(); |
| 66 for (apps::AppWindowRegistry::AppWindowList::const_iterator iter = | 66 for (extensions::AppWindowRegistry::AppWindowList::const_iterator iter = |
| 67 apps.begin(); | 67 apps.begin(); |
| 68 iter != apps.end(); | 68 iter != apps.end(); |
| 69 ++iter) { | 69 ++iter) { |
| 70 GetMediaCaptureState(indicator, (*iter)->web_contents(), media_state_out); | 70 GetMediaCaptureState(indicator, (*iter)->web_contents(), media_state_out); |
| 71 if (*media_state_out == ash::MEDIA_CAPTURE_AUDIO_VIDEO) | 71 if (*media_state_out == ash::MEDIA_CAPTURE_AUDIO_VIDEO) |
| 72 return; | 72 return; |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 void GetExtensionMediaCaptureState( | 76 void GetExtensionMediaCaptureState( |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 FROM_HERE, | 164 FROM_HERE, |
| 165 base::Bind(&MediaDelegateChromeOS::NotifyMediaCaptureChange, | 165 base::Bind(&MediaDelegateChromeOS::NotifyMediaCaptureChange, |
| 166 weak_ptr_factory_.GetWeakPtr())); | 166 weak_ptr_factory_.GetWeakPtr())); |
| 167 } | 167 } |
| 168 | 168 |
| 169 void MediaDelegateChromeOS::NotifyMediaCaptureChange() { | 169 void MediaDelegateChromeOS::NotifyMediaCaptureChange() { |
| 170 ash::Shell::GetInstance() | 170 ash::Shell::GetInstance() |
| 171 ->system_tray_notifier() | 171 ->system_tray_notifier() |
| 172 ->NotifyMediaCaptureChanged(); | 172 ->NotifyMediaCaptureChanged(); |
| 173 } | 173 } |
| OLD | NEW |