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

Side by Side Diff: chrome/browser/managed_mode/managed_mode_resource_throttle.h

Issue 11299035: Support manual (white|black)list, previewing and allowing after interstitial (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor changes Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_RESOURCE_THROTTLE_H_ 5 #ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_RESOURCE_THROTTLE_H_
6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_RESOURCE_THROTTLE_H_ 6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_RESOURCE_THROTTLE_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "content/public/browser/resource_throttle.h" 10 #include "content/public/browser/resource_throttle.h"
11 11
12 class ManagedModeURLFilter; 12 class ManagedModeURLFilter;
13 13
14 namespace net { 14 namespace net {
15 class URLRequest; 15 class URLRequest;
16 } 16 }
17 17
18 // This class temporarily blocks network requests that aren't whitelisted,
19 // and allows resuming them later.
20 class ManagedModeResourceThrottle : public content::ResourceThrottle { 18 class ManagedModeResourceThrottle : public content::ResourceThrottle {
21 public: 19 public:
22 ManagedModeResourceThrottle(const net::URLRequest* request, 20 ManagedModeResourceThrottle(const net::URLRequest* request,
23 int render_process_host_id, 21 int render_process_host_id,
24 int render_view_id, 22 int render_view_id,
25 bool is_main_frame); 23 bool is_main_frame);
26 virtual ~ManagedModeResourceThrottle(); 24 virtual ~ManagedModeResourceThrottle();
27 25
26 // Adds/removes a temporary exception to filtering for a
27 // render_process_host_id and render_view_id pair (which identify a tab)
28 // to the preview map. Adding saves the last approved hostname in the map,
29 // which is then used to allow the user to browse on that hostname without
30 // getting an interstitial. See managed_mode_resource_throttle.cc for more
31 // details on the preview map.
32 static void AddTemporaryException(int render_process_host_id,
33 int render_view_id,
34 const GURL& url);
35 static void RemoveTemporaryException(int render_process_host_id,
36 int render_view_id);
37
28 // content::ResourceThrottle implementation: 38 // content::ResourceThrottle implementation:
29 virtual void WillStartRequest(bool* defer) OVERRIDE; 39 virtual void WillStartRequest(bool* defer) OVERRIDE;
30 40
41 virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE;
42
31 private: 43 private:
44 void ShowInterstitialIfNeeded(bool is_redirect,
45 const GURL& url,
46 bool* defer);
32 void OnInterstitialResult(bool continue_request); 47 void OnInterstitialResult(bool continue_request);
33 48
34 base::WeakPtrFactory<ManagedModeResourceThrottle> weak_ptr_factory_; 49 base::WeakPtrFactory<ManagedModeResourceThrottle> weak_ptr_factory_;
35 const net::URLRequest* request_; 50 const net::URLRequest* request_;
36 int render_process_host_id_; 51 int render_process_host_id_;
37 int render_view_id_; 52 int render_view_id_;
38 bool is_main_frame_; 53 bool is_main_frame_;
54 bool temporarily_allowed_;
39 const ManagedModeURLFilter* url_filter_; 55 const ManagedModeURLFilter* url_filter_;
40 56
41 DISALLOW_COPY_AND_ASSIGN(ManagedModeResourceThrottle); 57 DISALLOW_COPY_AND_ASSIGN(ManagedModeResourceThrottle);
42 }; 58 };
43 59
44 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_RESOURCE_THROTTLE_H_ 60 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_RESOURCE_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698