Check USB device path access when prompting users to select a device.
[chromium-blink-merge.git] / chrome / browser / chromeos / offline / offline_load_page.h
blobcdccb546f136fc34a77adee9fef1b2dbd5420662
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_OFFLINE_OFFLINE_LOAD_PAGE_H_
6 #define CHROME_BROWSER_CHROMEOS_OFFLINE_OFFLINE_LOAD_PAGE_H_
8 #include <string>
10 #include "base/callback.h"
11 #include "base/compiler_specific.h"
12 #include "content/public/browser/interstitial_page_delegate.h"
13 #include "net/base/network_change_notifier.h"
14 #include "url/gurl.h"
16 namespace base {
17 class DictionaryValue;
20 namespace content {
21 class InterstitialPage;
22 class WebContents;
25 namespace extensions {
26 class Extension;
29 namespace chromeos {
31 // OfflineLoadPage class shows the interstitial page that is shown
32 // when no network is available and hides when some network (either
33 // one of wifi, 3g or ethernet) becomes available.
34 // It deletes itself when the interstitial page is closed.
35 class OfflineLoadPage
36 : public content::InterstitialPageDelegate,
37 public net::NetworkChangeNotifier::ConnectionTypeObserver {
38 public:
39 // Passed a boolean indicating whether or not it is OK to proceed with the
40 // page load.
41 typedef base::Callback<void(bool /*proceed*/)> CompletionCallback;
43 // Create a offline load page for the |web_contents|. The callback will be
44 // run on the IO thread.
45 OfflineLoadPage(content::WebContents* web_contents, const GURL& url,
46 const CompletionCallback& callback);
48 void Show();
50 protected:
51 ~OfflineLoadPage() override;
53 // Overridden by tests.
54 virtual void NotifyBlockingPageComplete(bool proceed);
56 private:
57 friend class TestOfflineLoadPage;
59 // InterstitialPageDelegate implementation.
60 std::string GetHTMLContents() override;
61 void CommandReceived(const std::string& command) override;
62 void OverrideRendererPrefs(content::RendererPreferences* prefs) override;
63 void OnProceed() override;
64 void OnDontProceed() override;
66 // net::NetworkChangeNotifier::ConnectionTypeObserver overrides.
67 void OnConnectionTypeChanged(
68 net::NetworkChangeNotifier::ConnectionType type) override;
70 CompletionCallback callback_;
72 // True if the proceed is chosen.
73 bool proceeded_;
75 content::WebContents* web_contents_;
76 GURL url_;
77 content::InterstitialPage* interstitial_page_; // Owns us.
79 DISALLOW_COPY_AND_ASSIGN(OfflineLoadPage);
82 } // namespace chromeos
84 #endif // CHROME_BROWSER_CHROMEOS_OFFLINE_OFFLINE_LOAD_PAGE_H_