| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/about_ui.h" | 5 #include "chrome/browser/ui/webui/about_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 AppendBody(&data); | 836 AppendBody(&data); |
| 837 base::FilePath binary = base::CommandLine::ForCurrentProcess()->GetProgram(); | 837 base::FilePath binary = base::CommandLine::ForCurrentProcess()->GetProgram(); |
| 838 data.append(l10n_util::GetStringFUTF8( | 838 data.append(l10n_util::GetStringFUTF8( |
| 839 IDS_ABOUT_LINUX_PROXY_CONFIG_BODY, | 839 IDS_ABOUT_LINUX_PROXY_CONFIG_BODY, |
| 840 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), | 840 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), |
| 841 base::ASCIIToUTF16(binary.BaseName().value()))); | 841 base::ASCIIToUTF16(binary.BaseName().value()))); |
| 842 AppendFooter(&data); | 842 AppendFooter(&data); |
| 843 return data; | 843 return data; |
| 844 } | 844 } |
| 845 | 845 |
| 846 void AboutSandboxRow(std::string* data, int name_id, bool good) { | 846 void AboutSandboxRow(std::string* data, const std::string& prefix, int name_id, |
| 847 bool good) { |
| 847 data->append("<tr><td>"); | 848 data->append("<tr><td>"); |
| 849 data->append(prefix); |
| 848 data->append(l10n_util::GetStringUTF8(name_id)); | 850 data->append(l10n_util::GetStringUTF8(name_id)); |
| 849 if (good) { | 851 if (good) { |
| 850 data->append("</td><td style='color: green;'>"); | 852 data->append("</td><td style='color: green;'>"); |
| 851 data->append( | 853 data->append( |
| 852 l10n_util::GetStringUTF8(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL)); | 854 l10n_util::GetStringUTF8(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL)); |
| 853 } else { | 855 } else { |
| 854 data->append("</td><td style='color: red;'>"); | 856 data->append("</td><td style='color: red;'>"); |
| 855 data->append( | 857 data->append( |
| 856 l10n_util::GetStringUTF8(IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL)); | 858 l10n_util::GetStringUTF8(IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL)); |
| 857 } | 859 } |
| 858 data->append("</td></tr>"); | 860 data->append("</td></tr>"); |
| 859 } | 861 } |
| 860 | 862 |
| 861 std::string AboutSandbox() { | 863 std::string AboutSandbox() { |
| 862 std::string data; | 864 std::string data; |
| 863 AppendHeader(&data, 0, l10n_util::GetStringUTF8(IDS_ABOUT_SANDBOX_TITLE)); | 865 AppendHeader(&data, 0, l10n_util::GetStringUTF8(IDS_ABOUT_SANDBOX_TITLE)); |
| 864 AppendBody(&data); | 866 AppendBody(&data); |
| 865 data.append("<h1>"); | 867 data.append("<h1>"); |
| 866 data.append(l10n_util::GetStringUTF8(IDS_ABOUT_SANDBOX_TITLE)); | 868 data.append(l10n_util::GetStringUTF8(IDS_ABOUT_SANDBOX_TITLE)); |
| 867 data.append("</h1>"); | 869 data.append("</h1>"); |
| 868 | 870 |
| 869 // Get expected sandboxing status of renderers. | 871 // Get expected sandboxing status of renderers. |
| 870 const int status = content::ZygoteHost::GetInstance()->GetSandboxStatus(); | 872 const int status = content::ZygoteHost::GetInstance()->GetSandboxStatus(); |
| 871 | 873 |
| 872 data.append("<table>"); | 874 data.append("<table>"); |
| 873 | 875 |
| 874 AboutSandboxRow(&data, IDS_ABOUT_SANDBOX_SUID_SANDBOX, | 876 AboutSandboxRow(&data, |
| 877 std::string(), |
| 878 IDS_ABOUT_SANDBOX_SUID_SANDBOX, |
| 875 status & content::kSandboxLinuxSUID); | 879 status & content::kSandboxLinuxSUID); |
| 876 AboutSandboxRow(&data, IDS_ABOUT_SANDBOX_NAMESPACE_SANDBOX, | 880 AboutSandboxRow(&data, " ", IDS_ABOUT_SANDBOX_PID_NAMESPACES, |
| 877 status & content::kSandboxLinuxUserNS); | |
| 878 AboutSandboxRow(&data, IDS_ABOUT_SANDBOX_PID_NAMESPACES, | |
| 879 status & content::kSandboxLinuxPIDNS); | 881 status & content::kSandboxLinuxPIDNS); |
| 880 AboutSandboxRow(&data, IDS_ABOUT_SANDBOX_NET_NAMESPACES, | 882 AboutSandboxRow(&data, " ", IDS_ABOUT_SANDBOX_NET_NAMESPACES, |
| 881 status & content::kSandboxLinuxNetNS); | 883 status & content::kSandboxLinuxNetNS); |
| 882 AboutSandboxRow(&data, IDS_ABOUT_SANDBOX_SECCOMP_BPF_SANDBOX, | 884 AboutSandboxRow(&data, |
| 885 std::string(), |
| 886 IDS_ABOUT_SANDBOX_SECCOMP_BPF_SANDBOX, |
| 883 status & content::kSandboxLinuxSeccompBPF); | 887 status & content::kSandboxLinuxSeccompBPF); |
| 884 AboutSandboxRow(&data, IDS_ABOUT_SANDBOX_SECCOMP_BPF_SANDBOX_TSYNC, | 888 AboutSandboxRow(&data, |
| 889 std::string(), |
| 890 IDS_ABOUT_SANDBOX_SECCOMP_BPF_SANDBOX_TSYNC, |
| 885 status & content::kSandboxLinuxSeccompTSYNC); | 891 status & content::kSandboxLinuxSeccompTSYNC); |
| 886 AboutSandboxRow(&data, IDS_ABOUT_SANDBOX_YAMA_LSM, | 892 AboutSandboxRow(&data, |
| 893 std::string(), |
| 894 IDS_ABOUT_SANDBOX_YAMA_LSM, |
| 887 status & content::kSandboxLinuxYama); | 895 status & content::kSandboxLinuxYama); |
| 888 | 896 |
| 889 data.append("</table>"); | 897 data.append("</table>"); |
| 890 | 898 |
| 891 // Require either the setuid or namespace sandbox for our first-layer sandbox. | 899 // The setuid sandbox is required as our first-layer sandbox. |
| 892 bool good_layer1 = (status & content::kSandboxLinuxSUID || | 900 bool good_layer1 = status & content::kSandboxLinuxSUID && |
| 893 status & content::kSandboxLinuxUserNS) && | |
| 894 status & content::kSandboxLinuxPIDNS && | 901 status & content::kSandboxLinuxPIDNS && |
| 895 status & content::kSandboxLinuxNetNS; | 902 status & content::kSandboxLinuxNetNS; |
| 896 // A second-layer sandbox is also required to be adequately sandboxed. | 903 // A second-layer sandbox is also required to be adequately sandboxed. |
| 897 bool good_layer2 = status & content::kSandboxLinuxSeccompBPF; | 904 bool good_layer2 = status & content::kSandboxLinuxSeccompBPF; |
| 898 bool good = good_layer1 && good_layer2; | 905 bool good = good_layer1 && good_layer2; |
| 899 | 906 |
| 900 if (good) { | 907 if (good) { |
| 901 data.append("<p style='color: green'>"); | 908 data.append("<p style='color: green'>"); |
| 902 data.append(l10n_util::GetStringUTF8(IDS_ABOUT_SANDBOX_OK)); | 909 data.append(l10n_util::GetStringUTF8(IDS_ABOUT_SANDBOX_OK)); |
| 903 } else { | 910 } else { |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 Profile* profile = Profile::FromWebUI(web_ui); | 1166 Profile* profile = Profile::FromWebUI(web_ui); |
| 1160 | 1167 |
| 1161 #if defined(ENABLE_THEMES) | 1168 #if defined(ENABLE_THEMES) |
| 1162 // Set up the chrome://theme/ source. | 1169 // Set up the chrome://theme/ source. |
| 1163 ThemeSource* theme = new ThemeSource(profile); | 1170 ThemeSource* theme = new ThemeSource(profile); |
| 1164 content::URLDataSource::Add(profile, theme); | 1171 content::URLDataSource::Add(profile, theme); |
| 1165 #endif | 1172 #endif |
| 1166 | 1173 |
| 1167 content::URLDataSource::Add(profile, new AboutUIHTMLSource(name, profile)); | 1174 content::URLDataSource::Add(profile, new AboutUIHTMLSource(name, profile)); |
| 1168 } | 1175 } |
| OLD | NEW |