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

Unified Diff: chrome/browser/search_engines/template_url.h

Issue 7230053: Modify TemplateURLRef to remove unknown URL parameters, but only when it represents a prepopulate... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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: chrome/browser/search_engines/template_url.h
===================================================================
--- chrome/browser/search_engines/template_url.h (revision 90805)
+++ chrome/browser/search_engines/template_url.h (working copy)
@@ -135,14 +135,17 @@
// Collects metrics whether searches through Google are sent with RLZ string.
void CollectRLZMetrics() const;
+ // Sets whether this URL is pre-populated or not.
+ void set_prepopulated(bool prepopulated) { prepopulated_ = prepopulated; }
+
private:
friend class SearchHostToURLsMapTest;
friend class TemplateURL;
friend class TemplateURLServiceTestUtil;
friend class TemplateURLTest;
+ FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, SetPrepopulatedAndParse);
FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseParameterKnown);
FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseParameterUnknown);
- FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseParameterReallyUnknown);
FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLEmpty);
FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLNoTemplateEnd);
FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLNoKnownParameters);
@@ -187,8 +190,8 @@
// replacements indicating the type and range of the element. The original
// parameter is erased from the url.
//
- // If the parameter is not a known parameter, it's not erased and false is
- // returned.
+ // If the parameter is not a known parameter, false is returned. If this is a
+ // prepopulated URL, the parameter is erased, otherwise it is left alone.
bool ParseParameter(size_t start,
size_t end,
std::string* url,
@@ -252,6 +255,9 @@
mutable std::string host_;
mutable std::string path_;
mutable std::string search_term_key_;
+
+ // Whether the contained URL is a pre-populated URL.
+ bool prepopulated_;
};
// Describes the relevant portions of a single OSD document.
@@ -474,7 +480,9 @@
TemplateURLID id() const { return id_; }
// If this TemplateURL comes from prepopulated data the prepopulate_id is > 0.
- void set_prepopulate_id(int id) { prepopulate_id_ = id; }
+ // SetPrepopulateId also sets any TemplateURLRef's prepopulated flag to true
+ // if |id| > 0 and false otherwise.
+ void SetPrepopulateId(int id);
int prepopulate_id() const { return prepopulate_id_; }
std::string GetExtensionId() const;
@@ -494,6 +502,9 @@
// Invalidates cached values on this object and its child TemplateURLRefs.
void InvalidateCachedValues() const;
+ // Sets all TemplateURLRefs prepopulated flags.
+ void SetTemplateURLRefsPrepopulated(bool prepopulated);
+
// Unique identifier, used when archived to the database.
void set_id(TemplateURLID id) { id_ = id; }

Powered by Google App Engine
This is Rietveld 408576698