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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 public: | 179 public: |
180 UIDelegate(base::WeakPtr<WebContentsDeviceUsage> device_usage, | 180 UIDelegate(base::WeakPtr<WebContentsDeviceUsage> device_usage, |
181 const content::MediaStreamDevices& devices) | 181 const content::MediaStreamDevices& devices) |
182 : device_usage_(device_usage), | 182 : device_usage_(device_usage), |
183 devices_(devices), | 183 devices_(devices), |
184 started_(false) { | 184 started_(false) { |
185 DCHECK(!devices_.empty()); | 185 DCHECK(!devices_.empty()); |
186 } | 186 } |
187 | 187 |
188 virtual ~UIDelegate() { | 188 virtual ~UIDelegate() { |
189 if (started_ && device_usage_) | 189 if (started_ && device_usage_.get()) |
190 device_usage_->RemoveDevices(devices_); | 190 device_usage_->RemoveDevices(devices_); |
191 } | 191 } |
192 | 192 |
193 private: | 193 private: |
194 // content::MediaStreamUI interface. | 194 // content::MediaStreamUI interface. |
195 virtual void OnStarted(const base::Closure& close_callback) OVERRIDE { | 195 virtual void OnStarted(const base::Closure& close_callback) OVERRIDE { |
196 DCHECK(!started_); | 196 DCHECK(!started_); |
197 started_ = true; | 197 started_ = true; |
198 if (device_usage_) | 198 if (device_usage_.get()) |
199 device_usage_->AddDevices(devices_, close_callback); | 199 device_usage_->AddDevices(devices_, close_callback); |
200 } | 200 } |
201 | 201 |
202 base::WeakPtr<WebContentsDeviceUsage> device_usage_; | 202 base::WeakPtr<WebContentsDeviceUsage> device_usage_; |
203 content::MediaStreamDevices devices_; | 203 content::MediaStreamDevices devices_; |
204 bool started_; | 204 bool started_; |
205 | 205 |
206 DISALLOW_COPY_AND_ASSIGN(UIDelegate); | 206 DISALLOW_COPY_AND_ASSIGN(UIDelegate); |
207 }; | 207 }; |
208 | 208 |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 | 562 |
563 status_icon_->SetToolTip(l10n_util::GetStringFUTF16( | 563 status_icon_->SetToolTip(l10n_util::GetStringFUTF16( |
564 message_id, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); | 564 message_id, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); |
565 } | 565 } |
566 | 566 |
567 void MediaStreamCaptureIndicator::OnStopScreenCapture( | 567 void MediaStreamCaptureIndicator::OnStopScreenCapture( |
568 const base::Closure& stop) { | 568 const base::Closure& stop) { |
569 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 569 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
570 stop.Run(); | 570 stop.Run(); |
571 } | 571 } |
OLD | NEW |