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

Unified Diff: components/search_engines/template_url.cc

Issue 2814743006: Refactoring after comments in https://codereview.chromium.org/2639153002 (Closed)
Patch Set: Created 3 years, 8 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
Index: components/search_engines/template_url.cc
diff --git a/components/search_engines/template_url.cc b/components/search_engines/template_url.cc
index da62aaa3c13bf3af09da2e8888ad0289aa3402da..beee993ef1417d31c493f55e93c5830f12004f30 100644
--- a/components/search_engines/template_url.cc
+++ b/components/search_engines/template_url.cc
@@ -1138,8 +1138,12 @@ std::string TemplateURLRef::HandleReplacements(
// TemplateURL ----------------------------------------------------------------
TemplateURL::AssociatedExtensionInfo::AssociatedExtensionInfo(
- const std::string& extension_id)
- : extension_id(extension_id), wants_to_be_default_engine(false) {}
+ const std::string& extension_id,
+ base::Time install_time,
+ bool wants_to_be_default_engine)
+ : extension_id(extension_id),
+ install_time(install_time),
+ wants_to_be_default_engine(wants_to_be_default_engine) {}
TemplateURL::AssociatedExtensionInfo::~AssociatedExtensionInfo() {
}
@@ -1162,6 +1166,21 @@ TemplateURL::TemplateURL(const TemplateURLData& data, Type type)
data_.search_terms_replacement_key = google_util::kInstantExtendedAPIParam;
}
+TemplateURL::TemplateURL(const TemplateURLData& data,
+ Type type,
+ std::string extension_id,
+ base::Time install_time,
+ bool wants_to_be_default_engine)
+ : TemplateURL(data, type) {
+ DCHECK(type == NORMAL_CONTROLLED_BY_EXTENSION ||
+ type == OMNIBOX_API_EXTENSION);
+ // Default engines are not allowed for omnibox keywords.
Peter Kasting 2017/04/13 00:11:01 Nit: "Omnibox keywords may not be set as default"?
Alexander Yashkin 2017/04/13 06:07:50 Thanks, fixed.
+ DCHECK(!(wants_to_be_default_engine && type == OMNIBOX_API_EXTENSION));
Peter Kasting 2017/04/13 00:11:01 Nit: Distribute ! through and eliminate parens
Alexander Yashkin 2017/04/13 06:07:50 Done
+ DCHECK_EQ(kInvalidTemplateURLID, data.id);
+ extension_info_ = base::MakeUnique<AssociatedExtensionInfo>(
+ extension_id, install_time, wants_to_be_default_engine);
+}
+
TemplateURL::~TemplateURL() {
}

Powered by Google App Engine
This is Rietveld 408576698