diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-16 20:53:27 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-16 20:53:27 +0000 |
commit | b37bdfe502acc486794643fb856fb715ffd2b22a (patch) | |
tree | f7753a9a42c2f1c359f4b871e47a281ea28afee8 /chrome/browser/importer | |
parent | e4a14ec6e8f8faa460808b783bf691f19d760ca7 (diff) | |
download | chromium_src-b37bdfe502acc486794643fb856fb715ffd2b22a.zip chromium_src-b37bdfe502acc486794643fb856fb715ffd2b22a.tar.gz chromium_src-b37bdfe502acc486794643fb856fb715ffd2b22a.tar.bz2 |
Clean up chrome/browser/search_engines/:
* Remove the notion of SearchEngineType from TemplateURL. It's now solely the domain of the prepopulate data.
* Simplify TemplateURL IPC code.
* Remove TemplateURLRef::SetGoogleBaseURL(), which was an unnecessary passthrough to another public static function.
* Use "google.*"-like strings consistently for Google base URLs in tests; this will become important later when keyword autogeneration changes to depend on the host being a Google URL.
* Define base SearchTermsData::GetApplicationLocale() and GetRlzParameterValue() implementations and remove various similar definitions elsewhere.
* De-inline functions we don't normally inline (constructors, virtuals, etc.).
* Remove some unnecessary TemplateURLRef friend declarations.
* Remove TemplateURL::set_prepopulated() and add_image_ref() manipulators as all callers were already friends or are now. (First of a number of changes that move toward making TemplateURL more immutable so we can then remove "const" from the TemplateURLService APIs.)
* Make TemplateURLRef non-copyable. This required defining explicit copy/assignment operators for TemplateURL.
* Rename template_url_parser.cc:ParsingContext to TemplateURLParsingContext so it can be moved out of the anonymous namespace (necessary to make it a friend elsewhere).
* In template_url_service_sync_unittest.cc, add more CreateTestTemplateURL() overrides so that most creation and manipulation of TemplateURLs now happens in one function. Also rework some functions to create new TemplateURLs instead of modifying existing ones. This will make later refactoring much simpler.
* Fix silly pattern: "GURL x = GURL(...);" -> "GURL x(...);".
* Convert some ASSERTs to EXPECTs and vice-versa to try and match what conditions should really halt a test and what shouldn't.
* Remove other unnecessary passthrough functions, shorten code, rewrap, etc.
* Various other minor changes to reduce future diffs of TemplateURL refactoring patches.
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/9706087
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127226 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/importer')
-rw-r--r-- | chrome/browser/importer/profile_import_process_messages.h | 58 |
1 files changed, 11 insertions, 47 deletions
diff --git a/chrome/browser/importer/profile_import_process_messages.h b/chrome/browser/importer/profile_import_process_messages.h index 293bafe..442cc01 100644 --- a/chrome/browser/importer/profile_import_process_messages.h +++ b/chrome/browser/importer/profile_import_process_messages.h @@ -199,15 +199,9 @@ struct ParamTraits<TemplateURLRef> { WriteParam(m, p.page_offset()); } static bool Read(const Message* m, PickleIterator* iter, param_type* p) { - std::string url; - int index_offset; - int page_offset; - if (!ReadParam(m, iter, &url) || - !ReadParam(m, iter, &index_offset) || - !ReadParam(m, iter, &page_offset)) - return false; - *p = TemplateURLRef(url, index_offset, page_offset); - return true; + return ReadParam(m, iter, &p->url_) && + ReadParam(m, iter, &p->index_offset_) && + ReadParam(m, iter, &p->page_offset_); } static void Log(const param_type& p, std::string* l) { l->append("<TemplateURLRef>"); @@ -225,17 +219,10 @@ struct ParamTraits<TemplateURL::ImageRef> { WriteParam(m, p.url); } static bool Read(const Message* m, PickleIterator* iter, param_type* p) { - std::string type; - int width; - int height; - GURL url; - if (!ReadParam(m, iter, &type) || - !ReadParam(m, iter, &width) || - !ReadParam(m, iter, &height) || - !ReadParam(m, iter, &url)) - return false; - *p = TemplateURL::ImageRef(type, width, height, url); // here in - return true; + return ReadParam(m, iter, &p->type) && + ReadParam(m, iter, &p->width) && + ReadParam(m, iter, &p->height) && + ReadParam(m, iter, &p->url); } static void Log(const param_type& p, std::string* l) { l->append("<TemplateURL::ImageRef>"); @@ -261,16 +248,7 @@ struct ParamTraits<TemplateURL> { WriteParam(m, p.autogenerate_keyword()); WriteParam(m, p.show_in_default_list()); WriteParam(m, p.safe_for_autoreplace()); - WriteParam(m, p.image_refs().size()); - - std::vector<TemplateURL::ImageRef>::const_iterator iter; - for (iter = p.image_refs().begin(); iter != p.image_refs().end(); ++iter) { - WriteParam(m, iter->type); - WriteParam(m, iter->width); - WriteParam(m, iter->height); - WriteParam(m, iter->url); - } - + WriteParam(m, p.image_refs()); WriteParam(m, p.languages()); WriteParam(m, p.input_encodings()); WriteParam(m, p.date_created()); @@ -307,31 +285,17 @@ struct ParamTraits<TemplateURL> { return false; } - size_t image_refs_size = 0; if (!ReadParam(m, iter, &url) || !ReadParam(m, iter, &originating_url) || !ReadParam(m, iter, &keyword) || !ReadParam(m, iter, &autogenerate_keyword) || !ReadParam(m, iter, &show_in_default_list) || - !ReadParam(m, iter, &safe_for_autoreplace) || - !ReadParam(m, iter, &image_refs_size)) + !ReadParam(m, iter, &safe_for_autoreplace)) return false; *p = TemplateURL(); - for (size_t i = 0; i < image_refs_size; ++i) { - std::string type; - int width; - int height; - GURL url; - if (!ReadParam(m, iter, &type) || - !ReadParam(m, iter, &width) || - !ReadParam(m, iter, &height) || - !ReadParam(m, iter, &url)) - return false; - p->add_image_ref(TemplateURL::ImageRef(type, width, height, url)); - } - - if (!ReadParam(m, iter, &languages) || + if (!ReadParam(m, iter, &p->image_refs_) || + !ReadParam(m, iter, &languages) || !ReadParam(m, iter, &input_encodings) || !ReadParam(m, iter, &date_created) || !ReadParam(m, iter, &last_modified) || |