| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/search_engines/default_search_pref_migration.h" | 5 #include "components/search_engines/default_search_pref_migration.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 instant_url = t_url->instant_url(); | 84 instant_url = t_url->instant_url(); |
| 85 image_url = t_url->image_url(); | 85 image_url = t_url->image_url(); |
| 86 new_tab_url = t_url->new_tab_url(); | 86 new_tab_url = t_url->new_tab_url(); |
| 87 search_url_post_params = t_url->search_url_post_params(); | 87 search_url_post_params = t_url->search_url_post_params(); |
| 88 suggest_url_post_params = t_url->suggestions_url_post_params(); | 88 suggest_url_post_params = t_url->suggestions_url_post_params(); |
| 89 instant_url_post_params = t_url->instant_url_post_params(); | 89 instant_url_post_params = t_url->instant_url_post_params(); |
| 90 image_url_post_params = t_url->image_url_post_params(); | 90 image_url_post_params = t_url->image_url_post_params(); |
| 91 GURL icon_gurl = t_url->favicon_url(); | 91 GURL icon_gurl = t_url->favicon_url(); |
| 92 if (!icon_gurl.is_empty()) | 92 if (!icon_gurl.is_empty()) |
| 93 icon_url = icon_gurl.spec(); | 93 icon_url = icon_gurl.spec(); |
| 94 encodings = JoinString(t_url->input_encodings(), ';'); | 94 encodings = base::JoinString(t_url->input_encodings(), ";"); |
| 95 short_name = base::UTF16ToUTF8(t_url->short_name()); | 95 short_name = base::UTF16ToUTF8(t_url->short_name()); |
| 96 keyword = base::UTF16ToUTF8(t_url->keyword()); | 96 keyword = base::UTF16ToUTF8(t_url->keyword()); |
| 97 id_string = base::Int64ToString(t_url->id()); | 97 id_string = base::Int64ToString(t_url->id()); |
| 98 prepopulate_id = base::Int64ToString(t_url->prepopulate_id()); | 98 prepopulate_id = base::Int64ToString(t_url->prepopulate_id()); |
| 99 for (size_t i = 0; i < t_url->alternate_urls().size(); ++i) | 99 for (size_t i = 0; i < t_url->alternate_urls().size(); ++i) |
| 100 alternate_urls.AppendString(t_url->alternate_urls()[i]); | 100 alternate_urls.AppendString(t_url->alternate_urls()[i]); |
| 101 search_terms_replacement_key = t_url->search_terms_replacement_key(); | 101 search_terms_replacement_key = t_url->search_terms_replacement_key(); |
| 102 } | 102 } |
| 103 prefs->SetBoolean(prefs::kDefaultSearchProviderEnabled, enabled); | 103 prefs->SetBoolean(prefs::kDefaultSearchProviderEnabled, enabled); |
| 104 prefs->SetString(prefs::kDefaultSearchProviderSearchURL, search_url); | 104 prefs->SetString(prefs::kDefaultSearchProviderSearchURL, search_url); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // Store a value in the legacy location. | 223 // Store a value in the legacy location. |
| 224 SaveDefaultSearchProviderToLegacyPrefs(&prepopulated_turl); | 224 SaveDefaultSearchProviderToLegacyPrefs(&prepopulated_turl); |
| 225 | 225 |
| 226 // Run the migration. | 226 // Run the migration. |
| 227 ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service()); | 227 ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service()); |
| 228 | 228 |
| 229 // Test that the legacy value is not migrated, as it is not user-selected. | 229 // Test that the legacy value is not migrated, as it is not user-selected. |
| 230 default_search_manager()->GetDefaultSearchEngine(&source); | 230 default_search_manager()->GetDefaultSearchEngine(&source); |
| 231 EXPECT_EQ(DefaultSearchManager::FROM_FALLBACK, source); | 231 EXPECT_EQ(DefaultSearchManager::FROM_FALLBACK, source); |
| 232 } | 232 } |
| OLD | NEW |