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

Unified Diff: chrome/browser/renderer_host/data_reduction_proxy_navigation_throttle_android.h

Issue 1424003006: DataReductionProxyNavigationThrottle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@merge-session-throttle
Patch Set: Created 5 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: chrome/browser/renderer_host/data_reduction_proxy_navigation_throttle_android.h
diff --git a/chrome/browser/renderer_host/data_reduction_proxy_navigation_throttle_android.h b/chrome/browser/renderer_host/data_reduction_proxy_navigation_throttle_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..77030ee6df81cfafaefb1d708532378a68349d2a
--- /dev/null
+++ b/chrome/browser/renderer_host/data_reduction_proxy_navigation_throttle_android.h
@@ -0,0 +1,79 @@
+// Copyright 2015 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_RENDERER_HOST_DATA_REDUCTION_PROXY_NAVIGATION_THROTTLE_ANDROID_H_
+#define CHROME_BROWSER_RENDERER_HOST_DATA_REDUCTION_PROXY_NAVIGATION_THROTTLE_ANDROID_H_
+
+#include <string>
+#include <vector>
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/safe_browsing/safe_browsing_service.h"
+#include "content/public/browser/navigation_throttle.h"
+
+// DataReductionProxyNavigationThrottle checks that URLs are "safe" before
+// navigating to them. To be considered "safe", a URL must not be tagged as a
+// phishing or malware URL by the SPDY proxy.
+//
+// If the URL is tagged as unsafe, a warning page is shown and the request
+// remains suspended. If the user decides to cancel, the request is cancelled.
+// If on the other hand the user decides the URL is safe, the request is
+// resumed.
+//
+// The SPDY proxy and the browser make use of extra headers to communicate.
+// When a proxy detects a malware or a phishing page, it injects a special
+// header and returns a 307 redirect to the same location. If the user decides
+// to proceed, the client injects a special header.
+//
+// Header Sent From Description
+// X-Phishing-Url Proxy Identified as phishing url.
+// X-Malware-Url Proxy Identified as malware url
+// X-Unsafe-Url-Proceed Browser User requests proceed.
+//
+// This class lives entirely on the UI thread.
+class DataReductionProxyNavigationThrottle
+ : public content::NavigationThrottle,
+ public base::SupportsWeakPtr<DataReductionProxyNavigationThrottle> {
+ public:
+ // Create a DataReductionProxyNavigationThrottle. If it's not enabled
+ // or we can't process this navigation, will return NULL.
+ static scoped_ptr<content::NavigationThrottle> MaybeCreate(
+ content::NavigationHandle* navigation_handle,
+ safe_browsing::SafeBrowsingService* sb_service);
+ ~DataReductionProxyNavigationThrottle() override;
+
+ // content::NavigationThrottle implementation.
+ NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override;
+
+ private:
+ // Describes what phase of the check a throttle is in.
+ enum State {
+ STATE_NONE,
+ STATE_DISPLAYING_BLOCKING_PAGE,
+ };
+
+ DataReductionProxyNavigationThrottle(
+ content::NavigationHandle* navigation_handle,
+ safe_browsing::SafeBrowsingService* safe_browsing);
+
+ // SafeBrowsingService::UrlCheckCallback implementation.
+ void OnBlockingPageComplete(bool proceed);
+
+ // Returns the threat type.
+ safe_browsing::SBThreatType CheckUrl();
+
+ State state_;
+
+ // The redirect chain for this resource.
+ std::vector<GURL> redirect_urls_;
+
+ scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_;
+
+ DISALLOW_COPY_AND_ASSIGN(DataReductionProxyNavigationThrottle);
+};
+
+#endif // CHROME_BROWSER_RENDERER_HOST_DATA_REDUCTION_PROXY_NAVIGATION_THROTTLE_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698