Refactor lots of stuff to use TemplateURLData instead of TemplateURL.

Only attach a Profile when it's needed.

This will allow methods for accessing the prepopulated search engines to be used before the Profile is available (i.e., as we are loading prefs). Which is required to determine if the current DSE in Prefs is user-selected or came from pre-populated.

BUG=365762
[email protected], [email protected]

Review URL: https://codereview.chromium.org/253573004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267262 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/search_engines/util.h b/chrome/browser/search_engines/util.h
index 4e484101..2b43ce01 100644
--- a/chrome/browser/search_engines/util.h
+++ b/chrome/browser/search_engines/util.h
@@ -35,8 +35,8 @@
 
 // Modifies |prepopulated_url| so that it contains user-modified fields from
 // |original_turl|. Both URLs must have the same prepopulate_id.
-void MergeIntoPrepopulatedEngineData(TemplateURLData* prepopulated_url,
-                                     const TemplateURL* original_turl);
+void MergeIntoPrepopulatedEngineData(const TemplateURL* original_turl,
+                                     TemplateURLData* prepopulated_url);
 
 // CreateActionsFromCurrentPrepopulateData() (see below) takes in the current
 // prepopulated URLs as well as the user's current URLs, and returns an instance
@@ -63,7 +63,7 @@
 
   TemplateURLService::TemplateURLVector removed_engines;
   EditedEngines edited_engines;
-  TemplateURLService::TemplateURLVector added_engines;
+  std::vector<TemplateURLData> added_engines;
 };
 
 // Given the user's current URLs and the current set of prepopulated URLs,
@@ -73,7 +73,7 @@
 //
 // NOTE: Takes ownership of, and clears, |prepopulated_urls|.
 ActionsFromPrepopulateData CreateActionsFromCurrentPrepopulateData(
-    ScopedVector<TemplateURL>* prepopulated_urls,
+    ScopedVector<TemplateURLData>* prepopulated_urls,
     const TemplateURLService::TemplateURLVector& existing_urls,
     const TemplateURL* default_search_provider);
 
@@ -126,7 +126,7 @@
 // so it's accessible by unittests.
 void RemoveDuplicatePrepopulateIDs(
     WebDataService* service,
-    const ScopedVector<TemplateURL>& prepopulated_urls,
+    const ScopedVector<TemplateURLData>& prepopulated_urls,
     TemplateURL* default_search_provider,
     TemplateURLService::TemplateURLVector* template_urls,
     std::set<std::string>* removed_keyword_guids);