| Index: chrome/browser/media/media_stream_infobar_delegate_android.cc
|
| diff --git a/chrome/browser/media/media_stream_infobar_delegate_android.cc b/chrome/browser/media/media_stream_infobar_delegate_android.cc
|
| index eb986520cf0dee63e45c7798bff6504b5bccf147..161722e7b722d00a63e85b18611b51bb12207abe 100644
|
| --- a/chrome/browser/media/media_stream_infobar_delegate_android.cc
|
| +++ b/chrome/browser/media/media_stream_infobar_delegate_android.cc
|
| @@ -13,6 +13,7 @@
|
| #include "chrome/browser/infobars/infobar_service.h"
|
| #include "chrome/common/url_constants.h"
|
| #include "chrome/grit/generated_resources.h"
|
| +#include "components/content_settings/core/common/content_settings_types.h"
|
| #include "components/google/core/browser/google_util.h"
|
| #include "components/infobars/core/infobar.h"
|
| #include "content/public/browser/web_contents.h"
|
| @@ -22,6 +23,20 @@
|
| #include "ui/base/l10n/l10n_util.h"
|
| #include "url/gurl.h"
|
|
|
| +namespace {
|
| +
|
| +std::vector<ContentSettingsType> GetContentSettingsTypes(
|
| + MediaStreamDevicesController* controller) {
|
| + std::vector<ContentSettingsType> types;
|
| + if (controller->IsAskingForAudio())
|
| + types.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC);
|
| + if (controller->IsAskingForVideo())
|
| + types.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA);
|
| + return types;
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| MediaStreamInfoBarDelegateAndroid::~MediaStreamInfoBarDelegateAndroid() {}
|
|
|
| // static
|
| @@ -38,8 +53,8 @@ bool MediaStreamInfoBarDelegateAndroid::Create(
|
| }
|
|
|
| std::unique_ptr<infobars::InfoBar> infobar(
|
| - infobar_service->CreateConfirmInfoBar(
|
| - std::unique_ptr<ConfirmInfoBarDelegate>(
|
| + GroupedPermissionInfoBarDelegate::CreateInfoBar(infobar_service,
|
| + std::unique_ptr<GroupedPermissionInfoBarDelegate>(
|
| new MediaStreamInfoBarDelegateAndroid(std::move(controller)))));
|
| for (size_t i = 0; i < infobar_service->infobar_count(); ++i) {
|
| infobars::InfoBar* old_infobar = infobar_service->infobar_at(i);
|
| @@ -52,14 +67,6 @@ bool MediaStreamInfoBarDelegateAndroid::Create(
|
| return true;
|
| }
|
|
|
| -bool MediaStreamInfoBarDelegateAndroid::IsRequestingVideoAccess() const {
|
| - return controller_->IsAskingForVideo();
|
| -}
|
| -
|
| -bool MediaStreamInfoBarDelegateAndroid::IsRequestingMicrophoneAccess() const {
|
| - return controller_->IsAskingForAudio();
|
| -}
|
| -
|
| infobars::InfoBarDelegate::InfoBarIdentifier
|
| MediaStreamInfoBarDelegateAndroid::GetIdentifier() const {
|
| return MEDIA_STREAM_INFOBAR_DELEGATE_ANDROID;
|
| @@ -67,21 +74,14 @@ MediaStreamInfoBarDelegateAndroid::GetIdentifier() const {
|
|
|
| MediaStreamInfoBarDelegateAndroid::MediaStreamInfoBarDelegateAndroid(
|
| std::unique_ptr<MediaStreamDevicesController> controller)
|
| - : ConfirmInfoBarDelegate(), controller_(std::move(controller)) {
|
| + : GroupedPermissionInfoBarDelegate(
|
| + controller->GetOrigin(),
|
| + GetContentSettingsTypes(controller.get())),
|
| + controller_(std::move(controller)) {
|
| DCHECK(controller_.get());
|
| DCHECK(controller_->IsAskingForAudio() || controller_->IsAskingForVideo());
|
| }
|
|
|
| -infobars::InfoBarDelegate::Type
|
| -MediaStreamInfoBarDelegateAndroid::GetInfoBarType() const {
|
| - return PAGE_ACTION_TYPE;
|
| -}
|
| -
|
| -int MediaStreamInfoBarDelegateAndroid::GetIconId() const {
|
| - return controller_->IsAskingForVideo() ? IDR_INFOBAR_MEDIA_STREAM_CAMERA
|
| - : IDR_INFOBAR_MEDIA_STREAM_MIC;
|
| -}
|
| -
|
| void MediaStreamInfoBarDelegateAndroid::InfoBarDismissed() {
|
| // Deny the request if the infobar was closed with the 'x' button, since
|
| // we don't want WebRTC to be waiting for an answer that will never come.
|
| @@ -93,17 +93,6 @@ MediaStreamInfoBarDelegateAndroid::AsMediaStreamInfoBarDelegateAndroid() {
|
| return this;
|
| }
|
|
|
| -base::string16 MediaStreamInfoBarDelegateAndroid::GetMessageText() const {
|
| - return controller_->GetMessageText();
|
| -}
|
| -
|
| -base::string16 MediaStreamInfoBarDelegateAndroid::GetButtonLabel(
|
| - InfoBarButton button) const {
|
| - return l10n_util::GetStringUTF16((button == BUTTON_OK)
|
| - ? IDS_MEDIA_CAPTURE_ALLOW
|
| - : IDS_MEDIA_CAPTURE_BLOCK);
|
| -}
|
| -
|
| bool MediaStreamInfoBarDelegateAndroid::Accept() {
|
| controller_->PermissionGranted();
|
| return true;
|
| @@ -113,11 +102,3 @@ bool MediaStreamInfoBarDelegateAndroid::Cancel() {
|
| controller_->PermissionDenied();
|
| return true;
|
| }
|
| -
|
| -base::string16 MediaStreamInfoBarDelegateAndroid::GetLinkText() const {
|
| - return base::string16();
|
| -}
|
| -
|
| -GURL MediaStreamInfoBarDelegateAndroid::GetLinkURL() const {
|
| - return GURL(chrome::kMediaAccessLearnMoreUrl);
|
| -}
|
|
|