OLD | NEW |
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/common/extensions/permissions/api_permission.h" | 5 #include "chrome/common/extensions/permissions/api_permission.h" |
6 | 6 |
7 #include "chrome/common/extensions/permissions/permissions_info.h" | 7 #include "chrome/common/extensions/permissions/permissions_info.h" |
8 #include "grit/generated_resources.h" | 8 #include "grit/generated_resources.h" |
9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
10 | 10 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 // Platform-app permissions. | 159 // Platform-app permissions. |
160 { kSocket, "socket", kFlagCannotBeOptional }, | 160 { kSocket, "socket", kFlagCannotBeOptional }, |
161 { kAppWindow, "app.window" }, | 161 { kAppWindow, "app.window" }, |
162 { kAudioCapture, "audioCapture", kFlagNone, | 162 { kAudioCapture, "audioCapture", kFlagNone, |
163 IDS_EXTENSION_PROMPT_WARNING_AUDIO_CAPTURE, | 163 IDS_EXTENSION_PROMPT_WARNING_AUDIO_CAPTURE, |
164 PermissionMessage::kAudioCapture }, | 164 PermissionMessage::kAudioCapture }, |
165 { kVideoCapture, "videoCapture", kFlagNone, | 165 { kVideoCapture, "videoCapture", kFlagNone, |
166 IDS_EXTENSION_PROMPT_WARNING_VIDEO_CAPTURE, | 166 IDS_EXTENSION_PROMPT_WARNING_VIDEO_CAPTURE, |
167 PermissionMessage::kVideoCapture }, | 167 PermissionMessage::kVideoCapture }, |
| 168 // "fileSystem" has no permission string because read-only access is only |
| 169 // granted after the user has been shown a file chooser dialog and selected |
| 170 // a file. Selecting the file is considered consent to read it. |
168 { kFileSystem, "fileSystem" }, | 171 { kFileSystem, "fileSystem" }, |
169 { kFileSystemWrite, "fileSystemWrite", kFlagNone, | 172 { kFileSystemWrite, "fileSystemWrite", kFlagNone, |
170 IDS_EXTENSION_PROMPT_WARNING_FILE_SYSTEM_WRITE, | 173 IDS_EXTENSION_PROMPT_WARNING_FILE_SYSTEM_WRITE, |
171 PermissionMessage::kFileSystemWrite }, | 174 PermissionMessage::kFileSystemWrite }, |
172 { kMediaGalleriesAllGalleries, "mediaGalleriesAllGalleries", | 175 { kMediaGalleriesAllGalleries, "mediaGalleriesAllGalleries", |
173 kFlagCannotBeOptional, | 176 kFlagCannotBeOptional, |
174 IDS_EXTENSION_PROMPT_WARNING_MEDIA_GALLERIES_ALL_GALLERIES, | 177 IDS_EXTENSION_PROMPT_WARNING_MEDIA_GALLERIES_ALL_GALLERIES, |
175 PermissionMessage::kMediaGalleriesAllGalleries }, | 178 PermissionMessage::kMediaGalleriesAllGalleries }, |
176 }; | 179 }; |
177 | 180 |
178 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(PermissionsToRegister); ++i) { | 181 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(PermissionsToRegister); ++i) { |
179 const PermissionRegistration& pr = PermissionsToRegister[i]; | 182 const PermissionRegistration& pr = PermissionsToRegister[i]; |
180 info->RegisterPermission( | 183 info->RegisterPermission( |
181 pr.id, pr.name, pr.l10n_message_id, | 184 pr.id, pr.name, pr.l10n_message_id, |
182 pr.message_id ? pr.message_id : PermissionMessage::kNone, | 185 pr.message_id ? pr.message_id : PermissionMessage::kNone, |
183 pr.flags); | 186 pr.flags); |
184 } | 187 } |
185 | 188 |
186 // Register aliases. | 189 // Register aliases. |
187 info->RegisterAlias("unlimitedStorage", kOldUnlimitedStoragePermission); | 190 info->RegisterAlias("unlimitedStorage", kOldUnlimitedStoragePermission); |
188 info->RegisterAlias("tabs", kWindowsPermission); | 191 info->RegisterAlias("tabs", kWindowsPermission); |
189 // TODO(mihaip): Should be removed for the M20 branch, see | 192 // TODO(mihaip): Should be removed for the M20 branch, see |
190 // http://crbug.com/120447 for more details. | 193 // http://crbug.com/120447 for more details. |
191 info->RegisterAlias("background", kTemporaryBackgroundAlias); | 194 info->RegisterAlias("background", kTemporaryBackgroundAlias); |
192 } | 195 } |
193 | 196 |
194 } // namespace extensions | 197 } // namespace extensions |
OLD | NEW |