OLD | NEW |
---|---|
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 namespace policy { | |
19 class URLBlacklist; | |
20 } | |
21 | |
22 class ManagedModeResourceThrottle : public content::ResourceThrottle { | 18 class ManagedModeResourceThrottle : public content::ResourceThrottle { |
23 public: | 19 public: |
24 ManagedModeResourceThrottle(const net::URLRequest* request, | 20 ManagedModeResourceThrottle(const net::URLRequest* request, |
25 int render_process_host_id, | 21 int render_process_host_id, |
26 int render_view_id, | 22 int render_view_id, |
27 bool is_main_frame); | 23 bool is_main_frame); |
28 virtual ~ManagedModeResourceThrottle(); | 24 virtual ~ManagedModeResourceThrottle(); |
29 | 25 |
26 // Adds/removes a temporary exception to filtering for a | |
27 // render_process_host_id and render_view_id pair to the preview map. | |
28 // Adding saves the last approved hostname in the map. | |
29 static void AddTemporaryException(int render_process_host_id, | |
30 int render_view_id, | |
31 const std::string& host); | |
32 static void RemoveTemporaryException(int render_process_host_id, | |
33 int render_view_id); | |
34 | |
35 // Checks whether the |url| needs to trigger an interstitial. If it | |
Bernhard Bauer
2012/11/27 18:44:46
Update the comment now? We do more than check, als
Sergiu
2012/11/28 12:53:25
Done.
| |
36 // |is_redirect| or the user already saw an interstitial on the same hostname | |
37 // as this |url| then do not show another one. | |
38 void ShowInterstitialIfNeeded(bool is_redirect, | |
Bernhard Bauer
2012/11/27 18:44:46
Also, make this method private?
Sergiu
2012/11/28 12:53:25
Done.
| |
39 const GURL& url, | |
40 bool* defer); | |
41 | |
30 // content::ResourceThrottle implementation: | 42 // content::ResourceThrottle implementation: |
31 virtual void WillStartRequest(bool* defer) OVERRIDE; | 43 virtual void WillStartRequest(bool* defer) OVERRIDE; |
32 | 44 |
45 virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE; | |
46 | |
33 private: | 47 private: |
34 void OnInterstitialResult(bool continue_request); | 48 void OnInterstitialResult(bool continue_request); |
35 | 49 |
36 base::WeakPtrFactory<ManagedModeResourceThrottle> weak_ptr_factory_; | 50 base::WeakPtrFactory<ManagedModeResourceThrottle> weak_ptr_factory_; |
37 const net::URLRequest* request_; | 51 const net::URLRequest* request_; |
38 int render_process_host_id_; | 52 int render_process_host_id_; |
39 int render_view_id_; | 53 int render_view_id_; |
40 bool is_main_frame_; | 54 bool is_main_frame_; |
55 bool after_interstitial_; | |
41 const ManagedModeURLFilter* url_filter_; | 56 const ManagedModeURLFilter* url_filter_; |
42 | 57 |
43 DISALLOW_COPY_AND_ASSIGN(ManagedModeResourceThrottle); | 58 DISALLOW_COPY_AND_ASSIGN(ManagedModeResourceThrottle); |
44 }; | 59 }; |
45 | 60 |
46 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_RESOURCE_THROTTLE_H_ | 61 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_RESOURCE_THROTTLE_H_ |
OLD | NEW |