Commit 883b2e5a authored by Kazuhiro Inaba's avatar Kazuhiro Inaba Committed by Commit Bot

Split out the backup settings sync function from ArcIntentHelper.

To split out the important BACKUP permission from the all-in-one apk.

BUG=b/68473003
TEST=Manually tested the ARC++ setup wizard for both cases (opt-in or not)

Change-Id: Ia746be6215678020907d90cd8c2bab6a2be470b0
Reviewed-on: https://chromium-review.googlesource.com/756720Reviewed-by: default avatarJorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: default avatarHidehiko Abe <hidehiko@chromium.org>
Reviewed-by: default avatarShuhei Takahashi <nya@chromium.org>
Commit-Queue: Kazuhiro Inaba <kinaba@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517091}
parent c9eb2964
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "components/arc/arc_bridge_service.h" #include "components/arc/arc_bridge_service.h"
#include "components/arc/arc_browser_context_keyed_service_factory_base.h" #include "components/arc/arc_browser_context_keyed_service_factory_base.h"
#include "components/arc/arc_prefs.h" #include "components/arc/arc_prefs.h"
#include "components/arc/common/backup_settings.mojom.h"
#include "components/arc/intent_helper/arc_intent_helper_bridge.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h"
#include "components/arc/intent_helper/font_size_util.h" #include "components/arc/intent_helper/font_size_util.h"
#include "components/onc/onc_pref_names.h" #include "components/onc/onc_pref_names.h"
...@@ -421,9 +422,26 @@ void ArcSettingsServiceImpl::SyncAccessibilityVirtualKeyboardEnabled() const { ...@@ -421,9 +422,26 @@ void ArcSettingsServiceImpl::SyncAccessibilityVirtualKeyboardEnabled() const {
} }
void ArcSettingsServiceImpl::SyncBackupEnabled() const { void ArcSettingsServiceImpl::SyncBackupEnabled() const {
SendBoolPrefSettingsBroadcast( auto* backup_settings = ARC_GET_INSTANCE_FOR_METHOD(
prefs::kArcBackupRestoreEnabled, arc_bridge_service_->backup_settings(), SetBackupEnabled);
"org.chromium.arc.intent_helper.SET_BACKUP_ENABLED"); if (backup_settings) {
const PrefService::Preference* pref =
registrar_.prefs()->FindPreference(prefs::kArcBackupRestoreEnabled);
DCHECK(pref);
const base::Value* value = pref->GetValue();
DCHECK(value->is_bool());
backup_settings->SetBackupEnabled(value->GetBool(),
!pref->IsUserModifiable());
} else {
// TODO(crbug.com/783567): Remove this code path after we made sure we
// rolled the ARC image that implements backup_settings.
//
// Fallback to use intent broadcast, if the new method is not available.
SendBoolPrefSettingsBroadcast(
prefs::kArcBackupRestoreEnabled,
"org.chromium.arc.intent_helper.SET_BACKUP_ENABLED");
}
if (GetPrefs()->IsManagedPreference(prefs::kArcBackupRestoreEnabled)) { if (GetPrefs()->IsManagedPreference(prefs::kArcBackupRestoreEnabled)) {
// Unset the user pref so that if the pref becomes unmanaged at some point, // Unset the user pref so that if the pref becomes unmanaged at some point,
// this change will be synced. // this change will be synced.
......
...@@ -162,6 +162,7 @@ mojom("arc_bindings") { ...@@ -162,6 +162,7 @@ mojom("arc_bindings") {
"common/arc_bridge.mojom", "common/arc_bridge.mojom",
"common/audio.mojom", "common/audio.mojom",
"common/auth.mojom", "common/auth.mojom",
"common/backup_settings.mojom",
"common/bitmap.mojom", "common/bitmap.mojom",
"common/bluetooth.mojom", "common/bluetooth.mojom",
"common/boot_phase_monitor.mojom", "common/boot_phase_monitor.mojom",
......
...@@ -104,6 +104,12 @@ void ArcBridgeHostImpl::OnAuthInstanceReady(mojom::AuthInstancePtr auth_ptr) { ...@@ -104,6 +104,12 @@ void ArcBridgeHostImpl::OnAuthInstanceReady(mojom::AuthInstancePtr auth_ptr) {
OnInstanceReady(arc_bridge_service_->auth(), std::move(auth_ptr)); OnInstanceReady(arc_bridge_service_->auth(), std::move(auth_ptr));
} }
void ArcBridgeHostImpl::OnBackupSettingsInstanceReady(
mojom::BackupSettingsInstancePtr backup_settings_ptr) {
OnInstanceReady(arc_bridge_service_->backup_settings(),
std::move(backup_settings_ptr));
}
void ArcBridgeHostImpl::OnBluetoothInstanceReady( void ArcBridgeHostImpl::OnBluetoothInstanceReady(
mojom::BluetoothInstancePtr bluetooth_ptr) { mojom::BluetoothInstancePtr bluetooth_ptr) {
OnInstanceReady(arc_bridge_service_->bluetooth(), std::move(bluetooth_ptr)); OnInstanceReady(arc_bridge_service_->bluetooth(), std::move(bluetooth_ptr));
......
...@@ -43,6 +43,8 @@ class ArcBridgeHostImpl : public mojom::ArcBridgeHost { ...@@ -43,6 +43,8 @@ class ArcBridgeHostImpl : public mojom::ArcBridgeHost {
void OnAppInstanceReady(mojom::AppInstancePtr app_ptr) override; void OnAppInstanceReady(mojom::AppInstancePtr app_ptr) override;
void OnAudioInstanceReady(mojom::AudioInstancePtr audio_ptr) override; void OnAudioInstanceReady(mojom::AudioInstancePtr audio_ptr) override;
void OnAuthInstanceReady(mojom::AuthInstancePtr auth_ptr) override; void OnAuthInstanceReady(mojom::AuthInstancePtr auth_ptr) override;
void OnBackupSettingsInstanceReady(
mojom::BackupSettingsInstancePtr backup_settings_ptr) override;
void OnBluetoothInstanceReady( void OnBluetoothInstanceReady(
mojom::BluetoothInstancePtr bluetooth_ptr) override; mojom::BluetoothInstancePtr bluetooth_ptr) override;
void OnBootPhaseMonitorInstanceReady( void OnBootPhaseMonitorInstanceReady(
......
...@@ -18,6 +18,7 @@ class AccessibilityHelperInstance; ...@@ -18,6 +18,7 @@ class AccessibilityHelperInstance;
class AppInstance; class AppInstance;
class AudioInstance; class AudioInstance;
class AuthInstance; class AuthInstance;
class BackupSettingsInstance;
class BluetoothInstance; class BluetoothInstance;
class BootPhaseMonitorInstance; class BootPhaseMonitorInstance;
class CastReceiverInstance; class CastReceiverInstance;
...@@ -65,6 +66,9 @@ class ArcBridgeService { ...@@ -65,6 +66,9 @@ class ArcBridgeService {
InstanceHolder<mojom::AppInstance>* app() { return &app_; } InstanceHolder<mojom::AppInstance>* app() { return &app_; }
InstanceHolder<mojom::AudioInstance>* audio() { return &audio_; } InstanceHolder<mojom::AudioInstance>* audio() { return &audio_; }
InstanceHolder<mojom::AuthInstance>* auth() { return &auth_; } InstanceHolder<mojom::AuthInstance>* auth() { return &auth_; }
InstanceHolder<mojom::BackupSettingsInstance>* backup_settings() {
return &backup_settings_;
}
InstanceHolder<mojom::BluetoothInstance>* bluetooth() { return &bluetooth_; } InstanceHolder<mojom::BluetoothInstance>* bluetooth() { return &bluetooth_; }
InstanceHolder<mojom::BootPhaseMonitorInstance>* boot_phase_monitor() { InstanceHolder<mojom::BootPhaseMonitorInstance>* boot_phase_monitor() {
return &boot_phase_monitor_; return &boot_phase_monitor_;
...@@ -134,6 +138,7 @@ class ArcBridgeService { ...@@ -134,6 +138,7 @@ class ArcBridgeService {
InstanceHolder<mojom::AppInstance> app_; InstanceHolder<mojom::AppInstance> app_;
InstanceHolder<mojom::AudioInstance> audio_; InstanceHolder<mojom::AudioInstance> audio_;
InstanceHolder<mojom::AuthInstance> auth_; InstanceHolder<mojom::AuthInstance> auth_;
InstanceHolder<mojom::BackupSettingsInstance> backup_settings_;
InstanceHolder<mojom::BluetoothInstance> bluetooth_; InstanceHolder<mojom::BluetoothInstance> bluetooth_;
InstanceHolder<mojom::BootPhaseMonitorInstance> boot_phase_monitor_; InstanceHolder<mojom::BootPhaseMonitorInstance> boot_phase_monitor_;
InstanceHolder<mojom::CastReceiverInstance> cast_receiver_; InstanceHolder<mojom::CastReceiverInstance> cast_receiver_;
......
...@@ -8,6 +8,7 @@ import "accessibility_helper.mojom"; ...@@ -8,6 +8,7 @@ import "accessibility_helper.mojom";
import "app.mojom"; import "app.mojom";
import "audio.mojom"; import "audio.mojom";
import "auth.mojom"; import "auth.mojom";
import "backup_settings.mojom";
import "bluetooth.mojom"; import "bluetooth.mojom";
import "boot_phase_monitor.mojom"; import "boot_phase_monitor.mojom";
import "cast_receiver.mojom"; import "cast_receiver.mojom";
...@@ -40,9 +41,9 @@ import "voice_interaction_framework.mojom"; ...@@ -40,9 +41,9 @@ import "voice_interaction_framework.mojom";
import "volume_mounter.mojom"; import "volume_mounter.mojom";
import "wallpaper.mojom"; import "wallpaper.mojom";
// Next MinVersion: 33 // Next MinVersion: 34
// Deprecated method IDs: 101, 105 // Deprecated method IDs: 101, 105
// Next method ID: 138 // Next method ID: 139
interface ArcBridgeHost { interface ArcBridgeHost {
// Keep the entries alphabetical. In order to do so without breaking // Keep the entries alphabetical. In order to do so without breaking
// compatibility with the ARC instance, explicitly assign each interface a // compatibility with the ARC instance, explicitly assign each interface a
...@@ -61,6 +62,9 @@ interface ArcBridgeHost { ...@@ -61,6 +62,9 @@ interface ArcBridgeHost {
// Notifies Chrome that the AuthInstance interface is ready. // Notifies Chrome that the AuthInstance interface is ready.
[MinVersion=1] OnAuthInstanceReady@106(AuthInstance instance_ptr); [MinVersion=1] OnAuthInstanceReady@106(AuthInstance instance_ptr);
// Notifies Chrome that the BackupSettingsInstance interface is ready.
[MinVersion=33] OnBackupSettingsInstanceReady@138(BackupSettingsInstance instance_ptr);
// Notifies Chrome that the BluetoothInstance interface is ready. // Notifies Chrome that the BluetoothInstance interface is ready.
[MinVersion=9] OnBluetoothInstanceReady@113(BluetoothInstance instance_ptr); [MinVersion=9] OnBluetoothInstanceReady@113(BluetoothInstance instance_ptr);
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Next MinVersion: 1
module arc.mojom;
// Controls the setting entries for the ARC backup and restore feature.
// Next method ID: 1
interface BackupSettingsInstance {
// Enables or disables the backup feature as specified by the |enabled|
// parameter. The |managed| parameter indicates whether or not this setting
// is managed by the enterprise policy.
SetBackupEnabled@0(bool enabled, bool managed);
};
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