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/ui/media_stream_infobar_delegate.h" | 5 #include "chrome/browser/ui/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/api/infobars/infobar_service.h" | 9 #include "chrome/browser/api/infobars/infobar_service.h" |
10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | |
10 #include "chrome/browser/google/google_util.h" | 11 #include "chrome/browser/google/google_util.h" |
11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
13 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
14 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
15 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
16 #include "grit/theme_resources.h" | 17 #include "grit/theme_resources.h" |
17 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
18 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
19 | 20 |
20 MediaStreamInfoBarDelegate::~MediaStreamInfoBarDelegate() {} | 21 MediaStreamInfoBarDelegate::~MediaStreamInfoBarDelegate() {} |
21 | 22 |
22 // static | 23 // static |
23 bool MediaStreamInfoBarDelegate::Create( | 24 bool MediaStreamInfoBarDelegate::Create( |
24 content::WebContents* web_contents, | 25 content::WebContents* web_contents, |
25 const content::MediaStreamRequest& request, | 26 const content::MediaStreamRequest& request, |
26 const content::MediaResponseCallback& callback) { | 27 const content::MediaResponseCallback& callback) { |
27 Profile* profile = | 28 Profile* profile = |
28 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 29 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
30 TabSpecificContentSettings* content_settings = | |
31 TabSpecificContentSettings::FromWebContents(web_contents); | |
29 | 32 |
30 scoped_ptr<MediaStreamDevicesController> controller( | 33 scoped_ptr<MediaStreamDevicesController> controller( |
31 new MediaStreamDevicesController(profile, request, callback)); | 34 new MediaStreamDevicesController(profile, content_settings, |
35 request, callback)); | |
32 if (!controller->DismissInfoBarAndTakeActionOnSettings()) { | 36 if (!controller->DismissInfoBarAndTakeActionOnSettings()) { |
Bernhard Bauer
2013/01/22 14:59:08
Ooh, would you mind doing some cleanup and reversi
markusheintz_
2013/01/23 10:42:30
Oh I didn't notice! Thanks for pointing this out.
| |
33 InfoBarService* infobar_service = | 37 InfoBarService* infobar_service = |
34 InfoBarService::FromWebContents(web_contents); | 38 InfoBarService::FromWebContents(web_contents); |
35 InfoBarDelegate* old_infobar = NULL; | 39 InfoBarDelegate* old_infobar = NULL; |
36 for (size_t i = 0; i < infobar_service->GetInfoBarCount(); ++i) { | 40 for (size_t i = 0; i < infobar_service->GetInfoBarCount(); ++i) { |
37 old_infobar = infobar_service->GetInfoBarDelegateAt(i)-> | 41 old_infobar = infobar_service->GetInfoBarDelegateAt(i)-> |
38 AsMediaStreamInfoBarDelegate(); | 42 AsMediaStreamInfoBarDelegate(); |
39 if (old_infobar) | 43 if (old_infobar) |
40 break; | 44 break; |
41 } | 45 } |
42 | 46 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 } | 121 } |
118 | 122 |
119 MediaStreamInfoBarDelegate::MediaStreamInfoBarDelegate( | 123 MediaStreamInfoBarDelegate::MediaStreamInfoBarDelegate( |
120 InfoBarService* infobar_service, | 124 InfoBarService* infobar_service, |
121 MediaStreamDevicesController* controller) | 125 MediaStreamDevicesController* controller) |
122 : ConfirmInfoBarDelegate(infobar_service), | 126 : ConfirmInfoBarDelegate(infobar_service), |
123 controller_(controller) { | 127 controller_(controller) { |
124 DCHECK(controller_.get()); | 128 DCHECK(controller_.get()); |
125 DCHECK(controller_->has_audio() || controller_->has_video()); | 129 DCHECK(controller_->has_audio() || controller_->has_video()); |
126 } | 130 } |
OLD | NEW |