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 "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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 infobars::InfoBar* old_infobar = infobar_service->infobar_at(i); | 59 infobars::InfoBar* old_infobar = infobar_service->infobar_at(i); |
60 if (old_infobar->delegate()->AsMediaStreamInfoBarDelegate()) { | 60 if (old_infobar->delegate()->AsMediaStreamInfoBarDelegate()) { |
61 infobar_service->ReplaceInfoBar(old_infobar, infobar.Pass()); | 61 infobar_service->ReplaceInfoBar(old_infobar, infobar.Pass()); |
62 return true; | 62 return true; |
63 } | 63 } |
64 } | 64 } |
65 infobar_service->AddInfoBar(infobar.Pass()); | 65 infobar_service->AddInfoBar(infobar.Pass()); |
66 return true; | 66 return true; |
67 } | 67 } |
68 | 68 |
| 69 bool MediaStreamInfoBarDelegate::IsRequestingVideoAccess() const { |
| 70 return controller_->HasVideo(); |
| 71 } |
| 72 |
| 73 bool MediaStreamInfoBarDelegate::IsRequestingMicrophoneAccess() const { |
| 74 return controller_->HasAudio(); |
| 75 } |
| 76 |
69 MediaStreamInfoBarDelegate::MediaStreamInfoBarDelegate( | 77 MediaStreamInfoBarDelegate::MediaStreamInfoBarDelegate( |
70 scoped_ptr<MediaStreamDevicesController> controller) | 78 scoped_ptr<MediaStreamDevicesController> controller) |
71 : ConfirmInfoBarDelegate(), | 79 : ConfirmInfoBarDelegate(), |
72 controller_(controller.Pass()) { | 80 controller_(controller.Pass()) { |
73 DCHECK(controller_.get()); | 81 DCHECK(controller_.get()); |
74 DCHECK(controller_->HasAudio() || controller_->HasVideo()); | 82 DCHECK(controller_->HasAudio() || controller_->HasVideo()); |
75 } | 83 } |
76 | 84 |
77 infobars::InfoBarDelegate::Type | 85 infobars::InfoBarDelegate::Type |
78 MediaStreamInfoBarDelegate::GetInfoBarType() const { | 86 MediaStreamInfoBarDelegate::GetInfoBarType() const { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 WindowOpenDisposition disposition) { | 149 WindowOpenDisposition disposition) { |
142 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( | 150 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( |
143 content::OpenURLParams( | 151 content::OpenURLParams( |
144 GURL(chrome::kMediaAccessLearnMoreUrl), | 152 GURL(chrome::kMediaAccessLearnMoreUrl), |
145 content::Referrer(), | 153 content::Referrer(), |
146 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 154 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
147 ui::PAGE_TRANSITION_LINK, false)); | 155 ui::PAGE_TRANSITION_LINK, false)); |
148 | 156 |
149 return false; // Do not dismiss the info bar. | 157 return false; // Do not dismiss the info bar. |
150 } | 158 } |
OLD | NEW |