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

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

Issue 7969009: Removed chromeos::NetworkStateNotifier and redirected all related code to use (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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
11 #include "base/task.h" 11 #include "base/task.h"
12 #include "chrome/browser/chromeos/network_state_notifier.h"
13 #include "chrome/browser/tab_contents/chrome_interstitial_page.h" 12 #include "chrome/browser/tab_contents/chrome_interstitial_page.h"
13 #include "net/base/network_change_notifier.h"
14 14
15 class Extension; 15 class Extension;
16 class TabContents; 16 class TabContents;
17 17
18 namespace base { 18 namespace base {
19 class DictionaryValue; 19 class DictionaryValue;
20 } 20 }
21 21
22 namespace chromeos { 22 namespace chromeos {
23 23
24 // OfflineLoadPage class shows the interstitial page that is shown 24 // OfflineLoadPage class shows the interstitial page that is shown
25 // when no network is available and hides when some network (either 25 // when no network is available and hides when some network (either
26 // one of wifi, 3g or ethernet) becomes available. 26 // one of wifi, 3g or ethernet) becomes available.
27 // It deletes itself when the interstitial page is closed. 27 // It deletes itself when the interstitial page is closed.
28 class OfflineLoadPage : public ChromeInterstitialPage { 28 class OfflineLoadPage : public ChromeInterstitialPage,
29 public net::NetworkChangeNotifier::OnlineStateObserver {
29 public: 30 public:
30 // A delegate class that is called when the interstitinal page 31 // A delegate class that is called when the interstitinal page
31 // is closed. 32 // is closed.
32 class Delegate { 33 class Delegate {
33 public: 34 public:
34 Delegate() {} 35 Delegate() {}
35 virtual ~Delegate() {} 36 virtual ~Delegate() {}
36 // Called when a user selected to proceed or not to proceed 37 // Called when a user selected to proceed or not to proceed
37 // with loading. 38 // with loading.
38 virtual void OnBlockingPageComplete(bool proceed) = 0; 39 virtual void OnBlockingPageComplete(bool proceed) = 0;
(...skipping 17 matching lines...) Expand all
56 in_test_ = true; 57 in_test_ = true;
57 } 58 }
58 59
59 private: 60 private:
60 // ChromeInterstitialPage implementation. 61 // ChromeInterstitialPage implementation.
61 virtual std::string GetHTMLContents(); 62 virtual std::string GetHTMLContents();
62 virtual void CommandReceived(const std::string& command); 63 virtual void CommandReceived(const std::string& command);
63 virtual void Proceed(); 64 virtual void Proceed();
64 virtual void DontProceed(); 65 virtual void DontProceed();
65 66
66 // Overrides ChromeInterstitialPage's Observe. 67 // net::NetworkChangeNotifier::OnlineStateObserver overrides.
67 virtual void Observe(int type, 68 virtual void OnOnlineStateChanged(bool online) OVERRIDE;
68 const NotificationSource& source,
69 const NotificationDetails& details);
70 69
71 // Retrieves template strings of the offline page for app and 70 // Retrieves template strings of the offline page for app and
72 // normal site. 71 // normal site.
73 void GetAppOfflineStrings(const Extension* app, 72 void GetAppOfflineStrings(const Extension* app,
74 const string16& faield_url, 73 const string16& faield_url,
75 base::DictionaryValue* strings) const; 74 base::DictionaryValue* strings) const;
76 void GetNormalOfflineStrings(const string16& faield_url, 75 void GetNormalOfflineStrings(const string16& faield_url,
77 base::DictionaryValue* strings) const; 76 base::DictionaryValue* strings) const;
78 77
79 // True if there is a mobile network is available but 78 // True if there is a mobile network is available but
80 // has not been activated. 79 // has not been activated.
81 bool ShowActivationMessage(); 80 bool ShowActivationMessage();
82 81
83 Delegate* delegate_; 82 Delegate* delegate_;
84 NotificationRegistrar registrar_; 83 NotificationRegistrar registrar_;
85 84
86 // True if the proceed is chosen. 85 // True if the proceed is chosen.
87 bool proceeded_; 86 bool proceeded_;
88 ScopedRunnableMethodFactory<OfflineLoadPage> method_factory_; 87 ScopedRunnableMethodFactory<OfflineLoadPage> method_factory_;
89 88
90 bool in_test_; 89 bool in_test_;
91 90
92 DISALLOW_COPY_AND_ASSIGN(OfflineLoadPage); 91 DISALLOW_COPY_AND_ASSIGN(OfflineLoadPage);
93 }; 92 };
94 93
95 } // namespace chromeos 94 } // namespace chromeos
96 95
97 #endif // CHROME_BROWSER_CHROMEOS_OFFLINE_OFFLINE_LOAD_PAGE_H_ 96 #endif // CHROME_BROWSER_CHROMEOS_OFFLINE_OFFLINE_LOAD_PAGE_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/network_state_notifier_browsertest.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