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

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

Issue 2574573002: Merge to M56: 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 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 search_suggestion->SetString("searchUrl", params->search_url.spec() + 938 search_suggestion->SetString("searchUrl", params->search_url.spec() +
939 params->search_terms); 939 params->search_terms);
940 search_suggestion->SetString("searchTerms", params->search_terms); 940 search_suggestion->SetString("searchTerms", params->search_terms);
941 search_suggestion->SetInteger("trackingId", 941 search_suggestion->SetInteger("trackingId",
942 params->search_tracking_id); 942 params->search_tracking_id);
943 suggestions_summary_list->Append(std::move(search_suggestion)); 943 suggestions_summary_list->Append(std::move(search_suggestion));
944 } 944 }
945 945
946 // Add the reload suggestion, if needed for pages that didn't come 946 // Add the reload suggestion, if needed for pages that didn't come
947 // from a post. 947 // from a post.
948 #if defined(OS_ANDROID)
949 bool reload_visible = false;
950 #endif // defined(OS_ANDROID)
948 if (params->suggest_reload && !is_post) { 951 if (params->suggest_reload && !is_post) {
952 #if defined(OS_ANDROID)
953 reload_visible = true;
954 #endif // defined(OS_ANDROID)
949 base::DictionaryValue* reload_button = new base::DictionaryValue; 955 base::DictionaryValue* reload_button = new base::DictionaryValue;
950 reload_button->SetString( 956 reload_button->SetString(
951 "msg", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_RELOAD)); 957 "msg", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_RELOAD));
952 reload_button->SetString("reloadUrl", failed_url.spec()); 958 reload_button->SetString("reloadUrl", failed_url.spec());
953 error_strings->Set("reloadButton", reload_button); 959 error_strings->Set("reloadButton", reload_button);
954 reload_button->SetInteger("reloadTrackingId", params->reload_tracking_id); 960 reload_button->SetInteger("reloadTrackingId", params->reload_tracking_id);
955 } 961 }
956 962
957 // If not using the default suggestions, nothing else to do. 963 // If not using the default suggestions, nothing else to do.
958 if (!use_default_suggestions) 964 if (!use_default_suggestions)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 IDS_ERRORPAGES_BUTTON_SHOW_SAVED_COPY)); 997 IDS_ERRORPAGES_BUTTON_SHOW_SAVED_COPY));
992 show_saved_copy_button->SetString( 998 show_saved_copy_button->SetString(
993 "title", 999 "title",
994 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_SHOW_SAVED_COPY_HELP)); 1000 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_SHOW_SAVED_COPY_HELP));
995 if (show_saved_copy_primary) 1001 if (show_saved_copy_primary)
996 show_saved_copy_button->SetString("primary", "true"); 1002 show_saved_copy_button->SetString("primary", "true");
997 error_strings->Set("showSavedCopyButton", show_saved_copy_button); 1003 error_strings->Set("showSavedCopyButton", show_saved_copy_button);
998 } 1004 }
999 1005
1000 #if defined(OS_ANDROID) 1006 #if defined(OS_ANDROID)
1001 if (!show_saved_copy_visible && !is_incognito && 1007 if (!reload_visible && !show_saved_copy_visible && !is_incognito &&
1002 failed_url.SchemeIsHTTPOrHTTPS() && 1008 failed_url.is_valid() && failed_url.SchemeIsHTTPOrHTTPS() &&
1003 offline_pages::IsOfflinePagesAsyncDownloadEnabled()) { 1009 offline_pages::IsOfflinePagesAsyncDownloadEnabled()) {
1004 std::unique_ptr<base::DictionaryValue> download_button = 1010 std::unique_ptr<base::DictionaryValue> download_button =
1005 base::MakeUnique<base::DictionaryValue>(); 1011 base::MakeUnique<base::DictionaryValue>();
1006 download_button->SetString( 1012 download_button->SetString(
1007 "msg", 1013 "msg",
1008 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_DOWNLOAD)); 1014 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_DOWNLOAD));
1009 download_button->SetString( 1015 download_button->SetString(
1010 "disabledMsg", 1016 "disabledMsg",
1011 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_DOWNLOADING)); 1017 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_DOWNLOADING));
1012 error_strings->Set("downloadButton", std::move(download_button)); 1018 error_strings->Set("downloadButton", std::move(download_button));
(...skipping 14 matching lines...) Expand all
1027 1033
1028 bool LocalizedError::HasStrings(const std::string& error_domain, 1034 bool LocalizedError::HasStrings(const std::string& error_domain,
1029 int error_code) { 1035 int error_code) {
1030 // Whether or not the there are strings for an error does not depend on 1036 // Whether or not the there are strings for an error does not depend on
1031 // whether or not the page was be generated by a POST, so just claim it was 1037 // whether or not the page was be generated by a POST, so just claim it was
1032 // not. 1038 // not.
1033 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr; 1039 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr;
1034 } 1040 }
1035 1041
1036 } // namespace error_page 1042 } // 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