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

Side by Side Diff: chrome/browser/media/media_stream_devices_menu_model.cc

Issue 10837317: Setting the touch wrench menu as default menu for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: And another merge! Created 8 years, 4 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/media/media_stream_devices_menu_model.h" 5 #include "chrome/browser/media/media_stream_devices_menu_model.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
11 #include "chrome/browser/ui/media_stream_infobar_delegate.h" 11 #include "chrome/browser/ui/media_stream_infobar_delegate.h"
12 #include "content/public/common/media_stream_request.h" 12 #include "content/public/common/media_stream_request.h"
13 #include "grit/generated_resources.h" 13 #include "grit/generated_resources.h"
14 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
15 15
16 MediaStreamDevicesMenuModel::MediaStreamDevicesMenuModel( 16 MediaStreamDevicesMenuModel::MediaStreamDevicesMenuModel(
17 const MediaStreamInfoBarDelegate* delegate) 17 const MediaStreamInfoBarDelegate* delegate)
18 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)), 18 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)),
19 selected_command_id_audio_(-1), 19 selected_command_id_audio_(-1),
20 selected_command_id_video_(-1), 20 selected_command_id_video_(-1),
21 always_allow_(false) { 21 always_allow_(false) {
22 bool audio = delegate->HasAudio() && !delegate->GetAudioDevices().empty(); 22 bool audio = delegate->HasAudio() && !delegate->GetAudioDevices().empty();
23 bool video = delegate->HasVideo() && !delegate->GetVideoDevices().empty(); 23 bool video = delegate->HasVideo() && !delegate->GetVideoDevices().empty();
24 if (video) { 24 if (video) {
25 // The default command ID is the first element that will be inserted. 25 // The default command ID is the first element that will be inserted.
26 selected_command_id_video_ = commands_.size(); 26 selected_command_id_video_ = commands_.size();
27 AddDevices(delegate->GetVideoDevices()); 27 AddDevices(delegate->GetVideoDevices());
28 if (audio) 28 if (audio)
29 AddSeparator(); 29 AddSeparator(ui::NORMAL_SEPARATOR);
30 } 30 }
31 if (audio) { 31 if (audio) {
32 // The default command ID is the first element that will be inserted. 32 // The default command ID is the first element that will be inserted.
33 selected_command_id_audio_ = commands_.size(); 33 selected_command_id_audio_ = commands_.size();
34 AddDevices(delegate->GetAudioDevices()); 34 AddDevices(delegate->GetAudioDevices());
35 } 35 }
36 36
37 // Show "always allow" option only for the secure connection. 37 // Show "always allow" option only for the secure connection.
38 if (delegate->GetSecurityOrigin().SchemeIsSecure()) 38 if (delegate->GetSecurityOrigin().SchemeIsSecure())
39 AddAlwaysAllowOption(audio, video); 39 AddAlwaysAllowOption(audio, video);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 105 }
106 106
107 void MediaStreamDevicesMenuModel::AddAlwaysAllowOption(bool audio, bool video) { 107 void MediaStreamDevicesMenuModel::AddAlwaysAllowOption(bool audio, bool video) {
108 int command_id = IDC_MEDIA_STREAM_DEVICE_ALWAYS_ALLOW; 108 int command_id = IDC_MEDIA_STREAM_DEVICE_ALWAYS_ALLOW;
109 int message_id = IDS_MEDIA_CAPTURE_ALWAYS_ALLOW_AUDIO_AND_VIDEO; 109 int message_id = IDS_MEDIA_CAPTURE_ALWAYS_ALLOW_AUDIO_AND_VIDEO;
110 if (audio && !video) 110 if (audio && !video)
111 message_id = IDS_MEDIA_CAPTURE_ALWAYS_ALLOW_AUDIO_ONLY; 111 message_id = IDS_MEDIA_CAPTURE_ALWAYS_ALLOW_AUDIO_ONLY;
112 else if (!audio && video) 112 else if (!audio && video)
113 message_id = IDS_MEDIA_CAPTURE_ALWAYS_ALLOW_VIDEO_ONLY; 113 message_id = IDS_MEDIA_CAPTURE_ALWAYS_ALLOW_VIDEO_ONLY;
114 114
115 AddSeparator(); 115 AddSeparator(ui::NORMAL_SEPARATOR);
116 AddCheckItem(command_id, l10n_util::GetStringUTF16(message_id)); 116 AddCheckItem(command_id, l10n_util::GetStringUTF16(message_id));
117 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698