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

Side by Side Diff: chrome/browser/permissions/grouped_permission_infobar_delegate.cc

Issue 2123863004: ScreenCapture for Android phase1, part II (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: UI tweaking and rebase Created 4 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
OLDNEW
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 return types_[index]; 55 return types_[index];
56 } 56 }
57 57
58 int GroupedPermissionInfoBarDelegate::GetIconIdForPermission(int index) const { 58 int GroupedPermissionInfoBarDelegate::GetIconIdForPermission(int index) const {
59 DCHECK(index >= 0 && index < static_cast<int>(types_.size())); 59 DCHECK(index >= 0 && index < static_cast<int>(types_.size()));
60 ContentSettingsType type = types_[index]; 60 ContentSettingsType type = types_[index];
61 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) { 61 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) {
62 return IDR_INFOBAR_MEDIA_STREAM_MIC; 62 return IDR_INFOBAR_MEDIA_STREAM_MIC;
63 } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) { 63 } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) {
64 return IDR_INFOBAR_MEDIA_STREAM_CAMERA; 64 return IDR_INFOBAR_MEDIA_STREAM_CAMERA;
65 } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_SCREEN) {
66 return IDR_INFOBAR_MEDIA_STREAM_SCREEN;
65 } 67 }
66 return IDR_INFOBAR_WARNING; 68 return IDR_INFOBAR_WARNING;
67 } 69 }
68 70
69 base::string16 GroupedPermissionInfoBarDelegate::GetMessageTextFragment( 71 base::string16 GroupedPermissionInfoBarDelegate::GetMessageTextFragment(
70 int index) const { 72 int index) const {
71 DCHECK(index >= 0 && index < static_cast<int>(types_.size())); 73 DCHECK(index >= 0 && index < static_cast<int>(types_.size()));
72 ContentSettingsType type = types_[index]; 74 ContentSettingsType type = types_[index];
73 int message_id; 75 int message_id;
74 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) { 76 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_SCREEN) {
77 message_id = IDS_MEDIA_CAPTURE_SCREEN_PERMISSION_FRAGMENT;
78 } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) {
75 message_id = IDS_MEDIA_CAPTURE_AUDIO_ONLY_PERMISSION_FRAGMENT; 79 message_id = IDS_MEDIA_CAPTURE_AUDIO_ONLY_PERMISSION_FRAGMENT;
76 } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) { 80 } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) {
77 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY_PERMISSION_FRAGMENT; 81 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY_PERMISSION_FRAGMENT;
78 } else { 82 } else {
79 NOTREACHED(); 83 NOTREACHED();
80 return base::string16(); 84 return base::string16();
81 } 85 }
82 return l10n_util::GetStringUTF16(message_id); 86 return l10n_util::GetStringUTF16(message_id);
83 } 87 }
84 88
85 void GroupedPermissionInfoBarDelegate::ToggleAccept(int position, 89 void GroupedPermissionInfoBarDelegate::ToggleAccept(int position,
86 bool new_value) { 90 bool new_value) {
87 DCHECK(position >= 0 && position < static_cast<int>(types_.size())); 91 DCHECK(position >= 0 && position < static_cast<int>(types_.size()));
88 accept_states_[position] = new_value; 92 accept_states_[position] = new_value;
89 } 93 }
90 94
91 bool GroupedPermissionInfoBarDelegate::GetAcceptState(int position) { 95 bool GroupedPermissionInfoBarDelegate::GetAcceptState(int position) {
92 DCHECK(position >= 0 && position < static_cast<int>(types_.size())); 96 DCHECK(position >= 0 && position < static_cast<int>(types_.size()));
93 return accept_states_[position]; 97 return accept_states_[position];
94 } 98 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698