| 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 19 matching lines...) Expand all Loading... |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 } // namespace | 32 } // namespace |
| 33 | 33 |
| 34 MediaStreamInfoBarDelegate::~MediaStreamInfoBarDelegate() { | 34 MediaStreamInfoBarDelegate::~MediaStreamInfoBarDelegate() { |
| 35 } | 35 } |
| 36 | 36 |
| 37 // static | 37 // static |
| 38 bool MediaStreamInfoBarDelegate::Create( | 38 bool MediaStreamInfoBarDelegate::Create( |
| 39 content::WebContents* web_contents, | 39 content::WebContents* web_contents, |
| 40 const content::MediaStreamRequest& request, | 40 scoped_ptr<MediaStreamDevicesController> controller) { |
| 41 const content::MediaResponseCallback& callback) { | |
| 42 scoped_ptr<MediaStreamDevicesController> controller( | |
| 43 new MediaStreamDevicesController(web_contents, request, callback)); | |
| 44 if (!controller->IsAskingForAudio() && !controller->IsAskingForVideo()) | |
| 45 return false; | |
| 46 | 41 |
| 47 InfoBarService* infobar_service = | 42 InfoBarService* infobar_service = |
| 48 InfoBarService::FromWebContents(web_contents); | 43 InfoBarService::FromWebContents(web_contents); |
| 49 if (!infobar_service) { | 44 if (!infobar_service) { |
| 50 // Deny the request if there is no place to show the infobar, e.g. when | 45 // Deny the request if there is no place to show the infobar, e.g. when |
| 51 // the request comes from a background extension page. | 46 // the request comes from a background extension page. |
| 52 controller->Cancelled(); | 47 controller->Cancelled(); |
| 53 return false; | 48 return false; |
| 54 } | 49 } |
| 55 | 50 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 WindowOpenDisposition disposition) { | 145 WindowOpenDisposition disposition) { |
| 151 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( | 146 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( |
| 152 content::OpenURLParams( | 147 content::OpenURLParams( |
| 153 GURL(chrome::kMediaAccessLearnMoreUrl), | 148 GURL(chrome::kMediaAccessLearnMoreUrl), |
| 154 content::Referrer(), | 149 content::Referrer(), |
| 155 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 150 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 156 ui::PAGE_TRANSITION_LINK, false)); | 151 ui::PAGE_TRANSITION_LINK, false)); |
| 157 | 152 |
| 158 return false; // Do not dismiss the info bar. | 153 return false; // Do not dismiss the info bar. |
| 159 } | 154 } |
| OLD | NEW |