| OLD | NEW |
| 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 #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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 NotificationService::AllSources()); | 75 NotificationService::AllSources()); |
| 76 } | 76 } |
| 77 | 77 |
| 78 std::string OfflineLoadPage::GetHTMLContents() { | 78 std::string OfflineLoadPage::GetHTMLContents() { |
| 79 DictionaryValue strings; | 79 DictionaryValue strings; |
| 80 int64 time_to_wait = std::max( | 80 int64 time_to_wait = std::max( |
| 81 static_cast<int64>(0), | 81 static_cast<int64>(0), |
| 82 kMaxBlankPeriod - | 82 kMaxBlankPeriod - |
| 83 NetworkStateNotifier::GetOfflineDuration().InMilliseconds()); | 83 NetworkStateNotifier::GetOfflineDuration().InMilliseconds()); |
| 84 // Set the timeout to show the page. | 84 // Set the timeout to show the page. |
| 85 strings.SetInteger("timeToWait", static_cast<int>(time_to_wait)); | 85 strings.SetInteger("time_to_wait", static_cast<int>(time_to_wait)); |
| 86 // Button labels | 86 // Button labels |
| 87 SetString(&strings, "heading", IDS_OFFLINE_LOAD_HEADLINE); | 87 SetString(&strings, "heading", IDS_OFFLINE_LOAD_HEADLINE); |
| 88 SetString(&strings, "try_loading", IDS_OFFLINE_TRY_LOADING); | 88 SetString(&strings, "try_loading", IDS_OFFLINE_TRY_LOADING); |
| 89 SetString(&strings, "network_settings", IDS_OFFLINE_NETWORK_SETTINGS); | 89 SetString(&strings, "network_settings", IDS_OFFLINE_NETWORK_SETTINGS); |
| 90 | 90 |
| 91 // Activation | 91 // Activation |
| 92 SetString(&strings, "activation_heading", IDS_OFFLINE_ACTIVATION_HEADLINE); | 92 strings.SetBoolean("show_activation", ShowActivationMessage()); |
| 93 SetString(&strings, "activation_msg", IDS_OFFLINE_ACTIVATION_MESSAGE); | |
| 94 SetString(&strings, "activation_button", IDS_OFFLINE_ACTIVATION_BUTTON); | |
| 95 strings.SetString("display_activation", | |
| 96 ShowActivationMessage() ? "block" : "none"); | |
| 97 | 93 |
| 98 bool rtl = base::i18n::IsRTL(); | 94 bool rtl = base::i18n::IsRTL(); |
| 99 strings.SetString("textdirection", rtl ? "rtl" : "ltr"); | 95 strings.SetString("textdirection", rtl ? "rtl" : "ltr"); |
| 100 | 96 |
| 101 string16 failed_url(ASCIIToUTF16(url().spec())); | 97 string16 failed_url(ASCIIToUTF16(url().spec())); |
| 102 if (rtl) | 98 if (rtl) |
| 103 base::i18n::WrapStringWithLTRFormatting(&failed_url); | 99 base::i18n::WrapStringWithLTRFormatting(&failed_url); |
| 104 strings.SetString("url", failed_url); | 100 strings.SetString("url", failed_url); |
| 105 | 101 |
| 106 // The offline page for app has icons and slightly different message. | 102 // The offline page for app has icons and slightly different message. |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 for (size_t i = 0; i < cell_networks.size(); ++i) { | 225 for (size_t i = 0; i < cell_networks.size(); ++i) { |
| 230 chromeos::ActivationState activation_state = | 226 chromeos::ActivationState activation_state = |
| 231 cell_networks[i]->activation_state(); | 227 cell_networks[i]->activation_state(); |
| 232 if (activation_state == ACTIVATION_STATE_ACTIVATED) | 228 if (activation_state == ACTIVATION_STATE_ACTIVATED) |
| 233 return false; | 229 return false; |
| 234 } | 230 } |
| 235 return true; | 231 return true; |
| 236 } | 232 } |
| 237 | 233 |
| 238 } // namespace chromeos | 234 } // namespace chromeos |
| OLD | NEW |