Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(859)

Side by Side Diff: chrome/browser/ui/media_stream_infobar_delegate.cc

Issue 11896028: Add an location bar icon and a content settings bubble for media settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on tot. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698