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

Side by Side Diff: components/data_reduction_proxy/content/browser/data_reduction_proxy_ui_manager.h

Issue 684223003: Data Reduction Proxy Interstitials (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments Created 6 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 2014 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_DATA_REDUCTION_PROXY_CONTENT_BROWSER_DATA_REDUCTION_PROXY_UI_ MANAGER_H_
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_DATA_REDUCTION_PROXY_UI_ MANAGER_H_
7
8 #include <vector>
9
10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/time/time.h"
13 #include "url/gurl.h"
14
15 namespace base {
16 class Time;
17 class Thread;
18 }
19
20 namespace data_reduction_proxy {
21
22 // Construction needs to happen on the main thread.
23 class DataReductionProxyUIManager
24 : public base::RefCountedThreadSafe<DataReductionProxyUIManager> {
25 public:
26 // Passed a boolean indicating whether or not it is OK to proceed with
27 // loading an URL.
28 typedef base::Callback<void(bool /*proceed*/)> UrlCheckCallback;
29
30 // Structure used to pass parameters between the IO and UI thread when
31 // interacting with the blocking page.
32 struct BypassResource {
33 BypassResource();
34 ~BypassResource();
35
36 GURL url;
37 bool is_subresource;
38 UrlCheckCallback callback; // This is called back on the IO thread.
39 int render_process_host_id;
40 int render_view_id;
41 };
42
43 // The data reduction proxy ui manager handles displaying blocking pages.
44 // After a page is loaded from the blocking page, another blocking page will
45 // not be shown for 5 minutes.
46 DataReductionProxyUIManager();
47
48 // Called on the UI thread to display an interstitial page.
49 // |url| is the url of the resource that matches a safe browsing list.
50 // If the request contained a chain of redirects, |url| is the last url
51 // in the chain, and |original_url| is the first one (the root of the
52 // chain). Otherwise, |original_url| = |url|.
53 virtual void DisplayBlockingPage(const BypassResource& resource);
54
55 // The blocking page on the UI thread has completed.
56 void OnBlockingPageDone(const std::vector<BypassResource>& resources,
57 bool proceed);
58
59 private:
60 friend class base::RefCountedThreadSafe<DataReductionProxyUIManager>;
61 virtual ~DataReductionProxyUIManager();
bengr 2014/12/17 00:30:20 Add a blank line above and add comments.
megjablon 2014/12/23 02:18:05 Done.
62
63 base::Time proceed_blocking_page_;
64
65 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyUIManager);
66 };
67
68 } // namespace data_reduction_proxy
69
70 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_DATA_REDUCTION_PROXY_ UI_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698