Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4161)

Unified Diff: chrome/browser/ui/webui/settings/system_handler.cc

Issue 2971163002: Add local protection setting to chrome://settings/system
Patch Set: linux-only Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/settings/system_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/settings/system_handler.cc
diff --git a/chrome/browser/ui/webui/settings/system_handler.cc b/chrome/browser/ui/webui/settings/system_handler.cc
index c87ab9fe6233ffa0158b87cc23c0f4c3d7229468..f0f6060ea6c101766150098ef597f967eafd1e42 100644
--- a/chrome/browser/ui/webui/settings/system_handler.cc
+++ b/chrome/browser/ui/webui/settings/system_handler.cc
@@ -6,14 +6,23 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/command_line.h"
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
+#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/gpu/gpu_mode_manager.h"
#include "chrome/browser/ui/webui/settings_utils.h"
+#include "chrome/common/chrome_switches.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+#include "base/files/file_path.h"
+#include "chrome/common/chrome_paths_internal.h"
+#include "components/os_crypt/key_storage_util_linux.h"
+#endif // defined(OS_LINUX) && !defined(OS_CHROMEOS)
+
namespace settings {
SystemHandler::SystemHandler() {}
@@ -24,12 +33,28 @@ SystemHandler::~SystemHandler() {}
void SystemHandler::AddLoadTimeData(content::WebUIDataSource* data_source) {
data_source->AddBoolean("hardwareAccelerationEnabledAtStartup",
g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref());
+
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+ data_source->AddBoolean("hideProtectionSetting",
+ !base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableEncryptionSelection));
+ base::FilePath user_data_dir;
+ chrome::GetDefaultUserDataDirectory(&user_data_dir);
+ data_source->AddBoolean("protectionSetting",
+ !os_crypt::GetBackendUse(user_data_dir));
+#endif // defined(OS_LINUX) && !defined(OS_CHROMEOS)
}
void SystemHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback(
"showProxySettings", base::Bind(&SystemHandler::HandleShowProxySettings,
base::Unretained(this)));
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+ web_ui()->RegisterMessageCallback(
+ "updateProtectionSetting",
+ base::Bind(&SystemHandler::HandleUpdateProtectionSetting,
+ base::Unretained(this)));
+#endif // defined(OS_LINUX) && !defined(OS_CHROMEOS)
}
void SystemHandler::HandleShowProxySettings(const base::ListValue* /*args*/) {
@@ -37,4 +62,13 @@ void SystemHandler::HandleShowProxySettings(const base::ListValue* /*args*/) {
settings_utils::ShowNetworkProxySettings(web_ui()->GetWebContents());
}
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+void SystemHandler::HandleUpdateProtectionSetting(const base::ListValue* args) {
+ bool disableEncryption = args->GetList()[0].GetBool();
+ base::FilePath user_data_dir;
+ chrome::GetDefaultUserDataDirectory(&user_data_dir);
+ os_crypt::WriteBackendUse(user_data_dir, !disableEncryption);
+}
+#endif // defined(OS_LINUX) && !defined(OS_CHROMEOS)
+
} // namespace settings
« no previous file with comments | « chrome/browser/ui/webui/settings/system_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698