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 <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/infobars/infobar_tab_helper.h" | 9 #include "chrome/browser/infobars/infobar_tab_helper.h" |
10 #include "chrome/browser/ui/media_stream_infobar_delegate.h" | 10 #include "chrome/browser/ui/media_stream_infobar_delegate.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 l10n_util::GetStringUTF16(IDS_MEDIA_CAPTURE_DEVICES_MENU_TITLE), this); | 85 l10n_util::GetStringUTF16(IDS_MEDIA_CAPTURE_DEVICES_MENU_TITLE), this); |
86 AddChildView(devices_menu_button_); | 86 AddChildView(devices_menu_button_); |
87 } | 87 } |
88 | 88 |
89 // This must happen after adding all other children so InfoBarView can ensure | 89 // This must happen after adding all other children so InfoBarView can ensure |
90 // the close button is the last child. | 90 // the close button is the last child. |
91 InfoBarView::ViewHierarchyChanged(is_add, parent, child); | 91 InfoBarView::ViewHierarchyChanged(is_add, parent, child); |
92 } | 92 } |
93 | 93 |
94 void MediaStreamInfoBar::ButtonPressed(views::Button* sender, | 94 void MediaStreamInfoBar::ButtonPressed(views::Button* sender, |
95 const views::Event& event) { | 95 const ui::Event& event) { |
96 if (!owned()) | 96 if (!owned()) |
97 return; // We're closing; don't call anything, it might access the owner. | 97 return; // We're closing; don't call anything, it might access the owner. |
98 if (sender == allow_button_) { | 98 if (sender == allow_button_) { |
99 std::string audio_id, video_id; | 99 std::string audio_id, video_id; |
100 devices_menu_model_.GetSelectedDeviceId( | 100 devices_menu_model_.GetSelectedDeviceId( |
101 content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE, &audio_id); | 101 content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE, &audio_id); |
102 devices_menu_model_.GetSelectedDeviceId( | 102 devices_menu_model_.GetSelectedDeviceId( |
103 content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE, &video_id); | 103 content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE, &video_id); |
104 bool always_allow = devices_menu_model_.always_allow(); | 104 bool always_allow = devices_menu_model_.always_allow(); |
105 GetDelegate()->Accept(audio_id, video_id, always_allow); | 105 GetDelegate()->Accept(audio_id, video_id, always_allow); |
(...skipping 19 matching lines...) Expand all Loading... |
125 if (!owned()) | 125 if (!owned()) |
126 return; // We're closing; don't call anything, it might access the owner. | 126 return; // We're closing; don't call anything, it might access the owner. |
127 DCHECK_EQ(devices_menu_button_, source); | 127 DCHECK_EQ(devices_menu_button_, source); |
128 RunMenuAt(&devices_menu_model_, devices_menu_button_, | 128 RunMenuAt(&devices_menu_model_, devices_menu_button_, |
129 views::MenuItemView::TOPRIGHT); | 129 views::MenuItemView::TOPRIGHT); |
130 } | 130 } |
131 | 131 |
132 MediaStreamInfoBarDelegate* MediaStreamInfoBar::GetDelegate() { | 132 MediaStreamInfoBarDelegate* MediaStreamInfoBar::GetDelegate() { |
133 return delegate()->AsMediaStreamInfoBarDelegate(); | 133 return delegate()->AsMediaStreamInfoBarDelegate(); |
134 } | 134 } |
OLD | NEW |