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

Side by Side Diff: chrome/browser/chromeos/offline/offline_load_page.h

Issue 9147026: API for connection type (Ethernet/WIFI/WWAN ...) in NetworkChangeNotifier. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed a typo Created 8 years, 7 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
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_CHROMEOS_OFFLINE_OFFLINE_LOAD_PAGE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_OFFLINE_OFFLINE_LOAD_PAGE_H_
6 #define CHROME_BROWSER_CHROMEOS_OFFLINE_OFFLINE_LOAD_PAGE_H_ 6 #define CHROME_BROWSER_CHROMEOS_OFFLINE_OFFLINE_LOAD_PAGE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 15 matching lines...) Expand all
26 namespace extensions { 26 namespace extensions {
27 class Extension; 27 class Extension;
28 } 28 }
29 29
30 namespace chromeos { 30 namespace chromeos {
31 31
32 // OfflineLoadPage class shows the interstitial page that is shown 32 // OfflineLoadPage class shows the interstitial page that is shown
33 // when no network is available and hides when some network (either 33 // when no network is available and hides when some network (either
34 // one of wifi, 3g or ethernet) becomes available. 34 // one of wifi, 3g or ethernet) becomes available.
35 // It deletes itself when the interstitial page is closed. 35 // It deletes itself when the interstitial page is closed.
36 class OfflineLoadPage : public content::InterstitialPageDelegate, 36 class OfflineLoadPage
37 public net::NetworkChangeNotifier::OnlineStateObserver { 37 : public content::InterstitialPageDelegate,
38 public net::NetworkChangeNotifier::ConnectionTypeObserver {
38 public: 39 public:
39 // Passed a boolean indicating whether or not it is OK to proceed with the 40 // Passed a boolean indicating whether or not it is OK to proceed with the
40 // page load. 41 // page load.
41 typedef base::Callback<void(bool /*proceed*/)> CompletionCallback; 42 typedef base::Callback<void(bool /*proceed*/)> CompletionCallback;
42 43
43 // Create a offline load page for the |web_contents|. The callback will be 44 // Create a offline load page for the |web_contents|. The callback will be
44 // run on the IO thread. 45 // run on the IO thread.
45 OfflineLoadPage(content::WebContents* web_contents, const GURL& url, 46 OfflineLoadPage(content::WebContents* web_contents, const GURL& url,
46 const CompletionCallback& callback); 47 const CompletionCallback& callback);
47 48
48 void Show(); 49 void Show();
49 50
50 protected: 51 protected:
51 virtual ~OfflineLoadPage(); 52 virtual ~OfflineLoadPage();
52 53
53 // Overridden by tests. 54 // Overridden by tests.
54 virtual void NotifyBlockingPageComplete(bool proceed); 55 virtual void NotifyBlockingPageComplete(bool proceed);
55 56
56 private: 57 private:
57 friend class TestOfflineLoadPage; 58 friend class TestOfflineLoadPage;
58 59
59 // InterstitialPageDelegate implementation. 60 // InterstitialPageDelegate implementation.
60 virtual std::string GetHTMLContents() OVERRIDE; 61 virtual std::string GetHTMLContents() OVERRIDE;
61 virtual void CommandReceived(const std::string& command) OVERRIDE; 62 virtual void CommandReceived(const std::string& command) OVERRIDE;
62 virtual void OverrideRendererPrefs( 63 virtual void OverrideRendererPrefs(
63 content::RendererPreferences* prefs) OVERRIDE; 64 content::RendererPreferences* prefs) OVERRIDE;
64 virtual void OnProceed() OVERRIDE; 65 virtual void OnProceed() OVERRIDE;
65 virtual void OnDontProceed() OVERRIDE; 66 virtual void OnDontProceed() OVERRIDE;
66 67
67 // net::NetworkChangeNotifier::OnlineStateObserver overrides. 68 // net::NetworkChangeNotifier::ConnectionTypeObserver overrides.
68 virtual void OnOnlineStateChanged(bool online) OVERRIDE; 69 virtual void OnConnectionTypeChanged(
70 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE;
69 71
70 // Retrieves template strings of the offline page for app and 72 // Retrieves template strings of the offline page for app and
71 // normal site. 73 // normal site.
72 void GetAppOfflineStrings(const extensions::Extension* app, 74 void GetAppOfflineStrings(const extensions::Extension* app,
73 const string16& faield_url, 75 const string16& faield_url,
74 base::DictionaryValue* strings) const; 76 base::DictionaryValue* strings) const;
75 void GetNormalOfflineStrings(const string16& faield_url, 77 void GetNormalOfflineStrings(const string16& faield_url,
76 base::DictionaryValue* strings) const; 78 base::DictionaryValue* strings) const;
77 79
78 // True if there is a mobile network is available but 80 // True if there is a mobile network is available but
79 // has not been activated. 81 // has not been activated.
80 bool ShowActivationMessage(); 82 bool ShowActivationMessage();
81 83
82 CompletionCallback callback_; 84 CompletionCallback callback_;
83 85
84 // True if the proceed is chosen. 86 // True if the proceed is chosen.
85 bool proceeded_; 87 bool proceeded_;
86 88
87 content::WebContents* web_contents_; 89 content::WebContents* web_contents_;
88 GURL url_; 90 GURL url_;
89 content::InterstitialPage* interstitial_page_; // Owns us. 91 content::InterstitialPage* interstitial_page_; // Owns us.
90 92
91 DISALLOW_COPY_AND_ASSIGN(OfflineLoadPage); 93 DISALLOW_COPY_AND_ASSIGN(OfflineLoadPage);
92 }; 94 };
93 95
94 } // namespace chromeos 96 } // namespace chromeos
95 97
96 #endif // CHROME_BROWSER_CHROMEOS_OFFLINE_OFFLINE_LOAD_PAGE_H_ 98 #endif // CHROME_BROWSER_CHROMEOS_OFFLINE_OFFLINE_LOAD_PAGE_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/net/network_change_notifier_chromeos.cc ('k') | chrome/browser/chromeos/offline/offline_load_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698