Supresses app permissions changed dialogs in kiosk mode.
Added tweak for running chromeos=1 builds on Linux machines.
BUG=242370
TEST=manual
Review URL: https://chromiumcodereview.appspot.com/15713003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202658 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/usb/usb_service.cc b/chrome/browser/usb/usb_service.cc
index fcad23d94..ccaeaa6 100644
--- a/chrome/browser/usb/usb_service.cc
+++ b/chrome/browser/usb/usb_service.cc
@@ -14,6 +14,7 @@
#include "third_party/libusb/src/libusb/libusb.h"
#if defined(OS_CHROMEOS)
+#include "base/chromeos/chromeos_version.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/permission_broker_client.h"
#endif // defined(OS_CHROMEOS)
@@ -74,22 +75,28 @@
const base::Callback<void()>& callback) {
DCHECK(event_handler_) << "FindDevices called after event handler stopped.";
#if defined(OS_CHROMEOS)
- chromeos::PermissionBrokerClient* client =
- chromeos::DBusThreadManager::Get()->GetPermissionBrokerClient();
- DCHECK(client) << "Could not get permission broker client.";
- if (!client) {
- callback.Run();
- return;
- }
+ // ChromeOS builds on non-ChromeOS machines (dev) should not attempt to
+ // use permission broker.
+ if (base::chromeos::IsRunningOnChromeOS()) {
+ chromeos::PermissionBrokerClient* client =
+ chromeos::DBusThreadManager::Get()->GetPermissionBrokerClient();
+ DCHECK(client) << "Could not get permission broker client.";
+ if (!client) {
+ callback.Run();
+ return;
+ }
- client->RequestUsbAccess(vendor_id,
- product_id,
- base::Bind(&UsbService::FindDevicesImpl,
- base::Unretained(this),
- vendor_id,
- product_id,
- devices,
- callback));
+ client->RequestUsbAccess(vendor_id,
+ product_id,
+ base::Bind(&UsbService::FindDevicesImpl,
+ base::Unretained(this),
+ vendor_id,
+ product_id,
+ devices,
+ callback));
+ } else {
+ FindDevicesImpl(vendor_id, product_id, devices, callback, true);
+ }
#else
FindDevicesImpl(vendor_id, product_id, devices, callback, true);
#endif // defined(OS_CHROMEOS)