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

Side by Side Diff: content/browser/frame_host/mixed_content_navigation_throttle.h

Issue 1905033002: PlzNavigate: Move navigation-level mixed content checks to the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@console-security-message
Patch Set: MixedContent::ContextType comes from the renderer; lessen Blink public code; fixed build. Created 3 years, 11 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 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 CONTENT_BROWSER_FRAME_HOST_MIXED_CONTENT_NAVIGATION_THROTTLE_H_
6 #define CONTENT_BROWSER_FRAME_HOST_MIXED_CONTENT_NAVIGATION_THROTTLE_H_
7
8 #include <set>
9
10 #include "base/gtest_prod_util.h"
11 #include "base/macros.h"
12 #include "content/common/content_export.h"
13 #include "content/public/browser/navigation_handle.h"
14 #include "content/public/browser/navigation_throttle.h"
15 #include "content/public/common/request_context_type.h"
16 #include "third_party/WebKit/public/platform/WebMixedContent.h"
17
18 namespace content {
19
20 class FrameTreeNode;
21 struct WebPreferences;
22
23 using ThrottleCheckResult = NavigationThrottle::ThrottleCheckResult;
24
25 // Responsible for browser process side mixed-content security. It checks only
26 // for frame-level resource loads (aka navigation loads); fetching of
27 // sub-resources are checked in the renderer process by MixedContentChecker.
28 // Changes to this class might need to be reflected on its renderer counterpart.
29 //
30 // Current mixed content draft that drives this implementation:
31 // https://w3c.github.io/webappsec-mixed-content/
32 class MixedContentNavigationThrottle : public NavigationThrottle {
33 public:
34 MixedContentNavigationThrottle(NavigationHandle* navigation_handle);
35 ~MixedContentNavigationThrottle() override;
36
37 ThrottleCheckResult WillStartRequest() override;
38
39 ThrottleCheckResult WillRedirectRequest() override;
40
41 ThrottleCheckResult WillProcessResponse() override;
42
43 private:
44 FRIEND_TEST_ALL_PREFIXES(MixedContentNavigationThrottleTest, IsMixedContent);
45
46 // Copy of all mixed content related values from the blink::UseCounter enum.
47 enum UseCounterFeature {
48 MixedContentFormsSubmitted = 441,
49 MixedContentPrivateHostnameInPublicHostname = 530,
50 MixedContentPresent = 609,
51 MixedContentBlockable = 610,
52 MixedContentAudio = 611,
53 MixedContentDownload = 612,
54 MixedContentFavicon = 613,
55 MixedContentImage = 614,
56 MixedContentInternal = 615,
57 MixedContentPlugin = 616,
58 MixedContentPrefetch = 617,
59 MixedContentVideo = 618,
60 MixedContentInNonHTTPSFrameThatRestrictsMixedContent = 661,
61 MixedContentInSecureFrameThatDoesNotRestrictMixedContent = 662,
62 MixedContentWebSocket = 663,
63 MixedContentFormPresent = 665,
64 MixedContentBlockableAllowed = 896,
65 BlockableMixedContentInSubframeBlocked = 966,
66 };
67
68 // Checks if a navigation should be blocked or not due to mixed content.
69 bool ShouldBlockNavigation(bool for_redirect);
70
71 // Returns the parent frame where mixed content exists for the provided data
72 // or null if there is no mixed content.
73 FrameTreeNode* InWhichFrameIsContentMixed(FrameTreeNode* node,
74 const GURL& url);
75
76 // Updates the renderer if any Blink features were used.
77 void MaybeSendBlinkFeatureUsageReport();
78
79 // Reports basic mixed content features when any kinds of mixed is found.
80 void ReportBasicMixedContentFeatures(
81 RequestContextType request_context_type,
82 blink::WebMixedContent::ContextType mixed_content_context_type,
83 const WebPreferences& prefs);
84
85 static bool CONTENT_EXPORT IsMixedContentForTesting(const GURL& origin_url,
86 const GURL& url);
87
88 // Keeps track of mixed content features (as defined in UseCounter)
89 // encountered while running one of the navigation throttling steps. These
90 // values are reported to the respective renderer process once mixed content
91 // checking is finished.
92 std::set<int> mixed_content_features_;
93
94 DISALLOW_COPY_AND_ASSIGN(MixedContentNavigationThrottle);
95 };
96
97 } // namespace content
98
99 #endif // CONTENT_BROWSER_FRAME_HOST_MIXED_CONTENT_NAVIGATION_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698