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

Unified Diff: components/security_interstitials/content/unsafe_resource.h

Issue 2540563002: Move SafeBrowsingUIManager::UnsafeResource to security_interstitials namespace (Closed)
Patch Set: rebase update Created 4 years 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: components/security_interstitials/content/unsafe_resource.h
diff --git a/components/security_interstitials/content/unsafe_resource.h b/components/security_interstitials/content/unsafe_resource.h
new file mode 100644
index 0000000000000000000000000000000000000000..b26da33d121e9cd4c760616e7a352a8cd175edbe
--- /dev/null
+++ b/components/security_interstitials/content/unsafe_resource.h
@@ -0,0 +1,74 @@
+// Copyright 2016 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 COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_UNSAFE_RESOURCE_H_
+#define COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_UNSAFE_RESOURCE_H_
+
+#include <vector>
+
+#include "base/callback.h"
+#include "base/memory/ref_counted.h"
+#include "base/single_thread_task_runner.h"
+#include "components/safe_browsing_db/hit_report.h"
+#include "components/safe_browsing_db/util.h"
+#include "url/gurl.h"
+
+namespace content {
+class NavigationEntry;
+class WebContents;
+} // namespace content
+
+namespace security_interstitials {
+
+// Structure that passes parameters between the IO and UI thread when
+// interacting with the safe browsing blocking page.
+struct UnsafeResource {
+ // Passed a boolean indicating whether or not it is OK to proceed with
+ // loading an URL.
+ typedef base::Callback<void(bool /*proceed*/)> UrlCheckCallback;
+
+ UnsafeResource();
+ UnsafeResource(const UnsafeResource& other);
+ ~UnsafeResource();
+
+ // Returns true if this UnsafeResource is a main frame load that was blocked
+ // while the navigation is still pending. Note that a main frame hit may not
+ // be blocking, eg. client side detection happens after the load is
+ // committed.
+ bool IsMainPageLoadBlocked() const;
+
+ // Returns the NavigationEntry for this resource (for a main frame hit) or
+ // for the page which contains this resource (for a subresource hit).
+ // This method must only be called while the UnsafeResource is still
+ // "valid".
+ // I.e,
+ // For MainPageLoadBlocked resources, it must not be called if the load
+ // was aborted (going back or replaced with a different navigation),
+ // or resumed (proceeded through warning or matched whitelist).
+ // For non-MainPageLoadBlocked resources, it must not be called if any
+ // other navigation has committed (whether by going back or unrelated
+ // navigations), though a pending navigation is okay.
+ content::NavigationEntry* GetNavigationEntryForResource() const;
+
+ // Helper to build a getter for WebContents* from render frame id.
+ static base::Callback<content::WebContents*(void)> GetWebContentsGetter(
+ int render_process_host_id,
+ int render_frame_id);
+
+ GURL url;
+ GURL original_url;
+ std::vector<GURL> redirect_urls;
+ bool is_subresource;
+ bool is_subframe;
+ safe_browsing::SBThreatType threat_type;
+ safe_browsing::ThreatMetadata threat_metadata;
+ UrlCheckCallback callback; // This is called back on |callback_thread|.
+ scoped_refptr<base::SingleThreadTaskRunner> callback_thread;
+ base::Callback<content::WebContents*(void)> web_contents_getter;
+ safe_browsing::ThreatSource threat_source;
+};
+
+} // security_interstitials
+
+#endif // COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_UNSAFE_RESOURCE_H_
« no previous file with comments | « components/security_interstitials/content/DEPS ('k') | components/security_interstitials/content/unsafe_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698