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

Side by Side Diff: components/security_interstitials/core/unsafe_resource.h

Issue 2540563002: Move SafeBrowsingUIManager::UnsafeResource to security_interstitials namespace (Closed)
Patch Set: remove deps, sources for ios 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_SECURITY_INTERSTITIALS_CORE_UNSAFE_RESOURCE_H_
6 #define COMPONENTS_SECURITY_INTERSTITIALS_CORE_UNSAFE_RESOURCE_H_
7
8 #include <vector>
9
10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/single_thread_task_runner.h"
13 #include "components/safe_browsing_db/hit_report.h"
14 #include "components/safe_browsing_db/util.h"
15 #include "url/gurl.h"
16
17 namespace content {
18 class NavigationEntry;
19 class WebContents;
20 } // namespace content
21
22 namespace security_interstitials {
23
24 // Structure that passes parameters between the IO and UI thread when
25 // interacting with the safe browsing blocking page.
26 struct UnsafeResource {
27 // Passed a boolean indicating whether or not it is OK to proceed with
estark 2016/11/29 22:18:30 Does this need `git cl format`? I'd expect the str
Jialiu Lin 2016/11/30 23:04:00 done.
28 // loading an URL.
29 typedef base::Callback<void(bool /*proceed*/)> UrlCheckCallback;
30
31 UnsafeResource();
32 UnsafeResource(const UnsafeResource& other);
33 ~UnsafeResource();
34
35 // Returns true if this UnsafeResource is a main frame load that was blocked
36 // while the navigation is still pending. Note that a main frame hit may not
37 // be blocking, eg. client side detection happens after the load is
38 // committed.
39 bool IsMainPageLoadBlocked() const;
40
41 // Returns the NavigationEntry for this resource (for a main frame hit) or
42 // for the page which contains this resource (for a subresource hit).
43 // This method must only be called while the UnsafeResource is still
44 // "valid".
45 // I.e,
46 // For MainPageLoadBlocked resources, it must not be called if the load
47 // was aborted (going back or replaced with a different navigation),
48 // or resumed (proceeded through warning or matched whitelist).
49 // For non-MainPageLoadBlocked resources, it must not be called if any
50 // other navigation has committed (whether by going back or unrelated
51 // navigations), though a pending navigation is okay.
52 content::NavigationEntry* GetNavigationEntryForResource() const;
53
54 // Helper to build a getter for WebContents* from render frame id.
55 static base::Callback<content::WebContents*(void)> GetWebContentsGetter(
56 int render_process_host_id,
57 int render_frame_id);
58
59 GURL url;
60 GURL original_url;
61 std::vector<GURL> redirect_urls;
62 bool is_subresource;
63 bool is_subframe;
64 safe_browsing::SBThreatType threat_type;
65 safe_browsing::ThreatMetadata threat_metadata;
66 UrlCheckCallback callback; // This is called back on |callback_thread|.
67 scoped_refptr<base::SingleThreadTaskRunner> callback_thread;
68 base::Callback<content::WebContents*(void)> web_contents_getter;
69 safe_browsing::ThreatSource threat_source;
70 };
71
72 } // security_interstitials
73
74 #endif // COMPONENTS_SECURITY_INTERSTITIALS_CORE_UNSAFE_RESOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698