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

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

Issue 922953002: Minor infobar cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resync Created 5 years, 10 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_infobar_delegate.h" 5 #include "chrome/browser/media/media_stream_infobar_delegate.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 75 }
76 76
77 void MediaStreamInfoBarDelegate::InfoBarDismissed() { 77 void MediaStreamInfoBarDelegate::InfoBarDismissed() {
78 // Deny the request if the infobar was closed with the 'x' button, since 78 // Deny the request if the infobar was closed with the 'x' button, since
79 // we don't want WebRTC to be waiting for an answer that will never come. 79 // we don't want WebRTC to be waiting for an answer that will never come.
80 UMA_HISTOGRAM_ENUMERATION("Media.DevicePermissionActions", 80 UMA_HISTOGRAM_ENUMERATION("Media.DevicePermissionActions",
81 kCancel, kPermissionActionsMax); 81 kCancel, kPermissionActionsMax);
82 controller_->Deny(false, content::MEDIA_DEVICE_PERMISSION_DISMISSED); 82 controller_->Deny(false, content::MEDIA_DEVICE_PERMISSION_DISMISSED);
83 } 83 }
84 84
85 infobars::InfoBarDelegate::Type
86 MediaStreamInfoBarDelegate::GetInfoBarType() const {
87 return PAGE_ACTION_TYPE;
88 }
89
85 int MediaStreamInfoBarDelegate::GetIconID() const { 90 int MediaStreamInfoBarDelegate::GetIconID() const {
86 return controller_->HasVideo() ? 91 return controller_->HasVideo() ?
87 IDR_INFOBAR_MEDIA_STREAM_CAMERA : IDR_INFOBAR_MEDIA_STREAM_MIC; 92 IDR_INFOBAR_MEDIA_STREAM_CAMERA : IDR_INFOBAR_MEDIA_STREAM_MIC;
88 } 93 }
89 94
90 infobars::InfoBarDelegate::Type MediaStreamInfoBarDelegate::GetInfoBarType()
91 const {
92 return PAGE_ACTION_TYPE;
93 }
94
95 MediaStreamInfoBarDelegate* 95 MediaStreamInfoBarDelegate*
96 MediaStreamInfoBarDelegate::AsMediaStreamInfoBarDelegate() { 96 MediaStreamInfoBarDelegate::AsMediaStreamInfoBarDelegate() {
97 return this; 97 return this;
98 } 98 }
99 99
100 base::string16 MediaStreamInfoBarDelegate::GetMessageText() const { 100 base::string16 MediaStreamInfoBarDelegate::GetMessageText() const {
101 int message_id = IDS_MEDIA_CAPTURE_AUDIO_AND_VIDEO; 101 int message_id = IDS_MEDIA_CAPTURE_AUDIO_AND_VIDEO;
102 if (!controller_->HasAudio()) 102 if (!controller_->HasAudio())
103 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY; 103 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY;
104 else if (!controller_->HasVideo()) 104 else if (!controller_->HasVideo())
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 WindowOpenDisposition disposition) { 141 WindowOpenDisposition disposition) {
142 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( 142 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL(
143 content::OpenURLParams( 143 content::OpenURLParams(
144 GURL(chrome::kMediaAccessLearnMoreUrl), 144 GURL(chrome::kMediaAccessLearnMoreUrl),
145 content::Referrer(), 145 content::Referrer(),
146 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 146 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
147 ui::PAGE_TRANSITION_LINK, false)); 147 ui::PAGE_TRANSITION_LINK, false));
148 148
149 return false; // Do not dismiss the info bar. 149 return false; // Do not dismiss the info bar.
150 } 150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698