Commit 211a3f36 authored by zelidrag@chromium.org's avatar zelidrag@chromium.org

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
parent 2a02086a
......@@ -27,6 +27,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "base/version.h"
#include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h"
......@@ -2195,18 +2196,21 @@ void ExtensionService::CheckPermissionsIncrease(const Extension* extension,
// can upgrade without requiring this user's approval.
int disable_reasons = extension_prefs_->GetDisableReasons(extension->id());
bool is_default_app_install =
(!is_extension_upgrade && extension->was_installed_by_default());
bool auto_grant_permission =
(!is_extension_upgrade && extension->was_installed_by_default()) ||
chrome::IsRunningInForcedAppMode();
// Silently grant all active permissions to default apps only on install.
// After install they should behave like other apps.
if (is_default_app_install)
// Silently grant all active permissions to apps install in kiosk mode on both
// install and update.
if (auto_grant_permission)
GrantPermissions(extension);
bool is_privilege_increase = false;
// We only need to compare the granted permissions to the current permissions
// if the extension is not allowed to silently increase its permissions.
if (!extensions::PermissionsData::CanSilentlyIncreasePermissions(extension) &&
!is_default_app_install) {
!auto_grant_permission) {
// Add all the recognized permissions if the granted permissions list
// hasn't been initialized yet.
scoped_refptr<PermissionSet> granted_permissions =
......
......@@ -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 @@ void UsbService::FindDevices(const uint16 vendor_id,
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment