Commit 7d390609 authored by Katie D's avatar Katie D Committed by Commit Bot

Accessibility image labels always defaults to disabled in incognito mode.

Bug: 905419
Change-Id: I652369e5e276c2ead9d1e84a15758ff4548d2e80
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1497338Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#637781}
parent cb2e7e5a
......@@ -15,6 +15,7 @@
#include "chrome/common/pref_names.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/sync_preferences/pref_service_syncable.h"
#include "content/public/browser/browser_accessibility_state.h"
#include "content/public/common/content_features.h"
#include "ui/accessibility/ax_action_data.h"
......@@ -32,6 +33,15 @@ void AccessibilityLabelsService::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
}
// static
void AccessibilityLabelsService::InitOffTheRecordPrefs(Profile* profile) {
DCHECK(profile->IsOffTheRecord());
profile->GetPrefs()->SetBoolean(prefs::kAccessibilityImageLabelsEnabled,
false);
profile->GetPrefs()->SetBoolean(prefs::kAccessibilityImageLabelsOptInAccepted,
false);
}
void AccessibilityLabelsService::Init() {
// Hidden behind a feature flag.
if (!base::FeatureList::IsEnabled(features::kExperimentalAccessibilityLabels))
......
......@@ -26,6 +26,9 @@ class AccessibilityLabelsService : public KeyedService {
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
// Off the record profiles will default to having the feature disabled.
static void InitOffTheRecordPrefs(Profile* profile);
void Init();
ui::AXMode GetAXMode();
......
......@@ -15,6 +15,7 @@
#include "base/strings/string_util.h"
#include "base/task/post_task.h"
#include "build/build_config.h"
#include "chrome/browser/accessibility/accessibility_labels_service.h"
#include "chrome/browser/background/background_contents_service_factory.h"
#include "chrome/browser/background_fetch/background_fetch_delegate_factory.h"
#include "chrome/browser/background_fetch/background_fetch_delegate_impl.h"
......@@ -201,6 +202,9 @@ void OffTheRecordProfileImpl::Init() {
// The DomDistillerViewerSource is not a normal WebUI so it must be registered
// as a URLDataSource early.
dom_distiller::RegisterViewerSource(this);
// AccessibilityLabelsService has a default prefs behavior in incognito.
AccessibilityLabelsService::InitOffTheRecordPrefs(this);
}
OffTheRecordProfileImpl::~OffTheRecordProfileImpl() {
......
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