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

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

Issue 2336863003: Change more base::ListValue methods to use std::unique_ptr. (Closed)
Patch Set: . Created 4 years, 3 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 <utility> 9 #include <utility>
10 10
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 } 498 }
499 } 499 }
500 } 500 }
501 501
502 // Helper function that creates a single entry dictionary and adds it 502 // Helper function that creates a single entry dictionary and adds it
503 // to a ListValue, 503 // to a ListValue,
504 void AddSingleEntryDictionaryToList(base::ListValue* list, 504 void AddSingleEntryDictionaryToList(base::ListValue* list,
505 const char* path, 505 const char* path,
506 int message_id, 506 int message_id,
507 bool insert_as_first_item) { 507 bool insert_as_first_item) {
508 std::unique_ptr<base::DictionaryValue> suggestion_list_item( 508 auto suggestion_list_item = base::MakeUnique<base::DictionaryValue>();
509 new base::DictionaryValue);
510 suggestion_list_item->SetString(path, l10n_util::GetStringUTF16(message_id)); 509 suggestion_list_item->SetString(path, l10n_util::GetStringUTF16(message_id));
511 510
512 if (insert_as_first_item) { 511 if (insert_as_first_item) {
513 list->Insert(0, suggestion_list_item.release()); 512 list->Insert(0, std::move(suggestion_list_item));
514 } else { 513 } else {
515 list->Append(std::move(suggestion_list_item)); 514 list->Append(std::move(suggestion_list_item));
516 } 515 }
517 } 516 }
518 517
519 // Adds a linked suggestion dictionary entry to the suggestions list. 518 // Adds a linked suggestion dictionary entry to the suggestions list.
520 void AddLinkedSuggestionToList(const int error_code, 519 void AddLinkedSuggestionToList(const int error_code,
521 const std::string& locale, 520 const std::string& locale,
522 base::ListValue* suggestions_summary_list, 521 base::ListValue* suggestions_summary_list,
523 bool standalone_suggestion) { 522 bool standalone_suggestion) {
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 1017
1019 bool LocalizedError::HasStrings(const std::string& error_domain, 1018 bool LocalizedError::HasStrings(const std::string& error_domain,
1020 int error_code) { 1019 int error_code) {
1021 // Whether or not the there are strings for an error does not depend on 1020 // Whether or not the there are strings for an error does not depend on
1022 // whether or not the page was be generated by a POST, so just claim it was 1021 // whether or not the page was be generated by a POST, so just claim it was
1023 // not. 1022 // not.
1024 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr; 1023 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr;
1025 } 1024 }
1026 1025
1027 } // namespace error_page 1026 } // namespace error_page
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698