Commit 4737cd31 authored by Owen Min's avatar Owen Min Committed by Commit Bot

Get original profile when getting all policy values.

GetAllPolicyValues function requires SchemaRegistryService for the unknown
policy error. SchemaRegistryService is not avaiable for the offTheRecord
BrowserContext. Original profile is needed for the error message.

Bug: 860741
Change-Id: I6bf7cbf10d03c4c71b75d9a9b01264f5a2d6fcc5
Reviewed-on: https://chromium-review.googlesource.com/1128173Reviewed-by: default avatarJulian Pastarmov <pastarmovj@chromium.org>
Commit-Queue: Owen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573333}
parent e5f2a956
......@@ -14,6 +14,7 @@
#include "chrome/browser/policy/profile_policy_connector_factory.h"
#include "chrome/browser/policy/schema_registry_service.h"
#include "chrome/browser/policy/schema_registry_service_factory.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h"
#include "components/policy/core/browser/policy_error_map.h"
#include "components/policy/core/common/policy_details.h"
......@@ -200,6 +201,8 @@ std::unique_ptr<base::DictionaryValue> GetAllPolicyValuesAsDictionary(
if (!context)
return std::make_unique<base::DictionaryValue>(std::move(all_policies));
context = chrome::GetBrowserContextRedirectedInIncognito(context);
// Add Chrome policy values.
auto chrome_policies = std::make_unique<base::DictionaryValue>();
GetChromePolicyValues(context, chrome_policies.get(), with_user_policies,
......
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