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

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

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

Powered by Google App Engine
This is Rietveld 408576698