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 "content/browser/renderer_host/media/media_stream_device_settings.h" | 5 #include "content/browser/renderer_host/media/media_stream_device_settings.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 BrowserThread::IO, FROM_HERE, | 45 BrowserThread::IO, FROM_HERE, |
46 base::Bind(&media_stream::MediaStreamDeviceSettings::PostResponse, | 46 base::Bind(&media_stream::MediaStreamDeviceSettings::PostResponse, |
47 settings_, label, devices)); | 47 settings_, label, devices)); |
48 return; | 48 return; |
49 } else if (settings_) { | 49 } else if (settings_) { |
50 settings_->PostResponse(label, devices); | 50 settings_->PostResponse(label, devices); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 private: | 54 private: |
| 55 friend class base::RefCountedThreadSafe<ResponseCallbackHelper>; |
| 56 ~ResponseCallbackHelper() {} |
| 57 |
55 base::WeakPtr<media_stream::MediaStreamDeviceSettings> settings_; | 58 base::WeakPtr<media_stream::MediaStreamDeviceSettings> settings_; |
56 | 59 |
57 DISALLOW_COPY_AND_ASSIGN(ResponseCallbackHelper); | 60 DISALLOW_COPY_AND_ASSIGN(ResponseCallbackHelper); |
58 }; | 61 }; |
59 | 62 |
60 // Predicate used in find_if below to find a device with a given ID. | 63 // Predicate used in find_if below to find a device with a given ID. |
61 class DeviceIdEquals { | 64 class DeviceIdEquals { |
62 public: | 65 public: |
63 explicit DeviceIdEquals(const std::string& device_id) | 66 explicit DeviceIdEquals(const std::string& device_id) |
64 : device_id_(device_id) { | 67 : device_id_(device_id) { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 delete req->second; | 253 delete req->second; |
251 requests_.erase(req); | 254 requests_.erase(req); |
252 } | 255 } |
253 | 256 |
254 void MediaStreamDeviceSettings::UseFakeUI() { | 257 void MediaStreamDeviceSettings::UseFakeUI() { |
255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 258 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
256 use_fake_ui_ = true; | 259 use_fake_ui_ = true; |
257 } | 260 } |
258 | 261 |
259 } // namespace media_stream | 262 } // namespace media_stream |
OLD | NEW |