Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: chrome/browser/media/media_stream_capture_indicator.cc

Issue 665323004: Standardize usage of virtual/override/final in chrome/browser/media (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 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 10 matching lines...) Expand all
180 : public content::MediaStreamUI { 180 : public content::MediaStreamUI {
181 public: 181 public:
182 UIDelegate(base::WeakPtr<WebContentsDeviceUsage> device_usage, 182 UIDelegate(base::WeakPtr<WebContentsDeviceUsage> device_usage,
183 const content::MediaStreamDevices& devices) 183 const content::MediaStreamDevices& devices)
184 : device_usage_(device_usage), 184 : device_usage_(device_usage),
185 devices_(devices), 185 devices_(devices),
186 started_(false) { 186 started_(false) {
187 DCHECK(!devices_.empty()); 187 DCHECK(!devices_.empty());
188 } 188 }
189 189
190 virtual ~UIDelegate() { 190 ~UIDelegate() override {
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 gfx::NativeViewId OnStarted(const base::Closure& close_callback) override {
198 override {
199 DCHECK(!started_); 198 DCHECK(!started_);
200 started_ = true; 199 started_ = true;
201 if (device_usage_.get()) 200 if (device_usage_.get())
202 device_usage_->AddDevices(devices_); 201 device_usage_->AddDevices(devices_);
203 return 0; 202 return 0;
204 } 203 }
205 204
206 base::WeakPtr<WebContentsDeviceUsage> device_usage_; 205 base::WeakPtr<WebContentsDeviceUsage> device_usage_;
207 content::MediaStreamDevices devices_; 206 content::MediaStreamDevices devices_;
208 bool started_; 207 bool started_;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 } else if (audio && !video) { 476 } else if (audio && !video) {
478 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_ONLY; 477 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_ONLY;
479 *image = *mic_image_; 478 *image = *mic_image_;
480 } else if (!audio && video) { 479 } else if (!audio && video) {
481 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_VIDEO_ONLY; 480 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_VIDEO_ONLY;
482 *image = *camera_image_; 481 *image = *camera_image_;
483 } 482 }
484 483
485 *tool_tip = l10n_util::GetStringUTF16(message_id); 484 *tool_tip = l10n_util::GetStringUTF16(message_id);
486 } 485 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698