OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 DictionaryValue strings; | 81 DictionaryValue strings; |
82 // Toggle Cancel button. | 82 // Toggle Cancel button. |
83 strings.SetString("display_cancel", | 83 strings.SetString("display_cancel", |
84 tab()->controller().CanGoBack() ? "inline" : "none"); | 84 tab()->controller().CanGoBack() ? "inline" : "none"); |
85 | 85 |
86 int64 time_to_wait = std::max( | 86 int64 time_to_wait = std::max( |
87 static_cast<int64>(0), | 87 static_cast<int64>(0), |
88 kMaxBlankPeriod - | 88 kMaxBlankPeriod - |
89 NetworkStateNotifier::GetOfflineDuration().InMilliseconds()); | 89 NetworkStateNotifier::GetOfflineDuration().InMilliseconds()); |
90 // Set the timeout to show the page. | 90 // Set the timeout to show the page. |
91 strings.SetString("on_load", | 91 strings.SetInteger("timeToWait", static_cast<int>(time_to_wait)); |
92 WideToUTF16Hack(base::StringPrintf(L"startTimer(%ld)", | |
93 time_to_wait))); | |
94 // Button labels | 92 // Button labels |
95 SetString(&strings, "load_button", IDS_OFFLINE_LOAD_BUTTON); | 93 SetString(&strings, "load_button", IDS_OFFLINE_LOAD_BUTTON); |
96 SetString(&strings, "cancel_button", IDS_OFFLINE_CANCEL_BUTTON); | 94 SetString(&strings, "cancel_button", IDS_OFFLINE_CANCEL_BUTTON); |
97 | 95 |
98 SetString(&strings, "heading", IDS_OFFLINE_LOAD_HEADLINE); | 96 SetString(&strings, "heading", IDS_OFFLINE_LOAD_HEADLINE); |
99 SetString(&strings, "network_settings", IDS_OFFLINE_NETWORK_SETTINGS); | 97 SetString(&strings, "network_settings", IDS_OFFLINE_NETWORK_SETTINGS); |
100 | 98 |
101 bool rtl = base::i18n::IsRTL(); | 99 bool rtl = base::i18n::IsRTL(); |
102 strings.SetString("textdirection", rtl ? "rtl" : "ltr"); | 100 strings.SetString("textdirection", rtl ? "rtl" : "ltr"); |
103 | 101 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 registrar_.Remove(this, NotificationType::NETWORK_STATE_CHANGED, | 220 registrar_.Remove(this, NotificationType::NETWORK_STATE_CHANGED, |
223 NotificationService::AllSources()); | 221 NotificationService::AllSources()); |
224 Proceed(); | 222 Proceed(); |
225 } | 223 } |
226 } else { | 224 } else { |
227 InterstitialPage::Observe(type, source, details); | 225 InterstitialPage::Observe(type, source, details); |
228 } | 226 } |
229 } | 227 } |
230 | 228 |
231 } // namespace chromeos | 229 } // namespace chromeos |
OLD | NEW |