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

Unified Diff: chrome/common/secure_origin_whitelist.cc

Issue 1072933006: Support whitelisting to handle insecure origins as trustworthy origins (chromium) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added more tests Created 5 years, 8 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/common/secure_origin_whitelist.h ('k') | chrome/common/secure_origin_whitelist_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/secure_origin_whitelist.cc
diff --git a/chrome/common/secure_origin_whitelist.cc b/chrome/common/secure_origin_whitelist.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f5958572542d32dd5894f80b3893255fe4adf8ed
--- /dev/null
+++ b/chrome/common/secure_origin_whitelist.cc
@@ -0,0 +1,27 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/common/secure_origin_whitelist.h"
+
+#include <vector>
+
+#include "base/command_line.h"
+#include "base/strings/string_split.h"
+#include "chrome/common/chrome_switches.h"
+
+void GetSecureOriginWhitelist(std::set<GURL>* origins) {
+ // If kUnsafetyTreatInsecureOriginAsSecure option is given and
+ // kUserDataDir is present, add the given origins as trustworthy
+ // for whitelisting.
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
+ if (command_line.HasSwitch(switches::kUnsafetyTreatInsecureOriginAsSecure) &&
+ command_line.HasSwitch(switches::kUserDataDir)) {
+ std::vector<std::string> given_origins;
+ base::SplitString(command_line.GetSwitchValueASCII(
+ switches::kUnsafetyTreatInsecureOriginAsSecure), ',', &given_origins);
+ for (const auto& origin : given_origins)
+ origins->insert(GURL(origin));
+ }
+}
« no previous file with comments | « chrome/common/secure_origin_whitelist.h ('k') | chrome/common/secure_origin_whitelist_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698