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/media/media_stream_capture_indicator.h" | 5 #include "chrome/browser/media/media_stream_capture_indicator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 const content::MediaStreamDevices& devices); | 149 const content::MediaStreamDevices& devices); |
150 | 150 |
151 // Increment ref-counts up based on the type of each device provided. | 151 // Increment ref-counts up based on the type of each device provided. |
152 void AddDevices(const content::MediaStreamDevices& devices); | 152 void AddDevices(const content::MediaStreamDevices& devices); |
153 | 153 |
154 // Decrement ref-counts up based on the type of each device provided. | 154 // Decrement ref-counts up based on the type of each device provided. |
155 void RemoveDevices(const content::MediaStreamDevices& devices); | 155 void RemoveDevices(const content::MediaStreamDevices& devices); |
156 | 156 |
157 private: | 157 private: |
158 // content::WebContentsObserver overrides. | 158 // content::WebContentsObserver overrides. |
159 virtual void WebContentsDestroyed() OVERRIDE { | 159 virtual void WebContentsDestroyed() override { |
160 indicator_->UnregisterWebContents(web_contents()); | 160 indicator_->UnregisterWebContents(web_contents()); |
161 delete this; | 161 delete this; |
162 } | 162 } |
163 | 163 |
164 scoped_refptr<MediaStreamCaptureIndicator> indicator_; | 164 scoped_refptr<MediaStreamCaptureIndicator> indicator_; |
165 int audio_ref_count_; | 165 int audio_ref_count_; |
166 int video_ref_count_; | 166 int video_ref_count_; |
167 int mirroring_ref_count_; | 167 int mirroring_ref_count_; |
168 | 168 |
169 base::WeakPtrFactory<WebContentsDeviceUsage> weak_factory_; | 169 base::WeakPtrFactory<WebContentsDeviceUsage> weak_factory_; |
(...skipping 18 matching lines...) Expand all Loading... |
188 } | 188 } |
189 | 189 |
190 virtual ~UIDelegate() { | 190 virtual ~UIDelegate() { |
191 if (started_ && device_usage_.get()) | 191 if (started_ && device_usage_.get()) |
192 device_usage_->RemoveDevices(devices_); | 192 device_usage_->RemoveDevices(devices_); |
193 } | 193 } |
194 | 194 |
195 private: | 195 private: |
196 // content::MediaStreamUI interface. | 196 // content::MediaStreamUI interface. |
197 virtual gfx::NativeViewId OnStarted(const base::Closure& close_callback) | 197 virtual gfx::NativeViewId OnStarted(const base::Closure& close_callback) |
198 OVERRIDE { | 198 override { |
199 DCHECK(!started_); | 199 DCHECK(!started_); |
200 started_ = true; | 200 started_ = true; |
201 if (device_usage_.get()) | 201 if (device_usage_.get()) |
202 device_usage_->AddDevices(devices_); | 202 device_usage_->AddDevices(devices_); |
203 return 0; | 203 return 0; |
204 } | 204 } |
205 | 205 |
206 base::WeakPtr<WebContentsDeviceUsage> device_usage_; | 206 base::WeakPtr<WebContentsDeviceUsage> device_usage_; |
207 content::MediaStreamDevices devices_; | 207 content::MediaStreamDevices devices_; |
208 bool started_; | 208 bool started_; |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 } else if (audio && !video) { | 477 } else if (audio && !video) { |
478 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_ONLY; | 478 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_ONLY; |
479 *image = *mic_image_; | 479 *image = *mic_image_; |
480 } else if (!audio && video) { | 480 } else if (!audio && video) { |
481 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_VIDEO_ONLY; | 481 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_VIDEO_ONLY; |
482 *image = *camera_image_; | 482 *image = *camera_image_; |
483 } | 483 } |
484 | 484 |
485 *tool_tip = l10n_util::GetStringUTF16(message_id); | 485 *tool_tip = l10n_util::GetStringUTF16(message_id); |
486 } | 486 } |
OLD | NEW |