OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/permissions/grouped_permission_infobar_delegate.h" | 5 #include "chrome/browser/permissions/grouped_permission_infobar_delegate.h" |
6 #include "chrome/grit/generated_resources.h" | 6 #include "chrome/grit/generated_resources.h" |
7 #include "components/url_formatter/elide_url.h" | 7 #include "components/url_formatter/elide_url.h" |
8 #include "grit/theme_resources.h" | 8 #include "grit/theme_resources.h" |
9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 return IDR_INFOBAR_MEDIA_STREAM_CAMERA; | 64 return IDR_INFOBAR_MEDIA_STREAM_CAMERA; |
65 } | 65 } |
66 return IDR_INFOBAR_WARNING; | 66 return IDR_INFOBAR_WARNING; |
67 } | 67 } |
68 | 68 |
69 base::string16 GroupedPermissionInfoBarDelegate::GetMessageTextFragment( | 69 base::string16 GroupedPermissionInfoBarDelegate::GetMessageTextFragment( |
70 int index) const { | 70 int index) const { |
71 DCHECK(index >= 0 && index < static_cast<int>(types_.size())); | 71 DCHECK(index >= 0 && index < static_cast<int>(types_.size())); |
72 ContentSettingsType type = types_[index]; | 72 ContentSettingsType type = types_[index]; |
73 int message_id; | 73 int message_id; |
74 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) { | 74 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_SCREEN) { |
| 75 message_id = IDS_MEDIA_CAPTURE_SCREEN_PERMISSION_FRAGMENT; |
| 76 } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) { |
75 message_id = IDS_MEDIA_CAPTURE_AUDIO_ONLY_PERMISSION_FRAGMENT; | 77 message_id = IDS_MEDIA_CAPTURE_AUDIO_ONLY_PERMISSION_FRAGMENT; |
76 } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) { | 78 } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) { |
77 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY_PERMISSION_FRAGMENT; | 79 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY_PERMISSION_FRAGMENT; |
78 } else { | 80 } else { |
79 NOTREACHED(); | 81 NOTREACHED(); |
80 return base::string16(); | 82 return base::string16(); |
81 } | 83 } |
82 return l10n_util::GetStringUTF16(message_id); | 84 return l10n_util::GetStringUTF16(message_id); |
83 } | 85 } |
84 | 86 |
85 void GroupedPermissionInfoBarDelegate::ToggleAccept(int position, | 87 void GroupedPermissionInfoBarDelegate::ToggleAccept(int position, |
86 bool new_value) { | 88 bool new_value) { |
87 DCHECK(position >= 0 && position < static_cast<int>(types_.size())); | 89 DCHECK(position >= 0 && position < static_cast<int>(types_.size())); |
88 accept_states_[position] = new_value; | 90 accept_states_[position] = new_value; |
89 } | 91 } |
90 | 92 |
91 bool GroupedPermissionInfoBarDelegate::GetAcceptState(int position) { | 93 bool GroupedPermissionInfoBarDelegate::GetAcceptState(int position) { |
92 DCHECK(position >= 0 && position < static_cast<int>(types_.size())); | 94 DCHECK(position >= 0 && position < static_cast<int>(types_.size())); |
93 return accept_states_[position]; | 95 return accept_states_[position]; |
94 } | 96 } |
OLD | NEW |