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 |