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

Unified Diff: chrome/browser/download/trusted_sources_manager.h

Issue 2943763002: Add a new group policy to disable safe browsing for files downloaded from trusted sources. (Closed)
Patch Set: D'Ho! Created 3 years, 6 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
Index: chrome/browser/download/trusted_sources_manager.h
diff --git a/chrome/browser/download/trusted_sources_manager.h b/chrome/browser/download/trusted_sources_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..2318387ba317f65fbe73ae17f401635a6c0d2926
--- /dev/null
+++ b/chrome/browser/download/trusted_sources_manager.h
@@ -0,0 +1,49 @@
+// 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.
+
+#ifndef CHROME_BROWSER_DOWNLOAD_TRUSTED_SOURCES_MANAGER_H_
+#define CHROME_BROWSER_DOWNLOAD_TRUSTED_SOURCES_MANAGER_H_
+
+#include "base/macros.h"
+#include "net/proxy/proxy_bypass_rules.h"
+
+class GURL;
+
+// Identifies if a URL is from a trusted source.
+class TrustedSourcesManager {
+ public:
+ virtual ~TrustedSourcesManager();
+
+ // Creates a platform-dependent instance of TrustedSourcesManager.
+ //
+ // A trusted sources manager has a list of sources that can be trusted with
+ // downloads, extracted from the kTrustedDownloadSources command line switch.
+ // An example usage is to specify that files downloaded from trusted sites
+ // don't need to be scanned by SafeBrowsing when the
+ // SafeBrowsingForTrustedSourcesEnabled policy is set to false.
+ //
+ // On creation the list of trusted sources is NULL.
+ //
+ // If the platform is Windows, on top of the kTrustedDownloadSources value,
+ // the security zone mapping is used to determine whether the source is
+ // trusted or not.
+ //
+ static TrustedSourcesManager* Create();
+
+ // Returns true if the source of this URL is part of the trusted sources.
+ virtual bool IsFromTrustedSource(const GURL& url) const;
+
+ protected:
+ // Must use Create.
+ TrustedSourcesManager();
+
+ private:
+ // We are using ProxyBypassRules because they have the functionality that we
+ // want, but we are not using it for proxy bypass.
+ net::ProxyBypassRules rules_;
+
+ DISALLOW_COPY_AND_ASSIGN(TrustedSourcesManager);
+};
+
+#endif // CHROME_BROWSER_DOWNLOAD_TRUSTED_SOURCES_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698