OLD | NEW |
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 "extensions/common/permissions/media_galleries_permission.h" | 5 #include "extensions/common/permissions/media_galleries_permission.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 if (it->permission() == kAllAutoDetectedPermission) | 124 if (it->permission() == kAllAutoDetectedPermission) |
125 has_all_auto_detected = true; | 125 has_all_auto_detected = true; |
126 else if (it->permission() == kReadPermission) | 126 else if (it->permission() == kReadPermission) |
127 has_read = true; | 127 has_read = true; |
128 else if (it->permission() == kCopyToPermission) | 128 else if (it->permission() == kCopyToPermission) |
129 has_copy_to = true; | 129 has_copy_to = true; |
130 else if (it->permission() == kDeletePermission) | 130 else if (it->permission() == kDeletePermission) |
131 has_delete = true; | 131 has_delete = true; |
132 } | 132 } |
133 | 133 |
134 if (!IsValidPermissionSet(has_read, has_copy_to, has_delete, NULL)) { | 134 if (!IsValidPermissionSet(has_read, has_copy_to, has_delete, nullptr)) { |
135 NOTREACHED(); | 135 NOTREACHED(); |
136 return result; | 136 return result; |
137 } | 137 } |
138 | 138 |
139 // If |has_all_auto_detected| is false, then Chrome will prompt the user at | 139 // If |has_all_auto_detected| is false, then Chrome will prompt the user at |
140 // runtime when the extension call the getMediaGalleries API. | 140 // runtime when the extension call the getMediaGalleries API. |
141 if (!has_all_auto_detected) | 141 if (!has_all_auto_detected) |
142 return result; | 142 return result; |
143 // No access permission case. | 143 // No access permission case. |
144 if (!has_read) | 144 if (!has_read) |
(...skipping 17 matching lines...) Expand all Loading... |
162 } | 162 } |
163 if (has_delete) { | 163 if (has_delete) { |
164 result.push_back(PermissionMessage( | 164 result.push_back(PermissionMessage( |
165 PermissionMessage::kMediaGalleriesAllGalleriesDelete, | 165 PermissionMessage::kMediaGalleriesAllGalleriesDelete, |
166 base::string16())); | 166 base::string16())); |
167 } | 167 } |
168 return result; | 168 return result; |
169 } | 169 } |
170 | 170 |
171 } // namespace extensions | 171 } // namespace extensions |
OLD | NEW |