| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 5 |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/common/json_value_serializer.h" | 8 #include "chrome/common/json_value_serializer.h" |
| 9 #include "chrome/installer/util/master_preferences.h" | 9 #include "chrome/installer/util/master_preferences.h" |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // Register Chrome as default browser on the system. | 62 // Register Chrome as default browser on the system. |
| 63 const wchar_t kMakeChromeDefault[] = L"make_chrome_default"; | 63 const wchar_t kMakeChromeDefault[] = L"make_chrome_default"; |
| 64 // Install Chrome to system wise location. | 64 // Install Chrome to system wise location. |
| 65 const wchar_t kSystemLevel[] = L"system_level"; | 65 const wchar_t kSystemLevel[] = L"system_level"; |
| 66 // Run installer in verbose mode. | 66 // Run installer in verbose mode. |
| 67 const wchar_t kVerboseLogging[] = L"verbose_logging"; | 67 const wchar_t kVerboseLogging[] = L"verbose_logging"; |
| 68 // Show EULA dialog and install only if accepted. | 68 // Show EULA dialog and install only if accepted. |
| 69 const wchar_t kRequireEula[] = L"require_eula"; | 69 const wchar_t kRequireEula[] = L"require_eula"; |
| 70 // Use alternate shortcut text for the main shortcut. | 70 // Use alternate shortcut text for the main shortcut. |
| 71 const wchar_t kAltShortcutText[] = L"alternate_shortcut_text"; | 71 const wchar_t kAltShortcutText[] = L"alternate_shortcut_text"; |
| 72 | 72 // Boolean pref that triggers silent import of the default browser homepage. |
| 73 const wchar_t kDistroImportHomePagePref[] = L"import_home_page"; |
| 73 | 74 |
| 74 int ParseDistributionPreferences(const std::wstring& master_prefs_path) { | 75 int ParseDistributionPreferences(const std::wstring& master_prefs_path) { |
| 75 if (!file_util::PathExists(master_prefs_path)) | 76 if (!file_util::PathExists(master_prefs_path)) |
| 76 return MASTER_PROFILE_NOT_FOUND; | 77 return MASTER_PROFILE_NOT_FOUND; |
| 77 LOG(INFO) << "master profile found"; | 78 LOG(INFO) << "master profile found"; |
| 78 | 79 |
| 79 scoped_ptr<DictionaryValue> json_root(GetPrefsFromFile(master_prefs_path)); | 80 scoped_ptr<DictionaryValue> json_root(GetPrefsFromFile(master_prefs_path)); |
| 80 if (!json_root.get()) | 81 if (!json_root.get()) |
| 81 return MASTER_PROFILE_ERROR; | 82 return MASTER_PROFILE_ERROR; |
| 82 | 83 |
| 83 int parse_result = 0; | 84 int parse_result = 0; |
| 84 DictionaryValue* distro = NULL; | 85 DictionaryValue* distro = NULL; |
| 85 if (json_root->GetDictionary(L"distribution", &distro)) { | 86 if (json_root->GetDictionary(L"distribution", &distro)) { |
| 86 if (GetBooleanPref(distro, kDistroSkipFirstRunPref)) | 87 if (GetBooleanPref(distro, kDistroSkipFirstRunPref)) |
| 87 parse_result |= MASTER_PROFILE_NO_FIRST_RUN_UI; | 88 parse_result |= MASTER_PROFILE_NO_FIRST_RUN_UI; |
| 88 if (GetBooleanPref(distro, kDistroShowWelcomePage)) | 89 if (GetBooleanPref(distro, kDistroShowWelcomePage)) |
| 89 parse_result |= MASTER_PROFILE_SHOW_WELCOME; | 90 parse_result |= MASTER_PROFILE_SHOW_WELCOME; |
| 90 if (GetBooleanPref(distro, kDistroImportSearchPref)) | 91 if (GetBooleanPref(distro, kDistroImportSearchPref)) |
| 91 parse_result |= MASTER_PROFILE_IMPORT_SEARCH_ENGINE; | 92 parse_result |= MASTER_PROFILE_IMPORT_SEARCH_ENGINE; |
| 92 if (GetBooleanPref(distro, kDistroImportHistoryPref)) | 93 if (GetBooleanPref(distro, kDistroImportHistoryPref)) |
| 93 parse_result |= MASTER_PROFILE_IMPORT_HISTORY; | 94 parse_result |= MASTER_PROFILE_IMPORT_HISTORY; |
| 94 if (GetBooleanPref(distro, kDistroImportBookmarksPref)) | 95 if (GetBooleanPref(distro, kDistroImportBookmarksPref)) |
| 95 parse_result |= MASTER_PROFILE_IMPORT_BOOKMARKS; | 96 parse_result |= MASTER_PROFILE_IMPORT_BOOKMARKS; |
| 97 if (GetBooleanPref(distro, kDistroImportHomePagePref)) |
| 98 parse_result |= MASTER_PROFILE_IMPORT_HOME_PAGE; |
| 96 if (GetBooleanPref(distro, kMakeChromeDefaultForUser)) | 99 if (GetBooleanPref(distro, kMakeChromeDefaultForUser)) |
| 97 parse_result |= MASTER_PROFILE_MAKE_CHROME_DEFAULT_FOR_USER; | 100 parse_result |= MASTER_PROFILE_MAKE_CHROME_DEFAULT_FOR_USER; |
| 98 if (GetBooleanPref(distro, kCreateAllShortcuts)) | 101 if (GetBooleanPref(distro, kCreateAllShortcuts)) |
| 99 parse_result |= MASTER_PROFILE_CREATE_ALL_SHORTCUTS; | 102 parse_result |= MASTER_PROFILE_CREATE_ALL_SHORTCUTS; |
| 100 if (GetBooleanPref(distro, kDoNotLaunchChrome)) | 103 if (GetBooleanPref(distro, kDoNotLaunchChrome)) |
| 101 parse_result |= MASTER_PROFILE_DO_NOT_LAUNCH_CHROME; | 104 parse_result |= MASTER_PROFILE_DO_NOT_LAUNCH_CHROME; |
| 102 if (GetBooleanPref(distro, kMakeChromeDefault)) | 105 if (GetBooleanPref(distro, kMakeChromeDefault)) |
| 103 parse_result |= MASTER_PROFILE_MAKE_CHROME_DEFAULT; | 106 parse_result |= MASTER_PROFILE_MAKE_CHROME_DEFAULT; |
| 104 if (GetBooleanPref(distro, kSystemLevel)) | 107 if (GetBooleanPref(distro, kSystemLevel)) |
| 105 parse_result |= MASTER_PROFILE_SYSTEM_LEVEL; | 108 parse_result |= MASTER_PROFILE_SYSTEM_LEVEL; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 128 if (!tabs_list->Get(i, &entry) || !entry->GetAsString(&tab_entry)) { | 131 if (!tabs_list->Get(i, &entry) || !entry->GetAsString(&tab_entry)) { |
| 129 NOTREACHED(); | 132 NOTREACHED(); |
| 130 break; | 133 break; |
| 131 } | 134 } |
| 132 launch_tabs.push_back(tab_entry); | 135 launch_tabs.push_back(tab_entry); |
| 133 } | 136 } |
| 134 return launch_tabs; | 137 return launch_tabs; |
| 135 } | 138 } |
| 136 | 139 |
| 137 } // installer_util | 140 } // installer_util |
| OLD | NEW |