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

Side by Side Diff: chrome/common/extensions/permissions/chrome_permission_message_provider.cc

Issue 324273003: When read and modify permissions for "accessibility" are requested or read and write permissions fo… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed the fileSystem because it is already supreseded." Created 6 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chrome_permission_message_provide r.h" 5 #include "chrome/common/extensions/permissions/chrome_permission_message_provide r.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "extensions/common/extensions_client.h" 9 #include "extensions/common/extensions_client.h"
10 #include "extensions/common/permissions/permission_message.h" 10 #include "extensions/common/permissions/permission_message.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 Manifest::Type extension_type) const { 104 Manifest::Type extension_type) const {
105 std::vector<base::string16> message_strings; 105 std::vector<base::string16> message_strings;
106 PermissionMessages messages = 106 PermissionMessages messages =
107 GetPermissionMessages(permissions, extension_type); 107 GetPermissionMessages(permissions, extension_type);
108 108
109 bool audio_capture = false; 109 bool audio_capture = false;
110 bool video_capture = false; 110 bool video_capture = false;
111 bool media_galleries_read = false; 111 bool media_galleries_read = false;
112 bool media_galleries_copy_to = false; 112 bool media_galleries_copy_to = false;
113 bool media_galleries_delete = false; 113 bool media_galleries_delete = false;
114 bool accessibility_read = false;
115 bool accessibility_write = false;
116 bool file_system_read = false;
meacer 2014/06/18 17:08:18 file_system_read and file_system_write not needed
117 bool file_system_write = false;
114 for (PermissionMessages::const_iterator i = messages.begin(); 118 for (PermissionMessages::const_iterator i = messages.begin();
115 i != messages.end(); ++i) { 119 i != messages.end(); ++i) {
116 switch (i->id()) { 120 switch (i->id()) {
117 case PermissionMessage::kAudioCapture: 121 case PermissionMessage::kAudioCapture:
118 audio_capture = true; 122 audio_capture = true;
119 break; 123 break;
120 case PermissionMessage::kVideoCapture: 124 case PermissionMessage::kVideoCapture:
121 video_capture = true; 125 video_capture = true;
122 break; 126 break;
123 case PermissionMessage::kMediaGalleriesAllGalleriesRead: 127 case PermissionMessage::kMediaGalleriesAllGalleriesRead:
124 media_galleries_read = true; 128 media_galleries_read = true;
125 break; 129 break;
126 case PermissionMessage::kMediaGalleriesAllGalleriesCopyTo: 130 case PermissionMessage::kMediaGalleriesAllGalleriesCopyTo:
127 media_galleries_copy_to = true; 131 media_galleries_copy_to = true;
128 break; 132 break;
129 case PermissionMessage::kMediaGalleriesAllGalleriesDelete: 133 case PermissionMessage::kMediaGalleriesAllGalleriesDelete:
130 media_galleries_delete = true; 134 media_galleries_delete = true;
131 break; 135 break;
136 case PermissionMessage::kAccessibilityFeaturesRead:
137 accessibility_read = true;
138 break;
139 case PermissionMessage::kAccessibilityFeaturesModify:
140 accessibility_write = true;
141 break;
132 default: 142 default:
133 break; 143 break;
134 } 144 }
135 } 145 }
136 146
137 for (PermissionMessages::const_iterator i = messages.begin(); 147 for (PermissionMessages::const_iterator i = messages.begin();
138 i != messages.end(); ++i) { 148 i != messages.end(); ++i) {
139 int id = i->id(); 149 int id = i->id();
140 if (audio_capture && video_capture) { 150 if (audio_capture && video_capture) {
141 if (id == PermissionMessage::kAudioCapture) { 151 if (id == PermissionMessage::kAudioCapture) {
142 message_strings.push_back(l10n_util::GetStringUTF16( 152 message_strings.push_back(l10n_util::GetStringUTF16(
143 IDS_EXTENSION_PROMPT_WARNING_AUDIO_AND_VIDEO_CAPTURE)); 153 IDS_EXTENSION_PROMPT_WARNING_AUDIO_AND_VIDEO_CAPTURE));
144 continue; 154 continue;
145 } else if (id == PermissionMessage::kVideoCapture) { 155 } else if (id == PermissionMessage::kVideoCapture) {
146 // The combined message will be pushed above. 156 // The combined message will be pushed above.
147 continue; 157 continue;
148 } 158 }
149 } 159 }
160 if (accessibility_read && accessibility_write) {
161 if (id == PermissionMessage::kAccessibilityFeaturesRead) {
162 message_strings.push_back(l10n_util::GetStringUTF16(
163 IDS_EXTENSION_PROMPT_WARNING_ACCESSIBILITY_FEATURES_READ_AND_MODIFY) );
meacer 2014/06/18 17:08:18 Line width over 80 characters
164 continue;
165 } else if (id == PermissionMessage::kAccessibilityFeaturesModify) {
166 // The combined message will be pushed above.
167 continue;
168 }
169 }
150 if (media_galleries_read && 170 if (media_galleries_read &&
151 (media_galleries_copy_to || media_galleries_delete)) { 171 (media_galleries_copy_to || media_galleries_delete)) {
152 if (id == PermissionMessage::kMediaGalleriesAllGalleriesRead) { 172 if (id == PermissionMessage::kMediaGalleriesAllGalleriesRead) {
153 int m_id = media_galleries_copy_to ? 173 int m_id = media_galleries_copy_to ?
154 IDS_EXTENSION_PROMPT_WARNING_MEDIA_GALLERIES_READ_WRITE : 174 IDS_EXTENSION_PROMPT_WARNING_MEDIA_GALLERIES_READ_WRITE :
155 IDS_EXTENSION_PROMPT_WARNING_MEDIA_GALLERIES_READ_DELETE; 175 IDS_EXTENSION_PROMPT_WARNING_MEDIA_GALLERIES_READ_DELETE;
156 message_strings.push_back(l10n_util::GetStringUTF16(m_id)); 176 message_strings.push_back(l10n_util::GetStringUTF16(m_id));
157 continue; 177 continue;
158 } else if (id == PermissionMessage::kMediaGalleriesAllGalleriesCopyTo || 178 } else if (id == PermissionMessage::kMediaGalleriesAllGalleriesCopyTo ||
159 id == PermissionMessage::kMediaGalleriesAllGalleriesDelete) { 179 id == PermissionMessage::kMediaGalleriesAllGalleriesDelete) {
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 std::set<std::string> old_hosts_set( 387 std::set<std::string> old_hosts_set(
368 permission_message_util::GetDistinctHosts(old_list, false, false)); 388 permission_message_util::GetDistinctHosts(old_list, false, false));
369 std::set<std::string> new_hosts_only = 389 std::set<std::string> new_hosts_only =
370 base::STLSetDifference<std::set<std::string> >(new_hosts_set, 390 base::STLSetDifference<std::set<std::string> >(new_hosts_set,
371 old_hosts_set); 391 old_hosts_set);
372 392
373 return !new_hosts_only.empty(); 393 return !new_hosts_only.empty();
374 } 394 }
375 395
376 } // namespace extensions 396 } // namespace extensions
OLDNEW
« chrome/app/generated_resources.grd ('K') | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698