Index: chrome/browser/download/trusted_sources_manager.cc |
diff --git a/chrome/browser/download/trusted_sources_manager.cc b/chrome/browser/download/trusted_sources_manager.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..67237bc2b8148aaca36175575313134291f247bd |
--- /dev/null |
+++ b/chrome/browser/download/trusted_sources_manager.cc |
@@ -0,0 +1,21 @@ |
+// Copyright (c) 2017 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/browser/download/trusted_sources_manager.h" |
+ |
+#include "base/command_line.h" |
+#include "chrome/common/chrome_switches.h" |
+ |
+TrustedSourcesManager::TrustedSourcesManager() { |
+ base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); |
+ DCHECK(command_line); |
+ rules_.ParseFromString( |
+ command_line->GetSwitchValueASCII(switches::kTrustedDownloadSources)); |
+} |
+ |
+TrustedSourcesManager::~TrustedSourcesManager() = default; |
+ |
+bool TrustedSourcesManager::IsFromTrustedSource(const GURL& url) const { |
+ return rules_.Matches(url); |
+} |