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

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

Issue 2454813004: Make PermissionRequest::GetIconId return different types on desktop and Android so that the IDR_ an… (Closed)
Patch Set: Created 4 years, 1 month 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_android .h" 5 #include "chrome/browser/permissions/grouped_permission_infobar_delegate_android .h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "chrome/browser/android/android_theme_resources.h"
8 #include "chrome/browser/infobars/infobar_service.h" 9 #include "chrome/browser/infobars/infobar_service.h"
9 #include "chrome/browser/permissions/permission_util.h" 10 #include "chrome/browser/permissions/permission_util.h"
10 #include "chrome/browser/ui/android/infobars/grouped_permission_infobar.h" 11 #include "chrome/browser/ui/android/infobars/grouped_permission_infobar.h"
11 #include "chrome/grit/generated_resources.h" 12 #include "chrome/grit/generated_resources.h"
12 #include "chrome/grit/theme_resources.h" 13 #include "chrome/grit/theme_resources.h"
13 #include "components/infobars/core/infobar.h" 14 #include "components/infobars/core/infobar.h"
14 #include "components/url_formatter/elide_url.h" 15 #include "components/url_formatter/elide_url.h"
15 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/strings/grit/ui_strings.h" 17 #include "ui/strings/grit/ui_strings.h"
17 18
(...skipping 21 matching lines...) Expand all
39 40
40 int GroupedPermissionInfoBarDelegate::GetIconIdForPermission( 41 int GroupedPermissionInfoBarDelegate::GetIconIdForPermission(
41 size_t position) const { 42 size_t position) const {
42 DCHECK_LT(position, types_.size()); 43 DCHECK_LT(position, types_.size());
43 ContentSettingsType type = types_[position]; 44 ContentSettingsType type = types_[position];
44 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) 45 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)
45 return IDR_INFOBAR_MEDIA_STREAM_MIC; 46 return IDR_INFOBAR_MEDIA_STREAM_MIC;
46 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) 47 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)
47 return IDR_INFOBAR_MEDIA_STREAM_CAMERA; 48 return IDR_INFOBAR_MEDIA_STREAM_CAMERA;
48 49
49 return IDR_INFOBAR_WARNING; 50 return IDR_ANDROID_INFOBAR_WARNING;
50 } 51 }
51 52
52 base::string16 GroupedPermissionInfoBarDelegate::GetMessageTextFragment( 53 base::string16 GroupedPermissionInfoBarDelegate::GetMessageTextFragment(
53 size_t position) const { 54 size_t position) const {
54 DCHECK_LT(position, types_.size()); 55 DCHECK_LT(position, types_.size());
55 ContentSettingsType type = types_[position]; 56 ContentSettingsType type = types_[position];
56 57
57 const bool is_mic = (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); 58 const bool is_mic = (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC);
58 DCHECK(is_mic || (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); 59 DCHECK(is_mic || (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA));
59 return l10n_util::GetStringUTF16( 60 return l10n_util::GetStringUTF16(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 base::string16 GroupedPermissionInfoBarDelegate::GetButtonLabel( 108 base::string16 GroupedPermissionInfoBarDelegate::GetButtonLabel(
108 InfoBarButton button) const { 109 InfoBarButton button) const {
109 if (permission_count() > 1) { 110 if (permission_count() > 1) {
110 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_APP_OK 111 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_APP_OK
111 : IDS_APP_CANCEL); 112 : IDS_APP_CANCEL);
112 } 113 }
113 114
114 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_PERMISSION_ALLOW 115 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_PERMISSION_ALLOW
115 : IDS_PERMISSION_DENY); 116 : IDS_PERMISSION_DENY);
116 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698