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

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

Issue 2339093002: [HBD] Add Plugins permission type and PermissionContext (Closed)
Patch Set: [HBD] Add Plugins permission type and PermissionContext Created 4 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/permission_request_impl.h" 5 #include "chrome/browser/permissions/permission_request_impl.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "chrome/browser/permissions/permission_decision_auto_blocker.h" 8 #include "chrome/browser/permissions/permission_decision_auto_blocker.h"
9 #include "chrome/browser/permissions/permission_uma_util.h" 9 #include "chrome/browser/permissions/permission_uma_util.h"
10 #include "chrome/browser/permissions/permission_util.h" 10 #include "chrome/browser/permissions/permission_util.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 case content::PermissionType::PUSH_MESSAGING: 49 case content::PermissionType::PUSH_MESSAGING:
50 return gfx::VectorIconId::NOTIFICATIONS; 50 return gfx::VectorIconId::NOTIFICATIONS;
51 #endif 51 #endif
52 #if defined(OS_CHROMEOS) 52 #if defined(OS_CHROMEOS)
53 // TODO(xhwang): fix this icon, see crrev.com/863263007 53 // TODO(xhwang): fix this icon, see crrev.com/863263007
54 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: 54 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER:
55 return gfx::VectorIconId::CHROME_PRODUCT; 55 return gfx::VectorIconId::CHROME_PRODUCT;
56 #endif 56 #endif
57 case content::PermissionType::MIDI_SYSEX: 57 case content::PermissionType::MIDI_SYSEX:
58 return gfx::VectorIconId::MIDI; 58 return gfx::VectorIconId::MIDI;
59 case content::PermissionType::PLUGINS:
60 return gfx::VectorIconId::EXTENSION;
59 default: 61 default:
60 NOTREACHED(); 62 NOTREACHED();
61 return gfx::VectorIconId::VECTOR_ICON_NONE; 63 return gfx::VectorIconId::VECTOR_ICON_NONE;
62 } 64 }
63 #else // !defined(OS_MACOSX) && !defined(OS_ANDROID) 65 #else // !defined(OS_MACOSX) && !defined(OS_ANDROID)
64 return gfx::VectorIconId::VECTOR_ICON_NONE; 66 return gfx::VectorIconId::VECTOR_ICON_NONE;
65 #endif 67 #endif
66 } 68 }
67 69
68 int PermissionRequestImpl::GetIconId() const { 70 int PermissionRequestImpl::GetIconId() const {
69 int icon_id = IDR_INFOBAR_WARNING; 71 int icon_id = IDR_INFOBAR_WARNING;
70 #if defined(OS_MACOSX) || defined(OS_ANDROID) 72 #if defined(OS_MACOSX) || defined(OS_ANDROID)
71 switch (permission_type_) { 73 switch (permission_type_) {
72 case content::PermissionType::GEOLOCATION: 74 case content::PermissionType::GEOLOCATION:
73 icon_id = IDR_INFOBAR_GEOLOCATION; 75 icon_id = IDR_INFOBAR_GEOLOCATION;
74 break; 76 break;
75 #if defined(ENABLE_NOTIFICATIONS) 77 #if defined(ENABLE_NOTIFICATIONS)
76 case content::PermissionType::NOTIFICATIONS: 78 case content::PermissionType::NOTIFICATIONS:
77 case content::PermissionType::PUSH_MESSAGING: 79 case content::PermissionType::PUSH_MESSAGING:
78 icon_id = IDR_INFOBAR_DESKTOP_NOTIFICATIONS; 80 icon_id = IDR_INFOBAR_DESKTOP_NOTIFICATIONS;
79 break; 81 break;
80 #endif 82 #endif
81 case content::PermissionType::MIDI_SYSEX: 83 case content::PermissionType::MIDI_SYSEX:
82 icon_id = IDR_ALLOWED_MIDI_SYSEX; 84 icon_id = IDR_ALLOWED_MIDI_SYSEX;
83 break; 85 break;
86 case content::PermissionType::PLUGINS:
87 icon_id = IDR_ALLOWED_PLUGINS;
88 break;
84 default: 89 default:
85 NOTREACHED(); 90 NOTREACHED();
86 } 91 }
87 #endif 92 #endif
88 return icon_id; 93 return icon_id;
89 } 94 }
90 95
91 base::string16 PermissionRequestImpl::GetMessageTextFragment() const { 96 base::string16 PermissionRequestImpl::GetMessageTextFragment() const {
92 int message_id; 97 int message_id;
93 switch (permission_type_) { 98 switch (permission_type_) {
94 case content::PermissionType::GEOLOCATION: 99 case content::PermissionType::GEOLOCATION:
95 message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT; 100 message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT;
96 break; 101 break;
97 #if defined(ENABLE_NOTIFICATIONS) 102 #if defined(ENABLE_NOTIFICATIONS)
98 case content::PermissionType::NOTIFICATIONS: 103 case content::PermissionType::NOTIFICATIONS:
99 case content::PermissionType::PUSH_MESSAGING: 104 case content::PermissionType::PUSH_MESSAGING:
100 message_id = IDS_NOTIFICATION_PERMISSIONS_FRAGMENT; 105 message_id = IDS_NOTIFICATION_PERMISSIONS_FRAGMENT;
101 break; 106 break;
102 #endif 107 #endif
103 case content::PermissionType::MIDI_SYSEX: 108 case content::PermissionType::MIDI_SYSEX:
104 message_id = IDS_MIDI_SYSEX_PERMISSION_FRAGMENT; 109 message_id = IDS_MIDI_SYSEX_PERMISSION_FRAGMENT;
105 break; 110 break;
106 #if defined(OS_CHROMEOS) 111 #if defined(OS_CHROMEOS)
107 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: 112 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER:
108 message_id = IDS_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_FRAGMENT; 113 message_id = IDS_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_FRAGMENT;
109 break; 114 break;
110 #endif 115 #endif
116 case content::PermissionType::PLUGINS:
117 message_id = IDS_FLASH_PERMISSION_FRAGMENT;
118 break;
111 default: 119 default:
112 NOTREACHED(); 120 NOTREACHED();
113 return base::string16(); 121 return base::string16();
114 } 122 }
115 return l10n_util::GetStringUTF16(message_id); 123 return l10n_util::GetStringUTF16(message_id);
116 } 124 }
117 125
118 GURL PermissionRequestImpl::GetOrigin() const { 126 GURL PermissionRequestImpl::GetOrigin() const {
119 return request_origin_; 127 return request_origin_;
120 } 128 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return PermissionRequestType::PERMISSION_NOTIFICATIONS; 162 return PermissionRequestType::PERMISSION_NOTIFICATIONS;
155 #endif 163 #endif
156 case content::PermissionType::MIDI_SYSEX: 164 case content::PermissionType::MIDI_SYSEX:
157 return PermissionRequestType::PERMISSION_MIDI_SYSEX; 165 return PermissionRequestType::PERMISSION_MIDI_SYSEX;
158 case content::PermissionType::PUSH_MESSAGING: 166 case content::PermissionType::PUSH_MESSAGING:
159 return PermissionRequestType::PERMISSION_PUSH_MESSAGING; 167 return PermissionRequestType::PERMISSION_PUSH_MESSAGING;
160 #if defined(OS_CHROMEOS) 168 #if defined(OS_CHROMEOS)
161 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: 169 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER:
162 return PermissionRequestType::PERMISSION_PROTECTED_MEDIA_IDENTIFIER; 170 return PermissionRequestType::PERMISSION_PROTECTED_MEDIA_IDENTIFIER;
163 #endif 171 #endif
172 case content::PermissionType::PLUGINS:
173 return PermissionRequestType::PERMISSION_PLUGINS;
164 default: 174 default:
165 NOTREACHED(); 175 NOTREACHED();
166 return PermissionRequestType::UNKNOWN; 176 return PermissionRequestType::UNKNOWN;
167 } 177 }
168 } 178 }
169 179
170 PermissionRequestGestureType PermissionRequestImpl::GetGestureType() 180 PermissionRequestGestureType PermissionRequestImpl::GetGestureType()
171 const { 181 const {
172 return has_gesture_ ? PermissionRequestGestureType::GESTURE 182 return has_gesture_ ? PermissionRequestGestureType::GESTURE
173 : PermissionRequestGestureType::NO_GESTURE; 183 : PermissionRequestGestureType::NO_GESTURE;
174 } 184 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_request.h ('k') | chrome/browser/permissions/permission_uma_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698