Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / ssl / captive_portal_blocking_page.h
blob0b150cb6f3fb19683bd53b2721d10b8cb365488d
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.
5 #ifndef CHROME_BROWSER_SSL_CAPTIVE_PORTAL_BLOCKING_PAGE_H_
6 #define CHROME_BROWSER_SSL_CAPTIVE_PORTAL_BLOCKING_PAGE_H_
8 #include <string>
10 #include "base/callback.h"
11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/interstitials/security_interstitial_page.h"
14 #include "url/gurl.h"
16 namespace content{
17 class WebContents;
20 // This class is responsible for showing/hiding the interstitial page that is
21 // shown when a captive portal triggers an SSL error.
22 // It deletes itself when the interstitial page is closed.
24 // This class should only be used on the UI thread because its implementation
25 // uses captive_portal::CaptivePortalService, which can only be accessed on the
26 // UI thread. Only used when ENABLE_CAPTIVE_PORTAL_DETECTION is true.
27 class CaptivePortalBlockingPage : public SecurityInterstitialPage {
28 public:
29 // Interstitial type, for testing.
30 static const void* kTypeForTesting;
32 class Delegate {
33 public:
34 virtual ~Delegate() {}
36 // Returns true if the connection is a Wi-Fi connection.
37 virtual bool IsWifiConnection() const = 0;
38 // Returns the SSID of the connected Wi-Fi network, if any.
39 virtual std::string GetWiFiSSID() const = 0;
42 CaptivePortalBlockingPage(content::WebContents* web_contents,
43 const GURL& request_url,
44 const GURL& login_url,
45 const base::Callback<void(bool)>& callback);
46 ~CaptivePortalBlockingPage() override;
48 // SecurityInterstitialPage method:
49 const void* GetTypeForTesting() const override;
51 void SetDelegateForTesting(Delegate* delegate) { delegate_.reset(delegate); }
53 protected:
54 // SecurityInterstitialPage methods:
55 void PopulateInterstitialStrings(
56 base::DictionaryValue* load_time_data) override;
57 bool ShouldCreateNewNavigation() const override;
59 // InterstitialPageDelegate method:
60 void CommandReceived(const std::string& command) override;
62 private:
63 // URL of the login page, opened when the user clicks the "Connect" button.
64 GURL login_url_;
65 scoped_ptr<Delegate> delegate_;
66 base::Callback<void(bool)> callback_;
68 DISALLOW_COPY_AND_ASSIGN(CaptivePortalBlockingPage);
71 #endif // CHROME_BROWSER_SSL_CAPTIVE_PORTAL_BLOCKING_PAGE_H_