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

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: Allow/block flow which includes preview mode. Created 8 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 | 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 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 the observer characterized by the render_process_host_id and
Bernhard Bauer 2012/11/26 16:06:30 AddObserver makes it sound like the method adds an
Sergiu 2012/11/27 15:37:34 Renamed.
27 // render_view_id to the preview map. Adding saves the last approved
28 // hostname as well.
29 static void AddObserver(int render_process_host_id,
30 int render_view_id,
31 const std::string& host);
32 static void RemoveObserver(int render_process_host_id, int render_view_id);
33
34 // Checks whether the |url| needs to trigger an interstitial. If it
35 // |is_redirect| and the user already saw an interstitial which lead to this
Bernhard Bauer 2012/11/26 16:06:30 Nit: the simple past of "lead" is "led".
Sergiu 2012/11/27 15:37:34 Done.
36 // url then do not show another one.
Bernhard Bauer 2012/11/26 16:06:30 Nit: URL in upper case if you use it as a noun, |u
Sergiu 2012/11/27 15:37:34 Done.
37 void CheckNeedToShowInterstitial(bool is_redirect,
Bernhard Bauer 2012/11/26 16:06:30 This actually *does* show the interstitial if nece
Sergiu 2012/11/27 15:37:34 Done.
38 const GURL& url,
39 bool* defer);
40
30 // content::ResourceThrottle implementation: 41 // content::ResourceThrottle implementation:
31 virtual void WillStartRequest(bool* defer) OVERRIDE; 42 virtual void WillStartRequest(bool* defer) OVERRIDE;
32 43
44 virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE;
45
33 private: 46 private:
34 void OnInterstitialResult(bool continue_request); 47 void OnInterstitialResult(bool continue_request);
35 48
36 base::WeakPtrFactory<ManagedModeResourceThrottle> weak_ptr_factory_; 49 base::WeakPtrFactory<ManagedModeResourceThrottle> weak_ptr_factory_;
37 const net::URLRequest* request_; 50 const net::URLRequest* request_;
38 int render_process_host_id_; 51 int render_process_host_id_;
39 int render_view_id_; 52 int render_view_id_;
40 bool is_main_frame_; 53 bool is_main_frame_;
54 // A resource throttle is in preview mode if the user clicked "Preview" after
55 // an interstitial.
Bernhard Bauer 2012/11/26 16:06:30 I think this class also shouldn't know about previ
Sergiu 2012/11/27 15:37:34 Renamed it to after_interstitial_ which I think fi
56 bool is_in_preview_mode_;
41 const ManagedModeURLFilter* url_filter_; 57 const ManagedModeURLFilter* url_filter_;
42 58
43 DISALLOW_COPY_AND_ASSIGN(ManagedModeResourceThrottle); 59 DISALLOW_COPY_AND_ASSIGN(ManagedModeResourceThrottle);
44 }; 60 };
45 61
46 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_RESOURCE_THROTTLE_H_ 62 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_RESOURCE_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698