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/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
10 #include "chrome/browser/google/google_util.h" | 10 #include "chrome/browser/google/google_util.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 TabSpecificContentSettings::FromWebContents(web_contents); | 31 TabSpecificContentSettings::FromWebContents(web_contents); |
32 scoped_ptr<MediaStreamDevicesController> controller( | 32 scoped_ptr<MediaStreamDevicesController> controller( |
33 new MediaStreamDevicesController(profile, content_settings, | 33 new MediaStreamDevicesController(profile, content_settings, |
34 request, callback)); | 34 request, callback)); |
35 if (controller->DismissInfoBarAndTakeActionOnSettings()) | 35 if (controller->DismissInfoBarAndTakeActionOnSettings()) |
36 return false; | 36 return false; |
37 | 37 |
38 InfoBarService* infobar_service = | 38 InfoBarService* infobar_service = |
39 InfoBarService::FromWebContents(web_contents); | 39 InfoBarService::FromWebContents(web_contents); |
40 InfoBarDelegate* old_infobar = NULL; | 40 InfoBarDelegate* old_infobar = NULL; |
41 for (size_t i = 0; i < infobar_service->GetInfoBarCount(); ++i) { | 41 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) { |
42 old_infobar = infobar_service->GetInfoBarDelegateAt(i)-> | 42 old_infobar = |
43 AsMediaStreamInfoBarDelegate(); | 43 infobar_service->infobar_at(i)->AsMediaStreamInfoBarDelegate(); |
44 if (old_infobar) | 44 if (old_infobar) |
45 break; | 45 break; |
46 } | 46 } |
47 scoped_ptr<InfoBarDelegate> infobar( | 47 scoped_ptr<InfoBarDelegate> infobar( |
48 new MediaStreamInfoBarDelegate(infobar_service, controller.release())); | 48 new MediaStreamInfoBarDelegate(infobar_service, controller.release())); |
49 if (old_infobar) | 49 if (old_infobar) |
50 infobar_service->ReplaceInfoBar(old_infobar, infobar.Pass()); | 50 infobar_service->ReplaceInfoBar(old_infobar, infobar.Pass()); |
51 else | 51 else |
52 infobar_service->AddInfoBar(infobar.Pass()); | 52 infobar_service->AddInfoBar(infobar.Pass()); |
53 | 53 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 bool MediaStreamInfoBarDelegate::LinkClicked( | 108 bool MediaStreamInfoBarDelegate::LinkClicked( |
109 WindowOpenDisposition disposition) { | 109 WindowOpenDisposition disposition) { |
110 content::OpenURLParams params( | 110 content::OpenURLParams params( |
111 google_util::AppendGoogleLocaleParam( | 111 google_util::AppendGoogleLocaleParam( |
112 GURL(chrome::kMediaAccessLearnMoreUrl)), | 112 GURL(chrome::kMediaAccessLearnMoreUrl)), |
113 content::Referrer(), | 113 content::Referrer(), |
114 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 114 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
115 content::PAGE_TRANSITION_LINK, | 115 content::PAGE_TRANSITION_LINK, |
116 false); | 116 false); |
117 owner()->GetWebContents()->OpenURL(params); | 117 owner()->web_contents()->OpenURL(params); |
118 | 118 |
119 return false; // Do not dismiss the info bar. | 119 return false; // Do not dismiss the info bar. |
120 } | 120 } |
121 | 121 |
122 MediaStreamInfoBarDelegate::MediaStreamInfoBarDelegate( | 122 MediaStreamInfoBarDelegate::MediaStreamInfoBarDelegate( |
123 InfoBarService* infobar_service, | 123 InfoBarService* infobar_service, |
124 MediaStreamDevicesController* controller) | 124 MediaStreamDevicesController* controller) |
125 : ConfirmInfoBarDelegate(infobar_service), | 125 : ConfirmInfoBarDelegate(infobar_service), |
126 controller_(controller) { | 126 controller_(controller) { |
127 DCHECK(controller_.get()); | 127 DCHECK(controller_.get()); |
128 DCHECK(controller_->has_audio() || controller_->has_video()); | 128 DCHECK(controller_->has_audio() || controller_->has_video()); |
129 } | 129 } |
OLD | NEW |