Chromium Code Reviews| Index: chrome/browser/first_run/first_run.cc |
| diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc |
| index 1dfad253e5dc08b502b683a2cf7c3ef027896c4c..48ebc72f6e418802857cbce5917266697dd2bf7a 100644 |
| --- a/chrome/browser/first_run/first_run.cc |
| +++ b/chrome/browser/first_run/first_run.cc |
| @@ -105,7 +105,6 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, |
| if (!PathService::Get(base::DIR_EXE, &master_prefs)) |
| return true; |
| master_prefs = master_prefs.AppendASCII(installer::kDefaultMasterPrefs); |
| - |
| installer::MasterPreferences prefs(master_prefs); |
| if (!prefs.read_from_file()) |
| return true; |
| @@ -551,6 +550,52 @@ void FirstRun::AutoImport( |
| if (import_items & importer::FAVORITES) |
| items = items | importer::FAVORITES; |
| + // Write import preferences to user profile if they are managed by policy |
| + // in order to get the combination of master_preferences and policy, then |
| + // read preferences back out to adjust the items to be imported to reflect |
| + // policy. |
| + PrefService* user_prefs = profile->GetPrefs(); |
| + |
| + if (user_prefs->FindPreference(prefs::kImportBookmarks)->IsManaged()) { |
| + user_prefs->SetBoolean(prefs::kImportBookmarks, |
| + (items & importer::FAVORITES) != 0); |
|
Mattias Nissler (ping if slow)
2011/07/20 09:28:31
align with previous line, also below
|
| + |
| + if (user_prefs->GetBoolean(prefs::kImportBookmarks)) |
| + items = items | importer::FAVORITES; |
| + else |
| + items = items & (~importer::FAVORITES); |
| + } |
| + |
| + if (user_prefs->FindPreference(prefs::kImportHistory)->IsManaged()) { |
| + user_prefs->SetBoolean(prefs::kImportHistory, |
| + (items & importer::HISTORY) != 0); |
| + |
| + if (user_prefs->GetBoolean(prefs::kImportHistory)) |
| + items = items | importer::HISTORY; |
| + else |
| + items = items & (~importer::HISTORY); |
| + } |
| + |
| + if (user_prefs->FindPreference(prefs::kImportHomepage)->IsManaged()) { |
| + user_prefs->SetBoolean(prefs::kImportHomepage, |
| + (items & importer::HOME_PAGE) != 0); |
| + |
| + if (user_prefs->GetBoolean(prefs::kImportHomepage)) |
| + items = items | importer::HOME_PAGE; |
| + else |
| + items = items & (~importer::HOME_PAGE); |
| + } |
| + |
| + if (user_prefs->FindPreference(prefs::kImportSearchEngine)->IsManaged()) { |
| + user_prefs->SetBoolean(prefs::kImportSearchEngine, |
| + (items & importer::SEARCH_ENGINES) != 0); |
| + |
| + if (user_prefs->GetBoolean(prefs::kImportSearchEngine)) |
| + items = items | importer::SEARCH_ENGINES; |
| + else |
| + items = items & (~importer::SEARCH_ENGINES); |
| + } |
| + |
| ImportSettings(profile, importer_host, importer_list, items); |
| } |