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

Unified Diff: content/common/sandbox_win.cc

Issue 1407883005: Added field trial for enabling AppContainer and a chrome://flags entry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added disable switch and changed flags Created 5 years, 1 month 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/about_flags.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/sandbox_win.cc
diff --git a/content/common/sandbox_win.cc b/content/common/sandbox_win.cc
index d8689bc71901ec4221f624624125a7596059faa0..88f703cef3388f99df46ec9f4a951c33c4793fc1 100644
--- a/content/common/sandbox_win.cc
+++ b/content/common/sandbox_win.cc
@@ -13,6 +13,7 @@
#include "base/hash.h"
#include "base/logging.h"
#include "base/memory/shared_memory.h"
+#include "base/metrics/field_trial.h"
#include "base/metrics/sparse_histogram.h"
#include "base/path_service.h"
#include "base/process/launch.h"
@@ -540,6 +541,21 @@ BOOL WINAPI DuplicateHandlePatch(HANDLE source_process_handle,
}
#endif
+bool IsAppContainerEnabled() {
+ if (base::win::GetVersion() < base::win::VERSION_WIN8)
+ return false;
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
+ const std::string appcontainer_group_name =
+ base::FieldTrialList::FindFullName("EnableAppContainer");
+ if (command_line.HasSwitch(switches::kDisableAppContainer))
+ return false;
+ if (command_line.HasSwitch(switches::kEnableAppContainer))
+ return true;
+ return base::StartsWith(appcontainer_group_name, "Enabled",
+ base::CompareCase::INSENSITIVE_ASCII);
+}
+
} // namespace
void SetJobLevel(const base::CommandLine& cmd_line,
@@ -566,13 +582,8 @@ void AddBaseHandleClosePolicy(sandbox::TargetPolicy* policy) {
}
void AddAppContainerPolicy(sandbox::TargetPolicy* policy, const wchar_t* sid) {
- if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
- const base::CommandLine& command_line =
- *base::CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kEnableAppContainer)) {
- policy->SetLowBox(sid);
- }
- }
+ if (IsAppContainerEnabled())
+ policy->SetLowBox(sid);
}
bool AddWin32kLockdownPolicy(sandbox::TargetPolicy* policy) {
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698