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

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

Issue 9323071: Use InterstitialPage through a delegate interface instead of deriving from it. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix cros Created 8 years, 10 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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "chrome/browser/tab_contents/chrome_interstitial_page.h" 13 #include "content/public/browser/interstitial_page_delegate.h"
14 #include "googleurl/src/gurl.h"
14 #include "net/base/network_change_notifier.h" 15 #include "net/base/network_change_notifier.h"
15 16
16 class Extension; 17 class Extension;
18 class InterstitialPage;
17 19
18 namespace base { 20 namespace base {
19 class DictionaryValue; 21 class DictionaryValue;
20 } 22 }
21 23
24 namespace content {
25 class WebContents;
26 }
27
22 namespace chromeos { 28 namespace chromeos {
23 29
24 // OfflineLoadPage class shows the interstitial page that is shown 30 // OfflineLoadPage class shows the interstitial page that is shown
25 // when no network is available and hides when some network (either 31 // when no network is available and hides when some network (either
26 // one of wifi, 3g or ethernet) becomes available. 32 // one of wifi, 3g or ethernet) becomes available.
27 // It deletes itself when the interstitial page is closed. 33 // It deletes itself when the interstitial page is closed.
28 class OfflineLoadPage : public ChromeInterstitialPage, 34 class OfflineLoadPage : public content::InterstitialPageDelegate,
29 public net::NetworkChangeNotifier::OnlineStateObserver { 35 public net::NetworkChangeNotifier::OnlineStateObserver {
30 public: 36 public:
31 // Passed a boolean indicating whether or not it is OK to proceed with the 37 // Passed a boolean indicating whether or not it is OK to proceed with the
32 // page load. 38 // page load.
33 typedef base::Callback<void(bool /*proceed*/)> CompletionCallback; 39 typedef base::Callback<void(bool /*proceed*/)> CompletionCallback;
34 40
35 // Create a offline load page for the |web_contents|. The callback will be 41 // Create a offline load page for the |web_contents|. The callback will be
36 // run on the IO thread. 42 // run on the IO thread.
37 OfflineLoadPage(content::WebContents* web_contents, const GURL& url, 43 OfflineLoadPage(content::WebContents* web_contents, const GURL& url,
38 const CompletionCallback& callback); 44 const CompletionCallback& callback);
39 45
40 protected: 46 protected:
41 virtual ~OfflineLoadPage(); 47 virtual ~OfflineLoadPage();
42 48
43 // Overridden by tests. 49 // Overridden by tests.
44 virtual void NotifyBlockingPageComplete(bool proceed); 50 virtual void NotifyBlockingPageComplete(bool proceed);
45 51
46 private: 52 private:
47 // ChromeInterstitialPage implementation. 53 // InterstitialPageDelegate implementation.
48 virtual std::string GetHTMLContents() OVERRIDE; 54 virtual std::string GetHTMLContents() OVERRIDE;
49 virtual void CommandReceived(const std::string& command) OVERRIDE; 55 virtual void CommandReceived(const std::string& command) OVERRIDE;
50 virtual void Proceed() OVERRIDE; 56 virtual void OverrideRendererPrefs(
51 virtual void DontProceed() OVERRIDE; 57 content::RendererPreferences* prefs) OVERRIDE;
58 virtual void OnProceed() OVERRIDE;
59 virtual void OnDontProceed() OVERRIDE;
52 60
53 // net::NetworkChangeNotifier::OnlineStateObserver overrides. 61 // net::NetworkChangeNotifier::OnlineStateObserver overrides.
54 virtual void OnOnlineStateChanged(bool online) OVERRIDE; 62 virtual void OnOnlineStateChanged(bool online) OVERRIDE;
55 63
56 // Retrieves template strings of the offline page for app and 64 // Retrieves template strings of the offline page for app and
57 // normal site. 65 // normal site.
58 void GetAppOfflineStrings(const Extension* app, 66 void GetAppOfflineStrings(const Extension* app,
59 const string16& faield_url, 67 const string16& faield_url,
60 base::DictionaryValue* strings) const; 68 base::DictionaryValue* strings) const;
61 void GetNormalOfflineStrings(const string16& faield_url, 69 void GetNormalOfflineStrings(const string16& faield_url,
62 base::DictionaryValue* strings) const; 70 base::DictionaryValue* strings) const;
63 71
64 // True if there is a mobile network is available but 72 // True if there is a mobile network is available but
65 // has not been activated. 73 // has not been activated.
66 bool ShowActivationMessage(); 74 bool ShowActivationMessage();
67 75
68 CompletionCallback callback_; 76 CompletionCallback callback_;
69 77
70 // True if the proceed is chosen. 78 // True if the proceed is chosen.
71 bool proceeded_; 79 bool proceeded_;
72 80
73 bool in_test_; 81 content::WebContents* web_contents_;
82 GURL url_;
83 InterstitialPage* interstitial_page_; // Owns us.
74 84
75 DISALLOW_COPY_AND_ASSIGN(OfflineLoadPage); 85 DISALLOW_COPY_AND_ASSIGN(OfflineLoadPage);
76 }; 86 };
77 87
78 } // namespace chromeos 88 } // namespace chromeos
79 89
80 #endif // CHROME_BROWSER_CHROMEOS_OFFLINE_OFFLINE_LOAD_PAGE_H_ 90 #endif // CHROME_BROWSER_CHROMEOS_OFFLINE_OFFLINE_LOAD_PAGE_H_
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.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