blob: 5547f4024319a17ca8d0b1ec94fb25e9484806d1 [file] [log] [blame]
Avi Drissman4a8573c2022-09-09 19:35:541// Copyright 2012 The Chromium Authors
[email protected]a81712032011-08-31 16:10:042// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
dpapad538e0162020-12-17 23:06:235#include "chrome/browser/ui/webui/policy/policy_ui.h"
[email protected]a81712032011-08-31 16:10:046
Jinho Bang7ab7a4e2018-01-15 14:36:077#include <memory>
8
Anton Urusoveb2d3812017-08-24 20:01:029#include "build/build_config.h"
Owen Mina41576152022-10-20 23:27:3710#include "build/chromeos_buildflags.h"
Elena Scobici518d19c2023-06-28 15:01:3811#include "chrome/browser/policy/value_provider/chrome_policies_value_provider.h"
[email protected]a81712032011-08-31 16:10:0412#include "chrome/browser/profiles/profile.h"
dpapad538e0162020-12-17 23:06:2313#include "chrome/browser/ui/webui/policy/policy_ui_handler.h"
Lei Zhang6af63c262019-11-22 02:07:0314#include "chrome/browser/ui/webui/webui_util.h"
[email protected]a81712032011-08-31 16:10:0415#include "chrome/common/url_constants.h"
Salma Elmahallawya44f0442023-01-26 22:00:1516#include "chrome/grit/chromium_strings.h"
dpapad5a98fb22023-01-12 18:51:3417#include "components/grit/policy_resources.h"
18#include "components/grit/policy_resources_map.h"
Elena Scobicidb1e74e2023-06-08 22:52:2419#include "components/policy/core/common/features.h"
Jayee07bb468c2023-06-01 18:25:3120#include "components/policy/core/common/policy_pref_names.h"
Elena Scobicidb1e74e2023-06-08 22:52:2421#include "components/policy/core/common/policy_utils.h"
Jayee07bb468c2023-06-01 18:25:3122#include "components/prefs/pref_registry_simple.h"
thestig4a2e88e2016-08-27 23:23:5123#include "components/strings/grit/components_strings.h"
[email protected]01ec4ec2012-01-18 04:13:4724#include "content/public/browser/web_ui.h"
Elena Scobicidb1e74e2023-06-08 22:52:2425#include "content/public/browser/web_ui_controller.h"
26#include "content/public/browser/web_ui_message_handler.h"
Rebekah Potterf6b2f262022-05-27 21:43:1927#include "services/network/public/mojom/content_security_policy.mojom.h"
Rohit Raoe38fb482020-01-19 21:35:1428#include "ui/base/webui/web_ui_util.h"
[email protected]8a2166d92012-12-06 23:58:4529
David Jean93315a8f92023-06-16 08:03:2230#if BUILDFLAG(IS_ANDROID)
31#include "base/json/json_writer.h"
32#include "base/strings/stringprintf.h"
33#include "base/system/sys_info.h"
34#include "components/policy/core/common/policy_logger.h"
35#include "components/version_info/version_info.h"
36#include "components/version_ui/version_handler_helper.h"
37#include "content/public/common/user_agent.h"
38#endif // BUILDFLAG(IS_ANDROID)
39
[email protected]a8ac9bd22012-05-02 12:30:3740namespace {
David Jean93315a8f92023-06-16 08:03:2241
42#if BUILDFLAG(IS_ANDROID)
Salma Elmahallawy0d7b1c42023-01-24 01:03:5143// Returns the operating system information to be displayed on
44// chrome://policy/logs page.
45std::string GetOsInfo() {
David Jean93315a8f92023-06-16 08:03:2246 // The base format for the OS version and build
Salma Elmahallawya44f0442023-01-26 22:00:1547 constexpr char kOSVersionAndBuildFormat[] = "Android %s %s";
Salma Elmahallawy0d7b1c42023-01-24 01:03:5148 return base::StringPrintf(
49 kOSVersionAndBuildFormat,
Salma Elmahallawya44f0442023-01-26 22:00:15