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

Unified Diff: chrome/browser/ui/views/infobars/media_stream_infobar.cc

Issue 10209022: Refactor media stream infobar delegate code and also fix a typo (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/infobars/media_stream_infobar.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/infobars/media_stream_infobar.cc
diff --git a/chrome/browser/ui/views/infobars/media_stream_infobar.cc b/chrome/browser/ui/views/infobars/media_stream_infobar.cc
index 3213cb3807bf7a788aa7fe0fbf3095eb4c872cdf..0eb673f19b5ed21d0c7fab1410eedc1aa555f768 100644
--- a/chrome/browser/ui/views/infobars/media_stream_infobar.cc
+++ b/chrome/browser/ui/views/infobars/media_stream_infobar.cc
@@ -23,7 +23,6 @@ MediaStreamInfoBar::MediaStreamInfoBar(
InfoBarTabHelper* owner,
MediaStreamInfoBarDelegate* delegate)
: InfoBarView(owner, delegate),
- delegate_(delegate),
label_(NULL),
allow_button_(NULL),
deny_button_(NULL),
@@ -64,14 +63,14 @@ void MediaStreamInfoBar::ViewHierarchyChanged(bool is_add,
views::View* child) {
if (is_add && child == this && (label_ == NULL)) {
int message_id = IDS_MEDIA_CAPTURE_MIC_AND_VIDEO;
- DCHECK(delegate_->has_audio() || delegate_->has_video());
- if (!delegate_->has_audio())
+ DCHECK(GetDelegate()->has_audio() || GetDelegate()->has_video());
+ if (!GetDelegate()->has_audio())
message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY;
- else if (!delegate_->has_video())
+ else if (!GetDelegate()->has_video())
message_id = IDS_MEDIA_CAPTURE_MIC_ONLY;
label_ = CreateLabel(l10n_util::GetStringFUTF16(message_id,
- UTF8ToUTF16(delegate_->GetSecurityOrigin())));
+ UTF8ToUTF16(GetDelegate()->GetSecurityOrigin())));
AddChildView(label_);
allow_button_ = CreateTextButton(this,
@@ -102,10 +101,10 @@ void MediaStreamInfoBar::ButtonPressed(views::Button* sender,
content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE, &audio_id);
devices_menu_model_.GetSelectedDeviceId(
content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE, &video_id);
- delegate_->Accept(audio_id, video_id);
+ GetDelegate()->Accept(audio_id, video_id);
RemoveSelf();
} else if (sender == deny_button_) {
- delegate_->Deny();
+ GetDelegate()->Deny();
RemoveSelf();
} else {
InfoBarView::ButtonPressed(sender, event);
@@ -128,3 +127,7 @@ void MediaStreamInfoBar::OnMenuButtonClicked(views::View* source,
RunMenuAt(&devices_menu_model_, devices_menu_button_,
views::MenuItemView::TOPRIGHT);
}
+
+MediaStreamInfoBarDelegate* MediaStreamInfoBar::GetDelegate() {
+ return delegate()->AsMediaStreamInfoBarDelegate();
+}
« no previous file with comments | « chrome/browser/ui/views/infobars/media_stream_infobar.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698