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

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

Issue 1921973002: Convert //components/[a-e]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 months 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
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 "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 base::DictionaryValue* suggestion; 535 base::DictionaryValue* suggestion;
536 suggestions_summary_list->GetDictionary(0, &suggestion); 536 suggestions_summary_list->GetDictionary(0, &suggestion);
537 int type = -1; 537 int type = -1;
538 suggestion->GetInteger("type", &type); 538 suggestion->GetInteger("type", &type);
539 539
540 if (type == kGoogleCachedCopySuggestionType) { 540 if (type == kGoogleCachedCopySuggestionType) {
541 base::string16 cache_url; 541 base::string16 cache_url;
542 suggestion->GetString("urlCorrection", &cache_url); 542 suggestion->GetString("urlCorrection", &cache_url);
543 int cache_tracking_id = -1; 543 int cache_tracking_id = -1;
544 suggestion->GetInteger("trackingId", &cache_tracking_id); 544 suggestion->GetInteger("trackingId", &cache_tracking_id);
545 scoped_ptr<base::DictionaryValue> cache_button(new base::DictionaryValue); 545 std::unique_ptr<base::DictionaryValue> cache_button(
546 new base::DictionaryValue);
546 cache_button->SetString( 547 cache_button->SetString(
547 "msg", 548 "msg",
548 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_SHOW_SAVED_COPY)); 549 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_SHOW_SAVED_COPY));
549 cache_button->SetString("cacheUrl", cache_url); 550 cache_button->SetString("cacheUrl", cache_url);
550 cache_button->SetInteger("trackingId", cache_tracking_id); 551 cache_button->SetInteger("trackingId", cache_tracking_id);
551 error_strings->Set("cacheButton", cache_button.release()); 552 error_strings->Set("cacheButton", cache_button.release());
552 553
553 // Remove the item from suggestions dictionary so that it does not get 554 // Remove the item from suggestions dictionary so that it does not get
554 // displayed by the template in the details section. 555 // displayed by the template in the details section.
555 suggestions_summary_list->Remove(0, nullptr); 556 suggestions_summary_list->Remove(0, nullptr);
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 } 831 }
831 832
832 std::string HttpErrorCodeToString(int error) { 833 std::string HttpErrorCodeToString(int error) {
833 return std::string("HTTP ERROR ") + base::IntToString(error); 834 return std::string("HTTP ERROR ") + base::IntToString(error);
834 } 835 }
835 836
836 } // namespace 837 } // namespace
837 838
838 const char LocalizedError::kHttpErrorDomain[] = "http"; 839 const char LocalizedError::kHttpErrorDomain[] = "http";
839 840
840 void LocalizedError::GetStrings(int error_code, 841 void LocalizedError::GetStrings(
841 const std::string& error_domain, 842 int error_code,
842 const GURL& failed_url, 843 const std::string& error_domain,
843 bool is_post, 844 const GURL& failed_url,
844 bool stale_copy_in_cache, 845 bool is_post,
845 bool can_show_network_diagnostics_dialog, 846 bool stale_copy_in_cache,
846 bool has_offline_pages, 847 bool can_show_network_diagnostics_dialog,
847 const std::string& locale, 848 bool has_offline_pages,
848 scoped_ptr<error_page::ErrorPageParams> params, 849 const std::string& locale,
849 base::DictionaryValue* error_strings) { 850 std::unique_ptr<error_page::ErrorPageParams> params,
851 base::DictionaryValue* error_strings) {
850 webui::SetLoadTimeDataDefaults(locale, error_strings); 852 webui::SetLoadTimeDataDefaults(locale, error_strings);
851 853
852 // Grab the strings and settings that depend on the error type. Init 854 // Grab the strings and settings that depend on the error type. Init
853 // options with default values. 855 // options with default values.
854 LocalizedErrorMap options = { 856 LocalizedErrorMap options = {
855 0, 857 0,
856 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, 858 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
857 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE, 859 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE,
858 IDS_ERRORPAGES_SUMMARY_NOT_AVAILABLE, 860 IDS_ERRORPAGES_SUMMARY_NOT_AVAILABLE,
859 kErrorPagesNoDetails, 861 kErrorPagesNoDetails,
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 1083
1082 bool LocalizedError::HasStrings(const std::string& error_domain, 1084 bool LocalizedError::HasStrings(const std::string& error_domain,
1083 int error_code) { 1085 int error_code) {
1084 // Whether or not the there are strings for an error does not depend on 1086 // Whether or not the there are strings for an error does not depend on
1085 // whether or not the page was be generated by a POST, so just claim it was 1087 // whether or not the page was be generated by a POST, so just claim it was
1086 // not. 1088 // not.
1087 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr; 1089 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr;
1088 } 1090 }
1089 1091
1090 } // namespace error_page 1092 } // namespace error_page
OLDNEW
« no previous file with comments | « components/error_page/common/localized_error.h ('k') | components/error_page/renderer/net_error_helper_core.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698