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

Unified Diff: components/search_engines/template_url.cc

Issue 2814743006: Refactoring after comments in https://codereview.chromium.org/2639153002 (Closed)
Patch Set: Fixed after review, round 2 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
« no previous file with comments | « components/search_engines/template_url.h ('k') | components/search_engines/template_url_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2e1fd31b026d413446b2989062af3f39f71d4f55 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);
+ // 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_id, install_time, wants_to_be_default_engine);
+}
+
TemplateURL::~TemplateURL() {
}
« no previous file with comments | « components/search_engines/template_url.h ('k') | components/search_engines/template_url_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698