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 "ash/content/shell_content_state.h" | 7 #include "ash/content/shell_content_state.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/system/tray/system_tray_notifier.h" | 9 #include "ash/system/tray/system_tray_notifier.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 if (indicator->IsCapturingVideo(web_contents)) | 31 if (indicator->IsCapturingVideo(web_contents)) |
32 *media_state_out |= ash::MEDIA_CAPTURE_VIDEO; | 32 *media_state_out |= ash::MEDIA_CAPTURE_VIDEO; |
33 if (indicator->IsCapturingAudio(web_contents)) | 33 if (indicator->IsCapturingAudio(web_contents)) |
34 *media_state_out |= ash::MEDIA_CAPTURE_AUDIO; | 34 *media_state_out |= ash::MEDIA_CAPTURE_AUDIO; |
35 } | 35 } |
36 | 36 |
37 void GetBrowserMediaCaptureState( | 37 void GetBrowserMediaCaptureState( |
38 const MediaStreamCaptureIndicator* indicator, | 38 const MediaStreamCaptureIndicator* indicator, |
39 const content::BrowserContext* context, | 39 const content::BrowserContext* context, |
40 int* media_state_out) { | 40 int* media_state_out) { |
41 | 41 const BrowserList* desktop_list = BrowserList::GetInstance(); |
42 const BrowserList* desktop_list = | |
43 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | |
44 | 42 |
45 for (BrowserList::BrowserVector::const_iterator iter = desktop_list->begin(); | 43 for (BrowserList::BrowserVector::const_iterator iter = desktop_list->begin(); |
46 iter != desktop_list->end(); | 44 iter != desktop_list->end(); |
47 ++iter) { | 45 ++iter) { |
48 TabStripModel* tab_strip_model = (*iter)->tab_strip_model(); | 46 TabStripModel* tab_strip_model = (*iter)->tab_strip_model(); |
49 for (int i = 0; i < tab_strip_model->count(); ++i) { | 47 for (int i = 0; i < tab_strip_model->count(); ++i) { |
50 content::WebContents* web_contents = tab_strip_model->GetWebContentsAt(i); | 48 content::WebContents* web_contents = tab_strip_model->GetWebContentsAt(i); |
51 if (web_contents->GetBrowserContext() != context) | 49 if (web_contents->GetBrowserContext() != context) |
52 continue; | 50 continue; |
53 GetMediaCaptureState(indicator, web_contents, media_state_out); | 51 GetMediaCaptureState(indicator, web_contents, media_state_out); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 FROM_HERE, | 158 FROM_HERE, |
161 base::Bind(&MediaDelegateChromeOS::NotifyMediaCaptureChange, | 159 base::Bind(&MediaDelegateChromeOS::NotifyMediaCaptureChange, |
162 weak_ptr_factory_.GetWeakPtr())); | 160 weak_ptr_factory_.GetWeakPtr())); |
163 } | 161 } |
164 | 162 |
165 void MediaDelegateChromeOS::NotifyMediaCaptureChange() { | 163 void MediaDelegateChromeOS::NotifyMediaCaptureChange() { |
166 ash::Shell::GetInstance() | 164 ash::Shell::GetInstance() |
167 ->system_tray_notifier() | 165 ->system_tray_notifier() |
168 ->NotifyMediaCaptureChanged(); | 166 ->NotifyMediaCaptureChanged(); |
169 } | 167 } |
OLD | NEW |