Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2012 The Chromium Authors |
[email protected] | a8171203 | 2011-08-31 16:10:04 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
dpapad | 538e016 | 2020-12-17 23:06:23 | [diff] [blame] | 5 | #include "chrome/browser/ui/webui/policy/policy_ui.h" |
[email protected] | a8171203 | 2011-08-31 16:10:04 | [diff] [blame] | 6 | |
Jinho Bang | 7ab7a4e | 2018-01-15 14:36:07 | [diff] [blame] | 7 | #include <memory> |
| 8 | |
Anton Urusov | eb2d381 | 2017-08-24 20:01:02 | [diff] [blame] | 9 | #include "build/build_config.h" |
Owen Min | a4157615 | 2022-10-20 23:27:37 | [diff] [blame] | 10 | #include "build/chromeos_buildflags.h" |
Elena Scobici | 518d19c | 2023-06-28 15:01:38 | [diff] [blame^] | 11 | #include "chrome/browser/policy/value_provider/chrome_policies_value_provider.h" |
[email protected] | a8171203 | 2011-08-31 16:10:04 | [diff] [blame] | 12 | #include "chrome/browser/profiles/profile.h" |
dpapad | 538e016 | 2020-12-17 23:06:23 | [diff] [blame] | 13 | #include "chrome/browser/ui/webui/policy/policy_ui_handler.h" |
Lei Zhang | 6af63c26 | 2019-11-22 02:07:03 | [diff] [blame] | 14 | #include "chrome/browser/ui/webui/webui_util.h" |
[email protected] | a8171203 | 2011-08-31 16:10:04 | [diff] [blame] | 15 | #include "chrome/common/url_constants.h" |
Salma Elmahallawy | a44f044 | 2023-01-26 22:00:15 | [diff] [blame] | 16 | #include "chrome/grit/chromium_strings.h" |
dpapad | 5a98fb2 | 2023-01-12 18:51:34 | [diff] [blame] | 17 | #include "components/grit/policy_resources.h" |
| 18 | #include "components/grit/policy_resources_map.h" |
Elena Scobici | db1e74e | 2023-06-08 22:52:24 | [diff] [blame] | 19 | #include "components/policy/core/common/features.h" |
Jayee | 07bb468c | 2023-06-01 18:25:31 | [diff] [blame] | 20 | #include "components/policy/core/common/policy_pref_names.h" |
Elena Scobici | db1e74e | 2023-06-08 22:52:24 | [diff] [blame] | 21 | #include "components/policy/core/common/policy_utils.h" |
Jayee | 07bb468c | 2023-06-01 18:25:31 | [diff] [blame] | 22 | #include "components/prefs/pref_registry_simple.h" |
thestig | 4a2e88e | 2016-08-27 23:23:51 | [diff] [blame] | 23 | #include "components/strings/grit/components_strings.h" |
[email protected] | 01ec4ec | 2012-01-18 04:13:47 | [diff] [blame] | 24 | #include "content/public/browser/web_ui.h" |
Elena Scobici | db1e74e | 2023-06-08 22:52:24 | [diff] [blame] | 25 | #include "content/public/browser/web_ui_controller.h" |
| 26 | #include "content/public/browser/web_ui_message_handler.h" |
Rebekah Potter | f6b2f26 | 2022-05-27 21:43:19 | [diff] [blame] | 27 | #include "services/network/public/mojom/content_security_policy.mojom.h" |
Rohit Rao | e38fb48 | 2020-01-19 21:35:14 | [diff] [blame] | 28 | #include "ui/base/webui/web_ui_util.h" |
[email protected] | 8a2166d9 | 2012-12-06 23:58:45 | [diff] [blame] | 29 | |
David Jean | 93315a8f9 | 2023-06-16 08:03:22 | [diff] [blame] | 30 | #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] | a8ac9bd2 | 2012-05-02 12:30:37 | [diff] [blame] | 40 | namespace { |
David Jean | 93315a8f9 | 2023-06-16 08:03:22 | [diff] [blame] | 41 | |
| 42 | #if BUILDFLAG(IS_ANDROID) |
Salma Elmahallawy | 0d7b1c4 | 2023-01-24 01:03:51 | [diff] [blame] | 43 | // Returns the operating system information to be displayed on |
| 44 | // chrome://policy/logs page. |
| 45 | std::string GetOsInfo() { |
David Jean | 93315a8f9 | 2023-06-16 08:03:22 | [diff] [blame] | 46 | // The base format for the OS version and build |
Salma Elmahallawy | a44f044 | 2023-01-26 22:00:15 | [diff] [blame] | 47 | constexpr char kOSVersionAndBuildFormat[] = "Android %s %s"; |
Salma Elmahallawy | 0d7b1c4 | 2023-01-24 01:03:51 | [diff] [blame] | 48 | return base::StringPrintf( |
| 49 | kOSVersionAndBuildFormat, |
Salma Elmahallawy | a44f044 | 2023-01-26 22:00:15 | [diff] [
|