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

Unified Diff: chrome/common/localized_error.cc

Issue 1442433003: Add "Show saved copy" button in dino page when there's offline copy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Some minor fixes Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/localized_error.cc
diff --git a/chrome/common/localized_error.cc b/chrome/common/localized_error.cc
index 30fed8b1ea6b310ef9395da6a1ad01f23bb58fc9..14457bf4fbe3cd68b20cb5cfc3cea1f5af780924 100644
--- a/chrome/common/localized_error.cc
+++ b/chrome/common/localized_error.cc
@@ -554,7 +554,7 @@ void LocalizedError::GetStrings(int error_code,
bool is_post,
bool stale_copy_in_cache,
bool can_show_network_diagnostics_dialog,
- bool has_offline_pages,
+ OfflinePageStatus offline_page_status,
const std::string& locale,
const std::string& accept_languages,
scoped_ptr<error_page::ErrorPageParams> params,
@@ -768,15 +768,26 @@ void LocalizedError::GetStrings(int error_code,
}
#if defined(OS_ANDROID)
- if (has_offline_pages) {
- base::DictionaryValue* show_saved_pages_button = new base::DictionaryValue;
- show_saved_pages_button->SetString(
- "msg",
- l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_SHOW_SAVED_PAGES));
- show_saved_pages_button->SetString(
- "title",
- l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_SHOW_SAVED_PAGES));
- error_strings->Set("showSavedPagesButton", show_saved_pages_button);
+ // Offline button will not be provided when we want to show something in the
+ // cache.
+ if (!show_saved_copy_visible) {
+ if (offline_page_status == OfflinePageStatus::HAS_PAGE_COPY) {
+ base::DictionaryValue* show_offline_copy_button =
+ new base::DictionaryValue;
+ base::string16 button_text =
+ l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_SHOW_OFFLINE_COPY);
+ show_offline_copy_button->SetString("msg", button_text);
+ show_offline_copy_button->SetString("title", button_text);
+ error_strings->Set("showOfflineCopyButton", show_offline_copy_button);
+ } else if (offline_page_status == OfflinePageStatus::HAS_OTHER_COPIES) {
+ base::DictionaryValue* show_offline_pages_button =
+ new base::DictionaryValue;
+ base::string16 button_text =
+ l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_SHOW_OFFLINE_PAGES);
+ show_offline_pages_button->SetString("msg", button_text);
+ show_offline_pages_button->SetString("title", button_text);
+ error_strings->Set("showOfflinePagesButton", show_offline_pages_button);
+ }
}
#endif

Powered by Google App Engine
This is Rietveld 408576698