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

Side by Side Diff: chrome/browser/ui/webui/browsing_history_handler.cc

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/ui/webui/browsing_history_handler.h" 5 #include "chrome/browser/ui/webui/browsing_history_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <utility>
10 11
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
13 #include "base/i18n/rtl.h" 14 #include "base/i18n/rtl.h"
14 #include "base/i18n/time_formatting.h" 15 #include "base/i18n/time_formatting.h"
15 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
16 #include "base/strings/string16.h" 17 #include "base/strings/string16.h"
17 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
19 #include "base/time/time.h" 20 #include "base/time/time.h"
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 missing_count * 100.0 / local_result_count); 699 missing_count * 100.0 / local_result_count);
699 } 700 }
700 } 701 }
701 702
702 // Convert the result vector into a ListValue. 703 // Convert the result vector into a ListValue.
703 base::ListValue results_value; 704 base::ListValue results_value;
704 for (std::vector<BrowsingHistoryHandler::HistoryEntry>::iterator it = 705 for (std::vector<BrowsingHistoryHandler::HistoryEntry>::iterator it =
705 query_results_.begin(); it != query_results_.end(); ++it) { 706 query_results_.begin(); it != query_results_.end(); ++it) {
706 std::unique_ptr<base::Value> value( 707 std::unique_ptr<base::Value> value(
707 it->ToValue(bookmark_model, supervised_user_service, sync_service)); 708 it->ToValue(bookmark_model, supervised_user_service, sync_service));
708 results_value.Append(value.release()); 709 results_value.Append(std::move(value));
709 } 710 }
710 711
711 web_ui()->CallJavascriptFunctionUnsafe("historyResult", results_info_value_, 712 web_ui()->CallJavascriptFunctionUnsafe("historyResult", results_info_value_,
712 results_value); 713 results_value);
713 web_ui()->CallJavascriptFunctionUnsafe( 714 web_ui()->CallJavascriptFunctionUnsafe(
714 "showNotification", base::FundamentalValue(has_synced_results_), 715 "showNotification", base::FundamentalValue(has_synced_results_),
715 base::FundamentalValue(has_other_forms_of_browsing_history_)); 716 base::FundamentalValue(has_other_forms_of_browsing_history_));
716 results_info_value_.Clear(); 717 results_info_value_.Clear();
717 query_results_.clear(); 718 query_results_.clear();
718 web_history_query_results_.clear(); 719 web_history_query_results_.clear();
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 943
943 void BrowsingHistoryHandler::OnURLsDeleted( 944 void BrowsingHistoryHandler::OnURLsDeleted(
944 history::HistoryService* history_service, 945 history::HistoryService* history_service,
945 bool all_history, 946 bool all_history,
946 bool expired, 947 bool expired,
947 const history::URLRows& deleted_rows, 948 const history::URLRows& deleted_rows,
948 const std::set<GURL>& favicon_urls) { 949 const std::set<GURL>& favicon_urls) {
949 if (all_history || DeletionsDiffer(deleted_rows, urls_to_be_deleted_)) 950 if (all_history || DeletionsDiffer(deleted_rows, urls_to_be_deleted_))
950 web_ui()->CallJavascriptFunctionUnsafe("historyDeleted"); 951 web_ui()->CallJavascriptFunctionUnsafe("historyDeleted");
951 } 952 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698