| OLD | NEW |
| 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 #include "chrome/browser/chromeos/offline/offline_load_page.h" | 5 #include "chrome/browser/chromeos/offline/offline_load_page.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/string_piece.h" | 9 #include "base/string_piece.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 OfflineLoadPage::OfflineLoadPage(WebContents* web_contents, | 51 OfflineLoadPage::OfflineLoadPage(WebContents* web_contents, |
| 52 const GURL& url, | 52 const GURL& url, |
| 53 const CompletionCallback& callback) | 53 const CompletionCallback& callback) |
| 54 : callback_(callback), | 54 : callback_(callback), |
| 55 proceeded_(false), | 55 proceeded_(false), |
| 56 web_contents_(web_contents), | 56 web_contents_(web_contents), |
| 57 url_(url) { | 57 url_(url) { |
| 58 net::NetworkChangeNotifier::AddOnlineStateObserver(this); | 58 net::NetworkChangeNotifier::AddOnlineStateObserver(this); |
| 59 interstitial_page_ = InterstitialPage::Create(web_contents, true, url, this); | 59 interstitial_page_ = InterstitialPage::Create(web_contents, true, url, this); |
| 60 interstitial_page_->Show(); | |
| 61 } | 60 } |
| 62 | 61 |
| 63 OfflineLoadPage::~OfflineLoadPage() { | 62 OfflineLoadPage::~OfflineLoadPage() { |
| 64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 63 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 65 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this); | 64 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this); |
| 66 } | 65 } |
| 67 | 66 |
| 67 void OfflineLoadPage::Show() { |
| 68 interstitial_page_->Show(); |
| 69 } |
| 70 |
| 68 std::string OfflineLoadPage::GetHTMLContents() { | 71 std::string OfflineLoadPage::GetHTMLContents() { |
| 69 DictionaryValue strings; | 72 DictionaryValue strings; |
| 70 int64 time_to_wait = 0; // kMaxBlankPeriod | 73 int64 time_to_wait = 0; // kMaxBlankPeriod |
| 71 // Set the timeout to show the page. | 74 // Set the timeout to show the page. |
| 72 strings.SetInteger("time_to_wait", static_cast<int>(time_to_wait)); | 75 strings.SetInteger("time_to_wait", static_cast<int>(time_to_wait)); |
| 73 // Button labels | 76 // Button labels |
| 74 SetString(&strings, "heading", IDS_OFFLINE_LOAD_HEADLINE); | 77 SetString(&strings, "heading", IDS_OFFLINE_LOAD_HEADLINE); |
| 75 SetString(&strings, "try_loading", IDS_OFFLINE_TRY_LOADING); | 78 SetString(&strings, "try_loading", IDS_OFFLINE_TRY_LOADING); |
| 76 SetString(&strings, "network_settings", IDS_OFFLINE_NETWORK_SETTINGS); | 79 SetString(&strings, "network_settings", IDS_OFFLINE_NETWORK_SETTINGS); |
| 77 | 80 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 for (size_t i = 0; i < cell_networks.size(); ++i) { | 219 for (size_t i = 0; i < cell_networks.size(); ++i) { |
| 217 chromeos::ActivationState activation_state = | 220 chromeos::ActivationState activation_state = |
| 218 cell_networks[i]->activation_state(); | 221 cell_networks[i]->activation_state(); |
| 219 if (activation_state == ACTIVATION_STATE_ACTIVATED) | 222 if (activation_state == ACTIVATION_STATE_ACTIVATED) |
| 220 return false; | 223 return false; |
| 221 } | 224 } |
| 222 return true; | 225 return true; |
| 223 } | 226 } |
| 224 | 227 |
| 225 } // namespace chromeos | 228 } // namespace chromeos |
| OLD | NEW |