summaryrefslogtreecommitdiff
path: root/chromium/components/search_engines
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-31 16:33:43 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-02-06 16:33:22 +0000
commitda51f56cc21233c2d30f0fe0d171727c3102b2e0 (patch)
tree4e579ab70ce4b19bee7984237f3ce05a96d59d83 /chromium/components/search_engines
parentc8c2d1901aec01e934adf561a9fdf0cc776cdef8 (diff)
downloadqtwebengine-chromium-da51f56cc21233c2d30f0fe0d171727c3102b2e0.tar.gz
BASELINE: Update Chromium to 65.0.3525.40
Also imports missing submodules Change-Id: I36901b7c6a325cda3d2c10cedb2186c25af3b79b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/components/search_engines')
-rw-r--r--chromium/components/search_engines/default_search_manager_unittest.cc13
-rw-r--r--chromium/components/search_engines/default_search_policy_handler.cc7
-rw-r--r--chromium/components/search_engines/default_search_policy_handler_unittest.cc20
-rw-r--r--chromium/components/search_engines/keyword_table.cc59
-rw-r--r--chromium/components/search_engines/keyword_table.h2
-rw-r--r--chromium/components/search_engines/prepopulated_engines.json54
-rw-r--r--chromium/components/search_engines/search_engine_data_type_controller_unittest.cc2
-rw-r--r--chromium/components/search_engines/search_engines_test_util.cc3
-rw-r--r--chromium/components/search_engines/search_host_to_urls_map_unittest.cc5
-rw-r--r--chromium/components/search_engines/template_url.cc23
-rw-r--r--chromium/components/search_engines/template_url.h27
-rw-r--r--chromium/components/search_engines/template_url_data_util.cc13
-rw-r--r--chromium/components/search_engines/template_url_fetcher.cc5
-rw-r--r--chromium/components/search_engines/template_url_parser.cc3
-rw-r--r--chromium/components/search_engines/template_url_prepopulate_data.cc1
-rw-r--r--chromium/components/search_engines/template_url_prepopulate_data_unittest.cc15
-rw-r--r--chromium/components/search_engines/template_url_service.cc21
-rw-r--r--chromium/components/search_engines/template_url_service_util_unittest.cc5
-rw-r--r--chromium/components/search_engines/util.cc7
19 files changed, 166 insertions, 119 deletions
diff --git a/chromium/components/search_engines/default_search_manager_unittest.cc b/chromium/components/search_engines/default_search_manager_unittest.cc
index 713a1bf73f8..5277c1921b8 100644
--- a/chromium/components/search_engines/default_search_manager_unittest.cc
+++ b/chromium/components/search_engines/default_search_manager_unittest.cc
@@ -11,7 +11,6 @@
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
-#include "base/memory/ptr_util.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -32,9 +31,9 @@ namespace {
void SetOverrides(sync_preferences::TestingPrefServiceSyncable* prefs,
bool update) {
prefs->SetUserPref(prefs::kSearchProviderOverridesVersion,
- base::MakeUnique<base::Value>(1));
- auto overrides = base::MakeUnique<base::ListValue>();
- auto entry = base::MakeUnique<base::DictionaryValue>();
+ std::make_unique<base::Value>(1));
+ auto overrides = std::make_unique<base::ListValue>();
+ auto entry = std::make_unique<base::DictionaryValue>();
entry->SetString("name", update ? "new_foo" : "foo");
entry->SetString("keyword", update ? "new_fook" : "fook");
@@ -43,17 +42,17 @@ void SetOverrides(sync_preferences::TestingPrefServiceSyncable* prefs,
entry->SetString("encoding", "UTF-8");
entry->SetInteger("id", 1001);
entry->SetString("suggest_url", "http://foo.com/suggest?q={searchTerms}");
- auto alternate_urls = base::MakeUnique<base::ListValue>();
+ auto alternate_urls = std::make_unique<base::ListValue>();
alternate_urls->AppendString("http://foo.com/alternate?q={searchTerms}");
entry->Set("alternate_urls", std::move(alternate_urls));
overrides->Append(std::move(entry));
- entry = base::MakeUnique<base::DictionaryValue>();
+ entry = std::make_unique<base::DictionaryValue>();
entry->SetInteger("id", 1002);
entry->SetString("name", update ? "new_bar" : "bar");
entry->SetString("keyword", update ? "new_bark" : "bark");
entry->SetString("encoding", std::string());
- overrides->Append(base::MakeUnique<base::Value>(entry->Clone()));
+ overrides->Append(std::make_unique<base::Value>(entry->Clone()));
entry->SetInteger("id", 1003);
entry->SetString("name", "baz");
entry->SetString("keyword", "bazk");
diff --git a/chromium/components/search_engines/default_search_policy_handler.cc b/chromium/components/search_engines/default_search_policy_handler.cc
index 6ef34eb6402..7bd0d8d9411 100644
--- a/chromium/components/search_engines/default_search_policy_handler.cc
+++ b/chromium/components/search_engines/default_search_policy_handler.cc
@@ -9,7 +9,6 @@
#include <utility>
#include "base/macros.h"
-#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "components/policy/core/browser/policy_error_map.h"
#include "components/policy/core/common/policy_map.h"
@@ -37,8 +36,8 @@ void SetListInPref(const PolicyMap& policies,
DCHECK(is_list);
}
dict->Set(key, policy_list
- ? base::MakeUnique<base::Value>(policy_list->Clone())
- : base::MakeUnique<base::Value>(base::Value::Type::LIST));
+ ? std::make_unique<base::Value>(policy_list->Clone())
+ : std::make_unique<base::Value>(base::Value::Type::LIST));
}
// Extracts a string from a policy value and adds it to a pref dictionary.
@@ -280,7 +279,7 @@ void DefaultSearchPolicyHandler::EnsureListPrefExists(
base::Value* value;
base::ListValue* list_value;
if (!prefs->GetValue(path, &value) || !value->GetAsList(&list_value))
- prefs->SetValue(path, base::MakeUnique<base::ListValue>());
+ prefs->SetValue(path, std::make_unique<base::ListValue>());
}
} // namespace policy
diff --git a/chromium/components/search_engines/default_search_policy_handler_unittest.cc b/chromium/components/search_engines/default_search_policy_handler_unittest.cc
index f8ccdf7bded..a5610ff682f 100644
--- a/chromium/components/search_engines/default_search_policy_handler_unittest.cc
+++ b/chromium/components/search_engines/default_search_policy_handler_unittest.cc
@@ -79,22 +79,22 @@ void DefaultSearchPolicyHandlerTest::
encodings->AppendString("UTF-8");
policy->Set(key::kDefaultSearchProviderEnabled, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>(true), nullptr);
+ std::make_unique<base::Value>(true), nullptr);
policy->Set(key::kDefaultSearchProviderSearchURL, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>(kSearchURL), nullptr);
+ std::make_unique<base::Value>(kSearchURL), nullptr);
policy->Set(key::kDefaultSearchProviderName, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>(kName), nullptr);
+ std::make_unique<base::Value>(kName), nullptr);
policy->Set(key::kDefaultSearchProviderKeyword, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>(kKeyword), nullptr);
+ std::make_unique<base::Value>(kKeyword), nullptr);
policy->Set(key::kDefaultSearchProviderSuggestURL, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>(kSuggestURL), nullptr);
+ std::make_unique<base::Value>(kSuggestURL), nullptr);
policy->Set(key::kDefaultSearchProviderIconURL, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>(kIconURL), nullptr);
+ std::make_unique<base::Value>(kIconURL), nullptr);
policy->Set(key::kDefaultSearchProviderEncodings, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
base::WrapUnique(encodings), nullptr);
@@ -103,13 +103,13 @@ void DefaultSearchPolicyHandlerTest::
default_alternate_urls_.CreateDeepCopy(), nullptr);
policy->Set(key::kDefaultSearchProviderImageURL, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>(kImageURL), nullptr);
+ std::make_unique<base::Value>(kImageURL), nullptr);
policy->Set(key::kDefaultSearchProviderImageURLPostParams,
POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>(kImageParams), nullptr);
+ std::make_unique<base::Value>(kImageParams), nullptr);
policy->Set(key::kDefaultSearchProviderNewTabURL, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>(kNewTabURL), nullptr);
+ std::make_unique<base::Value>(kNewTabURL), nullptr);
}
// Checks that if the default search policy is missing, that no elements of the
@@ -174,7 +174,7 @@ TEST_F(DefaultSearchPolicyHandlerTest, InvalidType) {
// invalid.
policy.Set(policy_name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>(base::Value::Type::BINARY),
+ std::make_unique<base::Value>(base::Value::Type::BINARY),
nullptr);
UpdateProviderPolicy(policy);
diff --git a/chromium/components/search_engines/keyword_table.cc b/chromium/components/search_engines/keyword_table.cc
index bcd3fc00eb4..8a67ac85f11 100644
--- a/chromium/components/search_engines/keyword_table.cc
+++ b/chromium/components/search_engines/keyword_table.cc
@@ -8,6 +8,7 @@
#include <memory>
#include <set>
+#include <tuple>
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
@@ -102,7 +103,6 @@ const std::string ColumnsForVersion(int version, bool concatenated) {
return base::JoinString(columns, std::string(concatenated ? " || " : ", "));
}
-
// Inserts the data from |data| into |s|. |s| is assumed to have slots for all
// the columns in the keyword table. |id_column| is the slot number to bind
// |data|'s |id| to; |starting_column| is the slot number of the first of a
@@ -132,14 +132,16 @@ void BindURLToStatement(const TemplateURLData& data,
s->BindString(starting_column + 5, data.originating_url.is_valid() ?
history::URLDatabase::GURLToDatabaseURL(data.originating_url) :
std::string());
- s->BindInt64(starting_column + 6, data.date_created.ToTimeT());
+ s->BindInt64(starting_column + 6,
+ data.date_created.since_origin().InMicroseconds());
s->BindInt(starting_column + 7, data.usage_count);
s->BindString(starting_column + 8,
base::JoinString(data.input_encodings, ";"));
s->BindString(starting_column + 9, data.suggestions_url);
s->BindInt(starting_column + 10, data.prepopulate_id);
s->BindBool(starting_column + 11, data.created_by_policy);
- s->BindInt64(starting_column + 12, data.last_modified.ToTimeT());
+ s->BindInt64(starting_column + 12,
+ data.last_modified.since_origin().InMicroseconds());
s->BindString(starting_column + 13, data.sync_guid);
s->BindString(starting_column + 14, alternate_urls);
s->BindString(starting_column + 15, data.image_url);
@@ -147,7 +149,8 @@ void BindURLToStatement(const TemplateURLData& data,
s->BindString(starting_column + 17, data.suggestions_url_post_params);
s->BindString(starting_column + 18, data.image_url_post_params);
s->BindString(starting_column + 19, data.new_tab_url);
- s->BindInt64(starting_column + 20, data.last_visited.ToTimeT());
+ s->BindInt64(starting_column + 20,
+ data.last_visited.since_origin().InMicroseconds());
}
WebDatabaseTable::TypeKey GetKey() {
@@ -222,6 +225,9 @@ bool KeywordTable::MigrateToVersion(int version,
case 76:
*update_compatible_version = true;
return MigrateToVersion76RemoveInstantColumns();
+ case 77:
+ *update_compatible_version = true;
+ return MigrateToVersion77IncreaseTimePrecision();
}
return true;
@@ -396,6 +402,42 @@ bool KeywordTable::MigrateToVersion76RemoveInstantColumns() {
transaction.Commit();
}
+bool KeywordTable::MigrateToVersion77IncreaseTimePrecision() {
+ sql::Transaction transaction(db_);
+ if (!transaction.Begin())
+ return false;
+
+ std::string query(
+ "SELECT id, date_created, last_modified, last_visited FROM keywords");
+ sql::Statement s(db_->GetUniqueStatement(query.c_str()));
+ std::vector<std::tuple<TemplateURLID, Time, Time, Time>> updates;
+ while (s.Step()) {
+ updates.push_back(std::make_tuple(
+ s.ColumnInt64(0), Time::FromTimeT(s.ColumnInt64(1)),
+ Time::FromTimeT(s.ColumnInt64(2)), Time::FromTimeT(s.ColumnInt64(3))));
+ }
+ if (!s.Succeeded())
+ return false;
+
+ for (auto tuple : updates) {
+ sql::Statement update_statement(db_->GetCachedStatement(
+ SQL_FROM_HERE,
+ "UPDATE keywords SET date_created = ?, last_modified = ?, last_visited "
+ "= ? WHERE id = ? "));
+ update_statement.BindInt64(
+ 0, std::get<1>(tuple).since_origin().InMicroseconds());
+ update_statement.BindInt64(
+ 1, std::get<2>(tuple).since_origin().InMicroseconds());
+ update_statement.BindInt64(
+ 2, std::get<3>(tuple).since_origin().InMicroseconds());
+ update_statement.BindInt64(3, std::get<0>(tuple));
+ if (!update_statement.Run()) {
+ return false;
+ }
+ }
+ return transaction.Commit();
+}
+
// static
bool KeywordTable::GetKeywordDataFromStatement(const sql::Statement& s,
TemplateURLData* data) {
@@ -422,8 +464,10 @@ bool KeywordTable::GetKeywordDataFromStatement(const sql::Statement& s,
data->input_encodings = base::SplitString(
s.ColumnString(9), ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
data->id = s.ColumnInt64(0);
- data->date_created = Time::FromTimeT(s.ColumnInt64(7));
- data->last_modified = Time::FromTimeT(s.ColumnInt64(13));
+ data->date_created =
+ base::Time() + base::TimeDelta::FromMicroseconds(s.ColumnInt64(7));
+ data->last_modified =
+ base::Time() + base::TimeDelta::FromMicroseconds(s.ColumnInt64(13));
data->created_by_policy = s.ColumnBool(12);
data->usage_count = s.ColumnInt(8);
data->prepopulate_id = s.ColumnInt(11);
@@ -442,7 +486,8 @@ bool KeywordTable::GetKeywordDataFromStatement(const sql::Statement& s,
}
}
- data->last_visited = Time::FromTimeT(s.ColumnInt64(21));
+ data->last_visited =
+ base::Time() + base::TimeDelta::FromMicroseconds(s.ColumnInt64(21));
return true;
}
diff --git a/chromium/components/search_engines/keyword_table.h b/chromium/components/search_engines/keyword_table.h
index 86059ab8c6f..340d2daa98b 100644
--- a/chromium/components/search_engines/keyword_table.h
+++ b/chromium/components/search_engines/keyword_table.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <string>
+#include <utility>
#include <vector>
#include "base/compiler_specific.h"
@@ -126,6 +127,7 @@ class KeywordTable : public WebDatabaseTable {
bool MigrateToVersion68RemoveShowInDefaultListColumn();
bool MigrateToVersion69AddLastVisitedColumn();
bool MigrateToVersion76RemoveInstantColumns();
+ bool MigrateToVersion77IncreaseTimePrecision();
private:
friend class KeywordTableTest;
diff --git a/chromium/components/search_engines/prepopulated_engines.json b/chromium/components/search_engines/prepopulated_engines.json
index 002b6c0aa6e..5127a1a1f28 100644
--- a/chromium/components/search_engines/prepopulated_engines.json
+++ b/chromium/components/search_engines/prepopulated_engines.json
@@ -32,7 +32,7 @@
// Increment this if you change the data in ways that mean users with
// existing data should get a new version.
- "kCurrentDataVersion": 99
+ "kCurrentDataVersion": 100
},
// The following engines are included in country lists and are added to the
@@ -48,11 +48,13 @@
"id": 35
},
+ // Ask and Ask UK have suggestion URLs reachable over HTTPS, but they
+ // throw a certificate error, so those will remain as HTTP for now.
"ask": {
"name": "Ask",
"keyword": "ask.com",
- "favicon_url": "http://sp.ask.com/sh/i/a16/favicon/favicon.ico",
- "search_url": "http://www.ask.com/web?q={searchTerms}",
+ "favicon_url": "https://sp.ask.com/sh/i/a16/favicon/favicon.ico",
+ "search_url": "https://www.ask.com/web?q={searchTerms}",
"suggest_url": "http://ss.ask.com/query?q={searchTerms}&li=ff",
"type": "SEARCH_ENGINE_ASK",
"id": 4
@@ -61,8 +63,8 @@
"ask_br": {
"name": "Ask Brasil",
"keyword": "br.ask.com",
- "favicon_url": "http://sp.br.ask.com/sh/i/a14/favicon/favicon.ico",
- "search_url": "http://br.ask.com/web?q={searchTerms}",
+ "favicon_url": "https://sp.br.ask.com/sh/i/a14/favicon/favicon.ico",
+ "search_url": "https://br.ask.com/web?q={searchTerms}",
"type": "SEARCH_ENGINE_ASK",
"id": 4
},
@@ -70,13 +72,15 @@
"ask_uk": {
"name": "Ask Jeeves",
"keyword": "uk.ask.com",
- "favicon_url": "http://sp.uk.ask.com/sh/i/a16/favicon/favicon.ico",
- "search_url": "http://uk.ask.com/web?q={searchTerms}",
+ "favicon_url": "https://sp.uk.ask.com/sh/i/a16/favicon/favicon.ico",
+ "search_url": "https://uk.ask.com/web?q={searchTerms}",
"suggest_url": "http://ss.uk.ask.com/query?q={searchTerms}&li=ff",
"type": "SEARCH_ENGINE_ASK",
"id": 4
},
+ // Baidu's suggestion URL is not reachable over HTTPS, so it remains as
+ // HTTP for now.
"baidu": {
"name": "\u767e\u5ea6",
"keyword": "baidu.com",
@@ -103,9 +107,9 @@
"daum": {
"name": "Daum",
"keyword": "daum.net",
- "favicon_url": "http://search.daum.net/favicon.ico",
- "search_url": "http://search.daum.net/search?ie={inputEncoding}&q={searchTerms}",
- "suggest_url": "http://sug.search.daum.net/search_nsuggest?mod=fxjson&ie={inputEncoding}&code=utf_in_out&q={searchTerms}",
+ "favicon_url": "https://search.daum.net/favicon.ico",
+ "search_url": "https://search.daum.net/search?ie={inputEncoding}&q={searchTerms}",
+ "suggest_url": "https://sug.search.daum.net/search_nsuggest?mod=fxjson&ie={inputEncoding}&code=utf_in_out&q={searchTerms}",
"type": "SEARCH_ENGINE_DAUM",
"id": 68
},
@@ -173,8 +177,8 @@
"onet": {
"name": "Onet.pl",
"keyword": "onet.pl",
- "favicon_url": "http://szukaj.onet.pl/favicon.ico",
- "search_url": "http://szukaj.onet.pl/wyniki.html?qt={searchTerms}",
+ "favicon_url": "https://szukaj.onet.pl/favicon.ico",
+ "search_url": "https://szukaj.onet.pl/wyniki.html?qt={searchTerms}",
"type": "SEARCH_ENGINE_ONET",
"id": 75
},
@@ -665,8 +669,11 @@
"atlas_cz": {
"name": "Atlas.cz",
"keyword": "atlas.cz",
- "favicon_url": "http://searchatlas.centrum.cz/favicon.ico",
- "search_url": "http://searchatlas.centrum.cz/?q={searchTerms}",
+ "favicon_url": "https://searchatlas.centrum.cz/favicon.ico",
+ "search_url": "https://searchatlas.centrum.cz/?q={searchTerms}",
+ "alternate_urls": [
+ "http://searchatlas.centrum.cz/?q={searchTerms}"
+ ],
"suggest_url": "http://radce.centrum.cz/?q={searchTerms}&of=1",
"type": "SEARCH_ENGINE_ATLAS",
"id": 27
@@ -676,7 +683,10 @@
"name": "ATLAS.SK",
"keyword": "atlas.sk",
"favicon_url": "http://static.mediacentrum.sk/katalog/atlas.sk/images/favicon.ico",
- "search_url": "http://hladaj.atlas.sk/fulltext/?phrase={searchTerms}",
+ "search_url": "https://hladaj.atlas.sk/fulltext/?phrase={searchTerms}",
+ "alternate_urls": [
+ "http://hladaj.atlas.sk/fulltext/?phrase={searchTerms}"
+ ],
"id": 27
},
@@ -722,8 +732,11 @@
"delfi_lt": {
"name": "DELFI",
"keyword": "delfi.lt",
- "favicon_url": "http://www.delfi.lt/favicon.ico",
- "search_url": "http://www.delfi.lt/paieska/?q={searchTerms}",
+ "favicon_url": "https://www.delfi.lt/favicon.ico",
+ "search_url": "https://www.delfi.lt/paieska/?q={searchTerms}",
+ "alternate_urls": [
+ "http://www.delfi.lt/paieska/?q={searchTerms}"
+ ],
"type": "SEARCH_ENGINE_DELFI",
"id": 45
},
@@ -1039,8 +1052,11 @@
"zoznam": {
"name": "Zoznam",
"keyword": "zoznam.sk",
- "favicon_url": "http://www.zoznam.sk/favicon.ico",
- "search_url": "http://www.zoznam.sk/hladaj.fcgi?s={searchTerms}",
+ "favicon_url": "https://www.zoznam.sk/favicon.ico",
+ "search_url": "https://www.zoznam.sk/hladaj.fcgi?s={searchTerms}",
+ "alternate_urls": [
+ "http://www.zoznam.sk/hladaj.fcgi?s={searchTerms}"
+ ],
"encoding": "windows-1250",
"type": "SEARCH_ENGINE_ZOZNAM",
"id": 85
diff --git a/chromium/components/search_engines/search_engine_data_type_controller_unittest.cc b/chromium/components/search_engines/search_engine_data_type_controller_unittest.cc
index cfa6c154dd2..e71aa9259a5 100644
--- a/chromium/components/search_engines/search_engine_data_type_controller_unittest.cc
+++ b/chromium/components/search_engines/search_engine_data_type_controller_unittest.cc
@@ -64,7 +64,7 @@ class SyncSearchEngineDataTypeControllerTest : public testing::Test,
search_engine_dtc_.SetGenericChangeProcessorFactoryForTest(
base::WrapUnique<syncer::GenericChangeProcessorFactory>(
new syncer::FakeGenericChangeProcessorFactory(
- base::MakeUnique<syncer::FakeGenericChangeProcessor>(
+ std::make_unique<syncer::FakeGenericChangeProcessor>(
syncer::SEARCH_ENGINES, this))));
EXPECT_CALL(model_load_callback_, Run(_, _));
}
diff --git a/chromium/components/search_engines/search_engines_test_util.cc b/chromium/components/search_engines/search_engines_test_util.cc
index 93a368674c0..4d6239fc60b 100644
--- a/chromium/components/search_engines/search_engines_test_util.cc
+++ b/chromium/components/search_engines/search_engines_test_util.cc
@@ -7,7 +7,6 @@
#include <utility>
#include "base/macros.h"
-#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
#include "components/search_engines/default_search_manager.h"
#include "components/search_engines/template_url.h"
@@ -18,7 +17,7 @@
std::unique_ptr<TemplateURLData> GenerateDummyTemplateURLData(
const std::string& keyword) {
- auto data = base::MakeUnique<TemplateURLData>();
+ auto data = std::make_unique<TemplateURLData>();
data->SetShortName(base::UTF8ToUTF16(keyword + "name"));
data->SetKeyword(base::UTF8ToUTF16(keyword));
data->SetURL(std::string("http://") + keyword + "foo/{searchTerms}");
diff --git a/chromium/components/search_engines/search_host_to_urls_map_unittest.cc b/chromium/components/search_engines/search_host_to_urls_map_unittest.cc
index 18916fe26ec..301a89ba9eb 100644
--- a/chromium/components/search_engines/search_host_to_urls_map_unittest.cc
+++ b/chromium/components/search_engines/search_host_to_urls_map_unittest.cc
@@ -9,7 +9,6 @@
#include <memory>
#include "base/macros.h"
-#include "base/memory/ptr_util.h"
#include "components/search_engines/search_terms_data.h"
#include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_service.h"
@@ -37,9 +36,9 @@ void SearchHostToURLsMapTest::SetUp() {
host_ = "www.unittest.com";
TemplateURLData data;
data.SetURL("http://" + host_ + "/path1");
- template_urls_.push_back(base::MakeUnique<TemplateURL>(data));
+ template_urls_.push_back(std::make_unique<TemplateURL>(data));
data.SetURL("http://" + host_ + "/path2");
- template_urls_.push_back(base::MakeUnique<TemplateURL>(data));
+ template_urls_.push_back(std::make_unique<TemplateURL>(data));
provider_map_.reset(new SearchHostToURLsMap);
provider_map_->Init(template_urls_, SearchTermsData());
diff --git a/chromium/components/search_engines/template_url.cc b/chromium/components/search_engines/template_url.cc
index ffd01e33f37..3cdecf9c9f6 100644
--- a/chromium/components/search_engines/template_url.cc
+++ b/chromium/components/search_engines/template_url.cc
@@ -1155,7 +1155,6 @@ TemplateURL::AssociatedExtensionInfo::~AssociatedExtensionInfo() {
TemplateURL::TemplateURL(const TemplateURLData& data, Type type)
: data_(data),
- url_ref_(nullptr),
suggestions_url_ref_(this, TemplateURLRef::SUGGEST),
image_url_ref_(this, TemplateURLRef::IMAGE),
new_tab_url_ref_(this, TemplateURLRef::NEW_TAB),
@@ -1177,7 +1176,7 @@ TemplateURL::TemplateURL(const TemplateURLData& data,
// Omnibox keywords may not be set as default.
DCHECK(!wants_to_be_default_engine || type != OMNIBOX_API_EXTENSION) << type;
DCHECK_EQ(kInvalidTemplateURLID, data.id);
- extension_info_ = base::MakeUnique<AssociatedExtensionInfo>(
+ extension_info_ = std::make_unique<AssociatedExtensionInfo>(
extension_id, install_time, wants_to_be_default_engine);
}
@@ -1247,7 +1246,7 @@ base::string16 TemplateURL::AdjustedShortNameForLocaleDirection() const {
bool TemplateURL::SupportsReplacement(
const SearchTermsData& search_terms_data) const {
- return url_ref_->SupportsReplacement(search_terms_data);
+ return url_ref().SupportsReplacement(search_terms_data);
}
bool TemplateURL::HasGoogleBaseURLs(
@@ -1264,10 +1263,9 @@ bool TemplateURL::HasGoogleBaseURLs(
bool TemplateURL::IsGoogleSearchURLWithReplaceableKeyword(
const SearchTermsData& search_terms_data) const {
- return (type_ == NORMAL) &&
- url_ref_->HasGoogleBaseURLs(search_terms_data) &&
- google_util::IsGoogleHostname(base::UTF16ToUTF8(data_.keyword()),
- google_util::DISALLOW_SUBDOMAIN);
+ return (type_ == NORMAL) && url_ref().HasGoogleBaseURLs(search_terms_data) &&
+ google_util::IsGoogleHostname(base::UTF16ToUTF8(data_.keyword()),
+ google_util::DISALLOW_SUBDOMAIN);
}
bool TemplateURL::HasSameKeywordAs(
@@ -1386,10 +1384,10 @@ void TemplateURL::EncodeSearchTerms(
GURL TemplateURL::GenerateSearchURL(
const SearchTermsData& search_terms_data) const {
- if (!url_ref_->IsValid(search_terms_data))
+ if (!url_ref().IsValid(search_terms_data))
return GURL();
- if (!url_ref_->SupportsReplacement(search_terms_data))
+ if (!url_ref().SupportsReplacement(search_terms_data))
return GURL(url());
// Use something obscure for the search terms argument so that in the rare
@@ -1397,7 +1395,7 @@ GURL TemplateURL::GenerateSearchURL(
// same url.
// TODO(jnd): Add additional parameters to get post data when the search URL
// has post parameters.
- return GURL(url_ref_->ReplaceSearchTerms(
+ return GURL(url_ref().ReplaceSearchTerms(
TemplateURLRef::SearchTermsArgs(
base::ASCIIToUTF16("blah.blah.blah.blah.blah")),
search_terms_data, nullptr));
@@ -1416,7 +1414,7 @@ void TemplateURL::CopyFrom(const TemplateURL& other) {
void TemplateURL::SetURL(const std::string& url) {
data_.SetURL(url);
engine_type_ = SEARCH_ENGINE_UNKNOWN;
- url_ref_->InvalidateCachedValues();
+ url_ref().InvalidateCachedValues();
}
void TemplateURL::SetPrepopulateId(int id) {
@@ -1455,14 +1453,11 @@ void TemplateURL::ResizeURLRefVector() {
if (url_refs_.size() == new_size)
return;
- // See comment on TemplateURL::ExtractSearchTermsFromURL() for understanding
- // the order of TemplateURLRefs in the |url_refs_| vector.
url_refs_.clear();
url_refs_.reserve(new_size);
for (size_t i = 0; i != data_.alternate_urls.size(); ++i)
url_refs_.emplace_back(this, i);
url_refs_.emplace_back(this, TemplateURLRef::SEARCH);
- url_ref_ = &url_refs_.back();
}
bool TemplateURL::FindSearchTermsInURL(
diff --git a/chromium/components/search_engines/template_url.h b/chromium/components/search_engines/template_url.h
index ace2f6701f5..c6e517191eb 100644
--- a/chromium/components/search_engines/template_url.h
+++ b/chromium/components/search_engines/template_url.h
@@ -578,7 +578,7 @@ class TemplateURL {
const std::string& sync_guid() const { return data_.sync_guid; }
const std::vector<TemplateURLRef>& url_refs() const { return url_refs_; }
- const TemplateURLRef& url_ref() const { return *url_ref_; }
+ const TemplateURLRef& url_ref() const { return url_refs_.back(); }
const TemplateURLRef& suggestions_url_ref() const {
return suggestions_url_ref_;
}
@@ -624,13 +624,8 @@ class TemplateURL {
// Use the alternate URLs and the search URL to match the provided |url|
// and extract |search_terms| from it. Returns false and an empty
- // |search_terms| if no search terms can be matched. The order in which the
- // alternate URLs are listed dictates their priority, the URL at index 0 is
- // treated as the highest priority and the primary search URL is treated as
- // the lowest priority. For example, if a TemplateURL has alternate URL
- // "http://foo/#q={searchTerms}" and search URL "http://foo/?q={searchTerms}",
- // and the URL to be decoded is "http://foo/?q=a#q=b", the alternate URL will
- // match first and the decoded search term will be "b".
+ // |search_terms| if no search terms can be matched. The URLs are matched in
+ // the order listed in |url_refs_| (see comment there).
bool ExtractSearchTermsFromURL(const GURL& url,
const SearchTermsData& search_terms_data,
base::string16* search_terms) const;
@@ -688,7 +683,8 @@ class TemplateURL {
void ResetKeywordIfNecessary(const SearchTermsData& search_terms_data,
bool force);
- // Resizes the |url_refs_| vector and sets |url_ref_| according to |data_|.
+ // Resizes the |url_refs_| vector, which always holds the search URL as the
+ // last item.
void ResizeURLRefVector();
// Uses the alternate URLs and the search URL to match the provided |url|
@@ -704,14 +700,15 @@ class TemplateURL {
TemplateURLData data_;
// Contains TemplateURLRefs corresponding to the alternate URLs and the search
- // URL. This vector must not be resized except by ResizeURLRefVector() to keep
- // the |url_ref_| pointer correct.
+ // URL, in priority order: the URL at index 0 is treated as the highest
+ // priority and the primary search URL is treated as the lowest priority. For
+ // example, if a TemplateURL has alternate URL "http://foo/#q={searchTerms}"
+ // and search URL "http://foo/?q={searchTerms}", and the URL to be decoded is
+ // "http://foo/?q=a#q=b", the alternate URL will match first and the decoded
+ // search term will be "b". Note that since every TemplateURLRef has a
+ // primary search URL, this vector is never empty.
std::vector<TemplateURLRef> url_refs_;
- // Points to the TemplateURLRef in |url_refs_| which corresponds to the search
- // URL.
- TemplateURLRef* url_ref_;
-
TemplateURLRef suggestions_url_ref_;
TemplateURLRef image_url_ref_;
TemplateURLRef new_tab_url_ref_;
diff --git a/chromium/components/search_engines/template_url_data_util.cc b/chromium/components/search_engines/template_url_data_util.cc
index f283cceacaf..91bdafe74f3 100644
--- a/chromium/components/search_engines/template_url_data_util.cc
+++ b/chromium/components/search_engines/template_url_data_util.cc
@@ -6,7 +6,6 @@
#include <string>
-#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
@@ -27,7 +26,7 @@ std::unique_ptr<TemplateURLData> TemplateURLDataFromDictionary(
if (search_url.empty() || keyword.empty() || short_name.empty())
return std::unique_ptr<TemplateURLData>();
- auto result = base::MakeUnique<TemplateURLData>();
+ auto result = std::make_unique<TemplateURLData>();
result->SetKeyword(keyword);
result->SetURL(search_url);
@@ -114,7 +113,7 @@ std::unique_ptr<TemplateURLData> TemplateURLDataFromDictionary(
std::unique_ptr<base::DictionaryValue> TemplateURLDataToDictionary(
const TemplateURLData& data) {
- auto url_dict = base::MakeUnique<base::DictionaryValue>();
+ auto url_dict = std::make_unique<base::DictionaryValue>();
url_dict->SetString(DefaultSearchManager::kID, base::Int64ToString(data.id));
url_dict->SetString(DefaultSearchManager::kShortName, data.short_name());
url_dict->SetString(DefaultSearchManager::kKeyword, data.keyword());
@@ -156,14 +155,14 @@ std::unique_ptr<base::DictionaryValue> TemplateURLDataToDictionary(
base::Int64ToString(data.last_visited.ToInternalValue()));
url_dict->SetInteger(DefaultSearchManager::kUsageCount, data.usage_count);
- auto alternate_urls = base::MakeUnique<base::ListValue>();
+ auto alternate_urls = std::make_unique<base::ListValue>();
for (const auto& alternate_url : data.alternate_urls)
alternate_urls->AppendString(alternate_url);
url_dict->Set(DefaultSearchManager::kAlternateURLs,
std::move(alternate_urls));
- auto encodings = base::MakeUnique<base::ListValue>();
+ auto encodings = std::make_unique<base::ListValue>();
for (const auto& input_encoding : data.input_encodings)
encodings->AppendString(input_encoding);
url_dict->Set(DefaultSearchManager::kInputEncodings, std::move(encodings));
@@ -181,7 +180,7 @@ std::unique_ptr<TemplateURLData> TemplateURLDataFromPrepopulatedEngine(
alternate_urls.AppendString(std::string(engine.alternate_urls[i]));
}
- return base::MakeUnique<TemplateURLData>(
+ return std::make_unique<TemplateURLData>(
base::WideToUTF16(engine.name), base::WideToUTF16(engine.keyword),
engine.search_url, engine.suggest_url, engine.image_url,
engine.new_tab_url, engine.contextual_search_url, engine.logo_url,
@@ -227,7 +226,7 @@ std::unique_ptr<TemplateURLData> TemplateURLDataFromOverrideDictionary(
engine.GetString("suggest_url_post_params", &suggest_url_post_params);
engine.GetString("image_url_post_params", &image_url_post_params);
engine.GetList("alternate_urls", &alternate_urls);
- return base::MakeUnique<TemplateURLData>(
+ return std::make_unique<TemplateURLData>(
name, keyword, search_url, suggest_url, image_url, new_tab_url,
contextual_search_url, logo_url, doodle_url, search_url_post_params,
suggest_url_post_params, image_url_post_params, favicon_url, encoding,
diff --git a/chromium/components/search_engines/template_url_fetcher.cc b/chromium/components/search_engines/template_url_fetcher.cc
index 5c1ce911693..a48af4c97cc 100644
--- a/chromium/components/search_engines/template_url_fetcher.cc
+++ b/chromium/components/search_engines/template_url_fetcher.cc
@@ -5,7 +5,6 @@
#include "components/search_engines/template_url_fetcher.h"
#include "base/macros.h"
-#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
@@ -201,7 +200,7 @@ void TemplateURLFetcher::RequestDelegate::AddSearchProvider() {
// Mark the keyword as replaceable so it can be removed if necessary.
data.safe_for_autoreplace = true;
- model->Add(base::MakeUnique<TemplateURL>(data));
+ model->Add(std::make_unique<TemplateURL>(data));
fetcher_->RequestCompleted(this);
// WARNING: RequestCompleted deletes us.
@@ -246,7 +245,7 @@ void TemplateURLFetcher::ScheduleDownload(
return;
}
- requests_.push_back(base::MakeUnique<RequestDelegate>(
+ requests_.push_back(std::make_unique<RequestDelegate>(
this, keyword, osdd_url, favicon_url, url_fetcher_customize_callback));
}
diff --git a/chromium/components/search_engines/template_url_parser.cc b/chromium/components/search_engines/template_url_parser.cc
index c51fd6c21dc..08c56f8bca1 100644
--- a/chromium/components/search_engines/template_url_parser.cc
+++ b/chromium/components/search_engines/template_url_parser.cc
@@ -13,7 +13,6 @@
#include "base/logging.h"
#include "base/macros.h"
-#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -328,7 +327,7 @@ std::unique_ptr<TemplateURL> TemplateURLParsingContext::GetTemplateURL(
// Bail if the search URL is empty or if either TemplateURLRef is invalid.
std::unique_ptr<TemplateURL> template_url =
- base::MakeUnique<TemplateURL>(data_);
+ std::make_unique<TemplateURL>(data_);
if (template_url->url().empty() ||
!template_url->url_ref().IsValid(search_terms_data) ||
(!template_url->suggestions_url().empty() &&
diff --git a/chromium/components/search_engines/template_url_prepopulate_data.cc b/chromium/components/search_engines/template_url_prepopulate_data.cc
index 6be17eeb06f..0c686f6ebda 100644
--- a/chromium/components/search_engines/template_url_prepopulate_data.cc
+++ b/chromium/components/search_engines/template_url_prepopulate_data.cc
@@ -26,6 +26,7 @@
#include "url/gurl.h"
#if defined(OS_WIN)
+#include <windows.h>
#undef IN // On Windows, windef.h defines this, which screws up "India" cases.
#elif defined(OS_MACOSX)
#include "base/mac/scoped_cftyperef.h"
diff --git a/chromium/components/search_engines/template_url_prepopulate_data_unittest.cc b/chromium/components/search_engines/template_url_prepopulate_data_unittest.cc
index 3690b5bf011..27de40b7892 100644
--- a/chromium/components/search_engines/template_url_prepopulate_data_unittest.cc
+++ b/chromium/components/search_engines/template_url_prepopulate_data_unittest.cc
@@ -12,7 +12,6 @@
#include "base/command_line.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
-#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "components/google/core/browser/google_switches.h"
@@ -123,8 +122,8 @@ TEST_F(TemplateURLPrepopulateDataTest, UniqueIDs) {
// override the built-in ones.
TEST_F(TemplateURLPrepopulateDataTest, ProvidersFromPrefs) {
prefs_.SetUserPref(prefs::kSearchProviderOverridesVersion,
- base::MakeUnique<base::Value>(1));
- auto overrides = base::MakeUnique<base::ListValue>();
+ std::make_unique<base::Value>(1));
+ auto overrides = std::make_unique<base::ListValue>();
std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue);
// Set only the minimal required settings for a search provider configuration.
entry->SetString("name", "foo");
@@ -159,10 +158,10 @@ TEST_F(TemplateURLPrepopulateDataTest, ProvidersFromPrefs) {
// Test the optional settings too.
entry->SetString("suggest_url", "http://foo.com/suggest?q={searchTerms}");
- auto alternate_urls = base::MakeUnique<base::ListValue>();
+ auto alternate_urls = std::make_unique<base::ListValue>();
alternate_urls->AppendString("http://foo.com/alternate?q={searchTerms}");
entry->Set("alternate_urls", std::move(alternate_urls));
- overrides = base::MakeUnique<base::ListValue>();
+ overrides = std::make_unique<base::ListValue>();
overrides->Append(entry->CreateDeepCopy());
prefs_.SetUserPref(prefs::kSearchProviderOverrides, std::move(overrides));
@@ -183,7 +182,7 @@ TEST_F(TemplateURLPrepopulateDataTest, ProvidersFromPrefs) {
// Test that subsequent providers are loaded even if an intermediate
// provider has an incomplete configuration.
- overrides = base::MakeUnique<base::ListValue>();
+ overrides = std::make_unique<base::ListValue>();
overrides->Append(entry->CreateDeepCopy());
entry->SetInteger("id", 1002);
entry->SetString("name", "bar");
@@ -205,8 +204,8 @@ TEST_F(TemplateURLPrepopulateDataTest, ProvidersFromPrefs) {
TEST_F(TemplateURLPrepopulateDataTest, ClearProvidersFromPrefs) {
prefs_.SetUserPref(prefs::kSearchProviderOverridesVersion,
- base::MakeUnique<base::Value>(1));
- auto overrides = base::MakeUnique<base::ListValue>();
+ std::make_unique<base::Value>(1));
+ auto overrides = std::make_unique<base::ListValue>();
std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue);
// Set only the minimal required settings for a search provider configuration.
entry->SetString("name", "foo");
diff --git a/chromium/components/search_engines/template_url_service.cc b/chromium/components/search_engines/template_url_service.cc
index fd94cadbe8e..c85d04dad47 100644
--- a/chromium/components/search_engines/template_url_service.cc
+++ b/chromium/components/search_engines/template_url_service.cc
@@ -14,7 +14,6 @@
#include "base/debug/crash_logging.h"
#include "base/format_macros.h"
#include "base/guid.h"
-#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
@@ -509,7 +508,7 @@ void TemplateURLService::RegisterOmniboxKeyword(
data.SetShortName(base::UTF8ToUTF16(extension_name));
data.SetKeyword(base::UTF8ToUTF16(keyword));
data.SetURL(template_url_string);
- Add(base::MakeUnique<TemplateURL>(data, TemplateURL::OMNIBOX_API_EXTENSION,
+ Add(std::make_unique<TemplateURL>(data, TemplateURL::OMNIBOX_API_EXTENSION,
extension_id, extension_install_time,
false));
}
@@ -630,7 +629,7 @@ void TemplateURLService::RepairPrepopulatedSearchEngines() {
actions.added_engines.begin();
i < actions.added_engines.end();
++i) {
- AddNoNotify(base::MakeUnique<TemplateURL>(*i), true);
+ AddNoNotify(std::make_unique<TemplateURL>(*i), true);
}
base::AutoReset<DefaultSearchChangeOrigin> change_origin(
@@ -713,7 +712,7 @@ void TemplateURLService::OnWebDataServiceRequestDone(
}
std::unique_ptr<OwnedTemplateURLVector> template_urls =
- base::MakeUnique<OwnedTemplateURLVector>();
+ std::make_unique<OwnedTemplateURLVector>();
int new_resource_keyword_version = 0;
{
GetSearchProvidersUsingKeywordResult(
@@ -921,7 +920,7 @@ syncer::SyncError TemplateURLService::ProcessSyncChanges(
TemplateURLData data(turl->data());
data.id = kInvalidTemplateURLID;
std::unique_ptr<TemplateURL> added_ptr =
- base::MakeUnique<TemplateURL>(data);
+ std::make_unique<TemplateURL>(data);
TemplateURL* added = added_ptr.get();
if (AddNoNotify(std::move(added_ptr), true)) {
should_notify = true;
@@ -1328,7 +1327,7 @@ void TemplateURLService::Init(const Initializer* initializers,
data.SetShortName(base::UTF8ToUTF16(initializers[i].content));
data.SetKeyword(base::UTF8ToUTF16(initializers[i].keyword));
data.SetURL(initializers[i].url);
- AddNoNotify(base::MakeUnique<TemplateURL>(data), true);
+ AddNoNotify(std::make_unique<TemplateURL>(data), true);
// Set the first provided identifier to be the default.
if (i == 0)
@@ -1810,7 +1809,7 @@ bool TemplateURLService::ApplyDefaultSearchChangeNoMetrics(
? TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION
: TemplateURL::NORMAL;
initial_default_search_provider_ =
- data ? base::MakeUnique<TemplateURL>(*data, initial_engine_type)
+ data ? std::make_unique<TemplateURL>(*data, initial_engine_type)
: nullptr;
default_search_provider_source_ = source;
return changed;
@@ -1868,7 +1867,7 @@ bool TemplateURLService::ApplyDefaultSearchChangeNoMetrics(
// (2) If the user deleted the pre-populated default and we subsequently
// lost their user-selected value.
default_search_provider_ =
- AddNoNotify(base::MakeUnique<TemplateURL>(*data), true);
+ AddNoNotify(std::make_unique<TemplateURL>(*data), true);
}
} else if (source == DefaultSearchManager::FROM_USER) {
default_search_provider_ = GetTemplateURLForGUID(data->sync_guid);
@@ -1882,7 +1881,7 @@ bool TemplateURLService::ApplyDefaultSearchChangeNoMetrics(
} else {
new_data.id = kInvalidTemplateURLID;
default_search_provider_ =
- AddNoNotify(base::MakeUnique<TemplateURL>(new_data), true);
+ AddNoNotify(std::make_unique<TemplateURL>(new_data), true);
}
if (default_search_provider_ && prefs_) {
prefs_->SetString(prefs::kSyncedDefaultSearchProviderGUID,
@@ -2064,7 +2063,7 @@ void TemplateURLService::UpdateProvidersCreatedByPolicy(
new_data.sync_guid = base::GenerateGUID();
new_data.created_by_policy = true;
std::unique_ptr<TemplateURL> new_dse_ptr =
- base::MakeUnique<TemplateURL>(new_data);
+ std::make_unique<TemplateURL>(new_data);
TemplateURL* new_dse = new_dse_ptr.get();
if (AddNoNotify(std::move(new_dse_ptr), true))
default_search_provider_ = new_dse;
@@ -2269,7 +2268,7 @@ bool TemplateURLService::MergeInSyncTemplateURL(
TemplateURLData data(sync_turl->data());
data.id = kInvalidTemplateURLID;
std::unique_ptr<TemplateURL> added_ptr =
- base::MakeUnique<TemplateURL>(data);
+ std::make_unique<TemplateURL>(data);
TemplateURL* added = added_ptr.get();
base::AutoReset<DefaultSearchChangeOrigin> change_origin(
&dsp_change_origin_, DSP_CHANGE_SYNC_ADD);
diff --git a/chromium/components/search_engines/template_url_service_util_unittest.cc b/chromium/components/search_engines/template_url_service_util_unittest.cc
index 4321d560251..527d8d57dfe 100644
--- a/chromium/components/search_engines/template_url_service_util_unittest.cc
+++ b/chromium/components/search_engines/template_url_service_util_unittest.cc
@@ -4,7 +4,8 @@
#include <stddef.h>
-#include "base/memory/ptr_util.h"
+#include <memory>
+
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "components/search_engines/search_terms_data.h"
@@ -33,7 +34,7 @@ std::unique_ptr<TemplateURL> CreatePrepopulateTemplateURL(
int prepopulate_id,
const std::string& keyword,
TemplateURLID id) {
- return base::MakeUnique<TemplateURL>(
+ return std::make_unique<TemplateURL>(
*CreatePrepopulateTemplateURLData(prepopulate_id, keyword, id));
}
diff --git a/chromium/components/search_engines/util.cc b/chromium/components/search_engines/util.cc
index 60ab5713b0e..35b976aa48b 100644
--- a/chromium/components/search_engines/util.cc
+++ b/chromium/components/search_engines/util.cc
@@ -14,7 +14,6 @@
#include <vector>
#include "base/logging.h"
-#include "base/memory/ptr_util.h"
#include "base/time/time.h"
#include "components/prefs/pref_service.h"
#include "components/search_engines/template_url.h"
@@ -219,12 +218,12 @@ void MergeEnginesFromPrepopulateData(
// Replace the entry in |template_urls| with the updated one.
auto j = FindTemplateURL(template_urls, edited_engine.first);
- *j = base::MakeUnique<TemplateURL>(data);
+ *j = std::make_unique<TemplateURL>(data);
}
// Add items.
for (const auto& added_engine : actions.added_engines)
- template_urls->push_back(base::MakeUnique<TemplateURL>(added_engine));
+ template_urls->push_back(std::make_unique<TemplateURL>(added_engine));
}
ActionsFromPrepopulateData CreateActionsFromCurrentPrepopulateData(
@@ -315,7 +314,7 @@ void GetSearchProvidersUsingKeywordResult(
// search engine sync, since in that case that code will never be reached.
if (DeDupeEncodings(&keyword.input_encodings) && service)
service->UpdateKeyword(keyword);
- template_urls->push_back(base::MakeUnique<TemplateURL>(keyword));
+ template_urls->push_back(std::make_unique<TemplateURL>(keyword));
}
*new_resource_keyword_version = keyword_result.builtin_keyword_version;