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/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/infobars/infobar_tab_helper.h" | 10 #include "chrome/browser/infobars/infobar_tab_helper.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 size_t offset = 0; | 37 size_t offset = 0; |
38 | 38 |
39 int message_id = IDS_MEDIA_CAPTURE_AUDIO_AND_VIDEO; | 39 int message_id = IDS_MEDIA_CAPTURE_AUDIO_AND_VIDEO; |
40 DCHECK(GetDelegate()->HasAudio() || GetDelegate()->HasVideo()); | 40 DCHECK(GetDelegate()->HasAudio() || GetDelegate()->HasVideo()); |
41 if (!GetDelegate()->HasAudio()) | 41 if (!GetDelegate()->HasAudio()) |
42 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY; | 42 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY; |
43 else if (!GetDelegate()->HasVideo()) | 43 else if (!GetDelegate()->HasVideo()) |
44 message_id = IDS_MEDIA_CAPTURE_AUDIO_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()->GetSecurityOriginSpec()); |
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( |
55 l10n_util::GetStringUTF8(IDS_MEDIA_CAPTURE_ALLOW).c_str()); | 55 l10n_util::GetStringUTF8(IDS_MEDIA_CAPTURE_ALLOW).c_str()); |
56 Signals()->Connect(button, "clicked", | 56 Signals()->Connect(button, "clicked", |
57 G_CALLBACK(&OnAllowButtonThunk), this); | 57 G_CALLBACK(&OnAllowButtonThunk), this); |
(...skipping 26 matching lines...) Expand all Loading... |
84 } | 84 } |
85 | 85 |
86 void MediaStreamInfoBarGtk::OnDenyButton(GtkWidget* widget) { | 86 void MediaStreamInfoBarGtk::OnDenyButton(GtkWidget* widget) { |
87 GetDelegate()->Deny(); | 87 GetDelegate()->Deny(); |
88 RemoveSelf(); | 88 RemoveSelf(); |
89 } | 89 } |
90 | 90 |
91 MediaStreamInfoBarDelegate* MediaStreamInfoBarGtk::GetDelegate() { | 91 MediaStreamInfoBarDelegate* MediaStreamInfoBarGtk::GetDelegate() { |
92 return delegate()->AsMediaStreamInfoBarDelegate(); | 92 return delegate()->AsMediaStreamInfoBarDelegate(); |
93 } | 93 } |
OLD | NEW |