Index: chrome/common/extensions/permissions/chrome_permission_message_provider.cc |
diff --git a/chrome/common/extensions/permissions/chrome_permission_message_provider.cc b/chrome/common/extensions/permissions/chrome_permission_message_provider.cc |
index 6fa8e5b9c0e14fbaf31c5074cdf31ba242b6a184..d0204fdd8d197997186e59e5b4ae94a023650185 100644 |
--- a/chrome/common/extensions/permissions/chrome_permission_message_provider.cc |
+++ b/chrome/common/extensions/permissions/chrome_permission_message_provider.cc |
@@ -111,6 +111,10 @@ std::vector<base::string16> ChromePermissionMessageProvider::GetWarningMessages( |
bool media_galleries_read = false; |
bool media_galleries_copy_to = false; |
bool media_galleries_delete = false; |
+ bool bluetooth = false; |
+ bool usb = false; |
+ bool serial = false; |
+ bool hid = false; |
for (PermissionMessages::const_iterator i = messages.begin(); |
i != messages.end(); ++i) { |
switch (i->id()) { |
@@ -129,6 +133,17 @@ std::vector<base::string16> ChromePermissionMessageProvider::GetWarningMessages( |
case PermissionMessage::kMediaGalleriesAllGalleriesDelete: |
media_galleries_delete = true; |
break; |
+ case PermissionMessage::kBluetoothDevices: |
+ bluetooth = true; |
+ break; |
+ case PermissionMessage::kHid: |
+ hid = true; |
+ break; |
+ case PermissionMessage::kSerial: |
+ serial = true; |
+ break; |
+ case PermissionMessage::kUsbDevice: |
+ usb = true; |
default: |
break; |
} |
@@ -137,6 +152,36 @@ std::vector<base::string16> ChromePermissionMessageProvider::GetWarningMessages( |
for (PermissionMessages::const_iterator i = messages.begin(); |
i != messages.end(); ++i) { |
int id = i->id(); |
+ if ((bluetooth && usb && serial) || (hid && serial)) { |
+ if (id == PermissionMessage::kSerial) { |
+ message_strings.push_back( |
+ l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_DEVICES)); |
+ continue; |
+ } else if (id == PermissionMessage::kBluetoothDevices || |
+ id == PermissionMessage::kUsbDevice || |
+ id == PermissionMessage::kHid) { |
+ // The combined message will be pushed above. |
+ continue; |
+ } |
+ } |
+ if (usb || bluetooth) { |
+ if (hid) { |
+ if (id == PermissionMessage::kBluetoothDevices || |
+ id == PermissionMessage::kUsbDevice) { |
+ // kHid message will be pushed instead |
+ continue; |
+ } |
+ } else if (usb && bluetooth) { |
+ if (id == PermissionMessage::kUsbDevice) { |
+ message_strings.push_back( |
+ l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_HID)); |
not at google - send to devlin
2014/06/20 22:25:32
apparently I was supposed to review this actually.
|
+ continue; |
+ } else if (id == PermissionMessage::kBluetoothDevices) { |
+ // The combined message will be pushed above. |
+ continue; |
+ } |
+ } |
+ } |
if (audio_capture && video_capture) { |
if (id == PermissionMessage::kAudioCapture) { |
message_strings.push_back(l10n_util::GetStringUTF16( |