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

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

Issue 12887005: Show interstitial from ManagedModeNavigationObserver instead of ManagedModeResourceThrottle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 7 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/managed_mode/managed_mode_interstitial.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_INTERSTITIAL_H_ 5 #ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_INTERSTITIAL_H_
6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_INTERSTITIAL_H_ 6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_INTERSTITIAL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 10 matching lines...) Expand all
21 // Delegate for an interstitial page when a page is blocked in managed mode 21 // Delegate for an interstitial page when a page is blocked in managed mode
22 // because it is not on any whitelist. It lets an authorized user preview the 22 // because it is not on any whitelist. It lets an authorized user preview the
23 // blocked page, to decide later whether to manually allow it. 23 // blocked page, to decide later whether to manually allow it.
24 class ManagedModeInterstitial : public content::InterstitialPageDelegate { 24 class ManagedModeInterstitial : public content::InterstitialPageDelegate {
25 public: 25 public:
26 ManagedModeInterstitial(content::WebContents* web_contents, 26 ManagedModeInterstitial(content::WebContents* web_contents,
27 const GURL& url, 27 const GURL& url,
28 const base::Callback<void(bool)>& callback); 28 const base::Callback<void(bool)>& callback);
29 virtual ~ManagedModeInterstitial(); 29 virtual ~ManagedModeInterstitial();
30 30
31 // Should be called on the IO thread.
32 // |render_process_host_id| and |render_view_id| identify the WebContents
33 // where the request was blocked. |url| is the URL that was blocked.
34 // |callback| should be called with the result (whether to allow the request
35 // or not).
36 static void ShowInterstitial(int render_process_host_id,
37 int render_view_id,
38 const GURL& url,
39 const base::Callback<void(bool)>& callback);
40
41 private: 31 private:
42 void GoToNewTabPage(); 32 void GoToNewTabPage();
43 33
44 // InterstitialPageDelegate implementation. 34 // InterstitialPageDelegate implementation.
45 virtual std::string GetHTMLContents() OVERRIDE; 35 virtual std::string GetHTMLContents() OVERRIDE;
46 virtual void CommandReceived(const std::string& command) OVERRIDE; 36 virtual void CommandReceived(const std::string& command) OVERRIDE;
47 virtual void OnProceed() OVERRIDE; 37 virtual void OnProceed() OVERRIDE;
48 virtual void OnDontProceed() OVERRIDE; 38 virtual void OnDontProceed() OVERRIDE;
49 39
50 // Will be called when the passphrase dialog is closed, which is shown after 40 // Will be called when the passphrase dialog is closed, which is shown after
51 // clicking the preview button. 41 // clicking the preview button.
52 void OnAuthorizationResult(bool success); 42 void OnAuthorizationResult(bool success);
53 void DispatchContinueRequest(bool continue_request);
54 43
55 // Owns the interstitial, which owns us. 44 // Owns the interstitial, which owns us.
56 content::WebContents* web_contents_; 45 content::WebContents* web_contents_;
57 46
58 content::InterstitialPage* interstitial_page_; // Owns us. 47 content::InterstitialPage* interstitial_page_; // Owns us.
59 48
60 // The UI language. Used for formatting the URL for display. 49 // The UI language. Used for formatting the URL for display.
61 std::string languages_; 50 std::string languages_;
62 GURL url_; 51 GURL url_;
63 52
64 base::WeakPtrFactory<ManagedModeInterstitial> weak_ptr_factory_; 53 base::WeakPtrFactory<ManagedModeInterstitial> weak_ptr_factory_;
65 base::Callback<void(bool)> callback_; 54 base::Callback<void(bool)> callback_;
66 55
67 DISALLOW_COPY_AND_ASSIGN(ManagedModeInterstitial); 56 DISALLOW_COPY_AND_ASSIGN(ManagedModeInterstitial);
68 }; 57 };
69 58
70 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_INTERSTITIAL_H_ 59 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_INTERSTITIAL_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/managed_mode/managed_mode_interstitial.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698