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

Unified Diff: chrome/browser/extensions/api/history/history_api.cc

Issue 1853573002: [Extensions] Remove 'use_movable_types' from code generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/json_schema_compiler/cc_generator.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/history/history_api.cc
diff --git a/chrome/browser/extensions/api/history/history_api.cc b/chrome/browser/extensions/api/history/history_api.cc
index 47d0a1112c9c1fe61335d22a7310c652bbb4dd12..5de2840a694dd87c42d04a6572eb053f9ffd8b9c 100644
--- a/chrome/browser/extensions/api/history/history_api.cc
+++ b/chrome/browser/extensions/api/history/history_api.cc
@@ -39,10 +39,8 @@ namespace extensions {
using api::history::HistoryItem;
using api::history::VisitItem;
-typedef std::vector<linked_ptr<api::history::HistoryItem> >
- HistoryItemList;
-typedef std::vector<linked_ptr<api::history::VisitItem> >
- VisitItemList;
+typedef std::vector<api::history::HistoryItem> HistoryItemList;
+typedef std::vector<api::history::VisitItem> VisitItemList;
namespace AddUrl = api::history::AddUrl;
namespace DeleteUrl = api::history::DeleteUrl;
@@ -62,28 +60,27 @@ double MilliSecondsFromTime(const base::Time& time) {
return 1000 * time.ToDoubleT();
}
-scoped_ptr<HistoryItem> GetHistoryItem(const history::URLRow& row) {
- scoped_ptr<HistoryItem> history_item(new HistoryItem());
+HistoryItem GetHistoryItem(const history::URLRow& row) {
+ HistoryItem history_item;
- history_item->id = base::Int64ToString(row.id());
- history_item->url.reset(new std::string(row.url().spec()));
- history_item->title.reset(new std::string(base::UTF16ToUTF8(row.title())));
- history_item->last_visit_time.reset(
+ history_item.id = base::Int64ToString(row.id());
+ history_item.url.reset(new std::string(row.url().spec()));
+ history_item.title.reset(new std::string(base::UTF16ToUTF8(row.title())));
+ history_item.last_visit_time.reset(
new double(MilliSecondsFromTime(row.last_visit())));
- history_item->typed_count.reset(new int(row.typed_count()));
- history_item->visit_count.reset(new int(row.visit_count()));
+ history_item.typed_count.reset(new int(row.typed_count()));
+ history_item.visit_count.reset(new int(row.visit_count()));
return history_item;
}
-scoped_ptr<VisitItem> GetVisitItem(const history::VisitRow& row) {
- scoped_ptr<VisitItem> visit_item(new VisitItem());
+VisitItem GetVisitItem(const history::VisitRow& row) {
+ VisitItem visit_item;
- visit_item->id = base::Int64ToString(row.url_id);
- visit_item->visit_id = base::Int64ToString(row.visit_id);
- visit_item->visit_time.reset(
- new double(MilliSecondsFromTime(row.visit_time)));
- visit_item->referring_visit_id = base::Int64ToString(row.referring_visit);
+ visit_item.id = base::Int64ToString(row.url_id);
+ visit_item.visit_id = base::Int64ToString(row.visit_id);
+ visit_item.visit_time.reset(new double(MilliSecondsFromTime(row.visit_time)));
+ visit_item.referring_visit_id = base::Int64ToString(row.referring_visit);
api::history::TransitionType transition = api::history::TRANSITION_TYPE_LINK;
switch (row.transition & ui::PAGE_TRANSITION_CORE_MASK) {
@@ -124,7 +121,7 @@ scoped_ptr<VisitItem> GetVisitItem(const history::VisitRow& row) {
DCHECK(false);
}
- visit_item->transition = transition;
+ visit_item.transition = transition;
return visit_item;
}
@@ -146,8 +143,7 @@ void HistoryEventRouter::OnURLVisited(history::HistoryService* history_service,
const history::URLRow& row,
const history::RedirectList& redirects,
base::Time visit_time) {
- scoped_ptr<HistoryItem> history_item = GetHistoryItem(row);
- scoped_ptr<base::ListValue> args = OnVisited::Create(*history_item);
+ scoped_ptr<base::ListValue> args = OnVisited::Create(GetHistoryItem(row));
DispatchEvent(profile_, events::HISTORY_ON_VISITED,
api::history::OnVisited::kEventName, std::move(args));
}
@@ -299,12 +295,8 @@ void HistoryGetVisitsFunction::QueryComplete(
const history::VisitVector& visits) {
VisitItemList visit_item_vec;
if (success && !visits.empty()) {
- for (history::VisitVector::const_iterator iterator = visits.begin();
- iterator != visits.end();
- ++iterator) {
- visit_item_vec.push_back(make_linked_ptr(
- GetVisitItem(*iterator).release()));
- }
+ for (const history::VisitRow& visit : visits)
+ visit_item_vec.push_back(GetVisitItem(visit));
}
results_ = GetVisits::Results::Create(visit_item_vec);
@@ -342,13 +334,8 @@ bool HistorySearchFunction::RunAsyncImpl() {
void HistorySearchFunction::SearchComplete(history::QueryResults* results) {
HistoryItemList history_item_vec;
if (results && !results->empty()) {
- for (history::QueryResults::URLResultVector::const_iterator iterator =
- results->begin();
- iterator != results->end();
- ++iterator) {
- history_item_vec.push_back(make_linked_ptr(
- GetHistoryItem(**iterator).release()));
- }
+ for (const history::URLResult* item : *results)
+ history_item_vec.push_back(GetHistoryItem(*item));
}
results_ = Search::Results::Create(history_item_vec);
SendAsyncResponse();
« no previous file with comments | « no previous file | tools/json_schema_compiler/cc_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698