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

Side by Side Diff: chrome/browser/ui/gtk/infobars/media_stream_infobar_gtk.cc

Issue 10537099: add "always allow" option to the mediastream infobar and allow user to allow/not allow acces to devi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed sky's comment and replaced "Do not allow any site to" with "Do not allow sites to" Created 8 years, 6 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/gtk/infobars/media_stream_infobar_gtk.h" 5 #include "chrome/browser/ui/gtk/infobars/media_stream_infobar_gtk.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/media/media_stream_devices_menu_model.h" 10 #include "chrome/browser/media/media_stream_devices_menu_model.h"
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 MediaStreamInfoBarGtk::~MediaStreamInfoBarGtk() { 31 MediaStreamInfoBarGtk::~MediaStreamInfoBarGtk() {
32 } 32 }
33 33
34 void MediaStreamInfoBarGtk::Init() { 34 void MediaStreamInfoBarGtk::Init() {
35 GtkWidget* hbox = gtk_hbox_new(FALSE, ui::kControlSpacing); 35 GtkWidget* hbox = gtk_hbox_new(FALSE, ui::kControlSpacing);
36 gtk_util::CenterWidgetInHBox(hbox_, hbox, false, 0); 36 gtk_util::CenterWidgetInHBox(hbox_, hbox, false, 0);
37 size_t offset = 0; 37 size_t offset = 0;
38 38
39 int message_id = IDS_MEDIA_CAPTURE_MIC_AND_VIDEO; 39 int message_id = IDS_MEDIA_CAPTURE_AUDIO_AND_VIDEO;
40 DCHECK(GetDelegate()->has_audio() || GetDelegate()->has_video()); 40 DCHECK(GetDelegate()->HasAudio() || GetDelegate()->HasVideo());
41 if (!GetDelegate()->has_audio()) 41 if (!GetDelegate()->HasAudio())
42 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY; 42 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY;
43 else if (!GetDelegate()->has_video()) 43 else if (!GetDelegate()->HasVideo())
44 message_id = IDS_MEDIA_CAPTURE_MIC_ONLY; 44 message_id = IDS_MEDIA_CAPTURE_AUDIO_ONLY;
45 45
46 string16 security_origin = UTF8ToUTF16( 46 string16 security_origin = UTF8ToUTF16(
47 GetDelegate()->GetSecurityOrigin().spec()); 47 GetDelegate()->GetSecurityOrigin().spec());
48 string16 text(l10n_util::GetStringFUTF16(message_id, 48 string16 text(l10n_util::GetStringFUTF16(message_id,
49 security_origin, &offset)); 49 security_origin, &offset));
50 50
51 gtk_box_pack_start(GTK_BOX(hbox), CreateLabel(UTF16ToUTF8(text)), 51 gtk_box_pack_start(GTK_BOX(hbox), CreateLabel(UTF16ToUTF8(text)),
52 FALSE, FALSE, 0); 52 FALSE, FALSE, 0);
53 53
54 GtkWidget* button = gtk_button_new_with_label( 54 GtkWidget* button = gtk_button_new_with_label(
(...skipping 20 matching lines...) Expand all
75 void MediaStreamInfoBarGtk::OnDevicesClicked(GtkWidget* sender) { 75 void MediaStreamInfoBarGtk::OnDevicesClicked(GtkWidget* sender) {
76 ShowMenuWithModel(sender, NULL, devices_menu_model_); 76 ShowMenuWithModel(sender, NULL, devices_menu_model_);
77 } 77 }
78 78
79 void MediaStreamInfoBarGtk::OnAllowButton(GtkWidget* widget) { 79 void MediaStreamInfoBarGtk::OnAllowButton(GtkWidget* widget) {
80 std::string audio_id, video_id; 80 std::string audio_id, video_id;
81 devices_menu_model_->GetSelectedDeviceId( 81 devices_menu_model_->GetSelectedDeviceId(
82 content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE, &audio_id); 82 content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE, &audio_id);
83 devices_menu_model_->GetSelectedDeviceId( 83 devices_menu_model_->GetSelectedDeviceId(
84 content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE, &video_id); 84 content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE, &video_id);
85 GetDelegate()->Accept(audio_id, video_id); 85 bool always_allow = devices_menu_model_->always_allow();
86 GetDelegate()->Accept(audio_id, video_id, always_allow);
86 RemoveSelf(); 87 RemoveSelf();
87 } 88 }
88 89
89 void MediaStreamInfoBarGtk::OnDenyButton(GtkWidget* widget) { 90 void MediaStreamInfoBarGtk::OnDenyButton(GtkWidget* widget) {
90 GetDelegate()->Deny(); 91 GetDelegate()->Deny();
91 RemoveSelf(); 92 RemoveSelf();
92 } 93 }
93 94
94 MediaStreamInfoBarDelegate* MediaStreamInfoBarGtk::GetDelegate() { 95 MediaStreamInfoBarDelegate* MediaStreamInfoBarGtk::GetDelegate() {
95 return delegate()->AsMediaStreamInfoBarDelegate(); 96 return delegate()->AsMediaStreamInfoBarDelegate();
96 } 97 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/infobars/media_stream_infobar_controller.mm ('k') | chrome/browser/ui/media_stream_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698