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

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

Powered by Google App Engine
This is Rietveld 408576698