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

Unified Diff: components/search_engines/template_url.h

Issue 2347973002: Enable Chrome to tweak search engines for some locales (Closed)
Patch Set: compile Created 4 years, 3 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.h
diff --git a/components/search_engines/template_url.h b/components/search_engines/template_url.h
index 04a66bc6551416b5308caf4a0ef8223a80df00f0..e3bd613991be63dab0b4ad99c7d2d8eed4e6907f 100644
--- a/components/search_engines/template_url.h
+++ b/components/search_engines/template_url.h
@@ -498,16 +498,16 @@ class TemplateURL {
NORMAL_CONTROLLED_BY_EXTENSION,
// The keyword associated with an extension that uses the Omnibox API.
OMNIBOX_API_EXTENSION,
+ // Installed only on this device. Should not be synced.
+ LOCAL,
};
// An AssociatedExtensionInfo represents information about the extension that
// added the search engine.
struct AssociatedExtensionInfo {
- AssociatedExtensionInfo(Type type, const std::string& extension_id);
+ explicit AssociatedExtensionInfo(const std::string& extension_id);
~AssociatedExtensionInfo();
- Type type;
-
std::string extension_id;
// Whether the search engine is supposed to be default.
@@ -518,7 +518,7 @@ class TemplateURL {
base::Time install_time;
};
- explicit TemplateURL(const TemplateURLData& data);
+ explicit TemplateURL(const TemplateURLData& data, Type type = NORMAL);
~TemplateURL();
// Generates a suitable keyword for the specified url, which must be valid.
@@ -612,6 +612,11 @@ class TemplateURL {
return contextual_search_url_ref_;
}
+ Type type() const { return type_; }
+ // TODO(ianwen): remove set_type() once RestoreExtensionInfoIfNecessary() no
+ // longer needs it.
+ void set_type(Type type) { type_ = type; }
+
// This setter shouldn't be used except by TemplateURLService and
// TemplateURLServiceClient implementations.
void set_extension_info(
@@ -637,8 +642,6 @@ class TemplateURL {
bool HasSameKeywordAs(const TemplateURLData& other,
const SearchTermsData& search_terms_data) const;
- Type GetType() const;
-
// Returns the id of the extension that added this search engine. Only call
// this for TemplateURLs of type NORMAL_CONTROLLED_BY_EXTENSION or
// OMNIBOX_API_EXTENSION.
@@ -754,6 +757,8 @@ class TemplateURL {
TemplateURLRef contextual_search_url_ref_;
std::unique_ptr<AssociatedExtensionInfo> extension_info_;
+ Type type_;
+
// Caches the computed engine type across successive calls to GetEngineType().
mutable SearchEngineType engine_type_;

Powered by Google App Engine
This is Rietveld 408576698