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

Side by Side Diff: components/error_page/common/localized_error.cc

Issue 2560823005: Do not show "DOWNLOAD PAGE LATER" button if RELOAD button is shown (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/error_page/common/localized_error.h" 5 #include "components/error_page/common/localized_error.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 search_suggestion->SetString("searchUrl", params->search_url.spec() + 963 search_suggestion->SetString("searchUrl", params->search_url.spec() +
964 params->search_terms); 964 params->search_terms);
965 search_suggestion->SetString("searchTerms", params->search_terms); 965 search_suggestion->SetString("searchTerms", params->search_terms);
966 search_suggestion->SetInteger("trackingId", 966 search_suggestion->SetInteger("trackingId",
967 params->search_tracking_id); 967 params->search_tracking_id);
968 suggestions_summary_list->Append(std::move(search_suggestion)); 968 suggestions_summary_list->Append(std::move(search_suggestion));
969 } 969 }
970 970
971 // Add the reload suggestion, if needed for pages that didn't come 971 // Add the reload suggestion, if needed for pages that didn't come
972 // from a post. 972 // from a post.
973 bool reload_visible = false;
973 if (params->suggest_reload && !is_post) { 974 if (params->suggest_reload && !is_post) {
975 reload_visible = true;
974 base::DictionaryValue* reload_button = new base::DictionaryValue; 976 base::DictionaryValue* reload_button = new base::DictionaryValue;
975 reload_button->SetString( 977 reload_button->SetString(
976 "msg", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_RELOAD)); 978 "msg", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_RELOAD));
977 reload_button->SetString("reloadUrl", failed_url.spec()); 979 reload_button->SetString("reloadUrl", failed_url.spec());
978 error_strings->Set("reloadButton", reload_button); 980 error_strings->Set("reloadButton", reload_button);
979 reload_button->SetInteger("reloadTrackingId", params->reload_tracking_id); 981 reload_button->SetInteger("reloadTrackingId", params->reload_tracking_id);
980 } 982 }
981 983
982 // If not using the default suggestions, nothing else to do. 984 // If not using the default suggestions, nothing else to do.
983 if (!use_default_suggestions) 985 if (!use_default_suggestions)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 IDS_ERRORPAGES_BUTTON_SHOW_SAVED_COPY)); 1018 IDS_ERRORPAGES_BUTTON_SHOW_SAVED_COPY));
1017 show_saved_copy_button->SetString( 1019 show_saved_copy_button->SetString(
1018 "title", 1020 "title",
1019 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_SHOW_SAVED_COPY_HELP)); 1021 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_SHOW_SAVED_COPY_HELP));
1020 if (show_saved_copy_primary) 1022 if (show_saved_copy_primary)
1021 show_saved_copy_button->SetString("primary", "true"); 1023 show_saved_copy_button->SetString("primary", "true");
1022 error_strings->Set("showSavedCopyButton", show_saved_copy_button); 1024 error_strings->Set("showSavedCopyButton", show_saved_copy_button);
1023 } 1025 }
1024 1026
1025 #if defined(OS_ANDROID) 1027 #if defined(OS_ANDROID)
1026 if (!show_saved_copy_visible && !is_incognito && 1028 if (!reload_visible && !show_saved_copy_visible && !is_incognito &&
1027 failed_url.SchemeIsHTTPOrHTTPS() && 1029 failed_url.is_valid() && failed_url.SchemeIsHTTPOrHTTPS() &&
fgorski 2016/12/09 18:09:32 is it possible to use OfflinePageModel::CanSaveURL
1028 offline_pages::IsOfflinePagesAsyncDownloadEnabled()) { 1030 offline_pages::IsOfflinePagesAsyncDownloadEnabled()) {
1029 std::unique_ptr<base::DictionaryValue> download_button = 1031 std::unique_ptr<base::DictionaryValue> download_button =
1030 base::MakeUnique<base::DictionaryValue>(); 1032 base::MakeUnique<base::DictionaryValue>();
1031 download_button->SetString( 1033 download_button->SetString(
1032 "msg", 1034 "msg",
1033 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_DOWNLOAD)); 1035 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_DOWNLOAD));
1034 download_button->SetString( 1036 download_button->SetString(
1035 "disabledMsg", 1037 "disabledMsg",
1036 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_DOWNLOADING)); 1038 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_DOWNLOADING));
1037 error_strings->Set("downloadButton", std::move(download_button)); 1039 error_strings->Set("downloadButton", std::move(download_button));
(...skipping 14 matching lines...) Expand all
1052 1054
1053 bool LocalizedError::HasStrings(const std::string& error_domain, 1055 bool LocalizedError::HasStrings(const std::string& error_domain,
1054 int error_code) { 1056 int error_code) {
1055 // Whether or not the there are strings for an error does not depend on 1057 // Whether or not the there are strings for an error does not depend on
1056 // whether or not the page was be generated by a POST, so just claim it was 1058 // whether or not the page was be generated by a POST, so just claim it was
1057 // not. 1059 // not.
1058 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr; 1060 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr;
1059 } 1061 }
1060 1062
1061 } // namespace error_page 1063 } // namespace error_page
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698