| 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 #include <windows.h> | 5 #include <windows.h> |
| 6 #include <shlobj.h> | 6 #include <shlobj.h> |
| 7 | 7 |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "chrome/browser/first_run.h" | 10 #include "chrome/browser/first_run.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 return true; | 162 return true; |
| 163 | 163 |
| 164 // The master prefs are regular prefs so we can just copy the file | 164 // The master prefs are regular prefs so we can just copy the file |
| 165 // to the default place and they just work. | 165 // to the default place and they just work. |
| 166 if (!file_util::CopyFile(master_prefs, user_prefs)) | 166 if (!file_util::CopyFile(master_prefs, user_prefs)) |
| 167 return true; | 167 return true; |
| 168 | 168 |
| 169 if (!(parse_result & installer_util::MASTER_PROFILE_NO_FIRST_RUN_UI)) | 169 if (!(parse_result & installer_util::MASTER_PROFILE_NO_FIRST_RUN_UI)) |
| 170 return true; | 170 return true; |
| 171 | 171 |
| 172 // From here on we won't show first run so we need to do the work to set the |
| 173 // required state given that FirstRunView is not going to be called. |
| 172 FirstRun::SetShowFirstRunBubblePref(); | 174 FirstRun::SetShowFirstRunBubblePref(); |
| 173 | 175 |
| 174 if (parse_result & installer_util::MASTER_PROFILE_SHOW_WELCOME) | 176 if (parse_result & installer_util::MASTER_PROFILE_SHOW_WELCOME) |
| 175 FirstRun::SetShowWelcomePagePref(); | 177 FirstRun::SetShowWelcomePagePref(); |
| 176 | 178 |
| 177 int import_items = 0; | 179 int import_items = 0; |
| 178 if (parse_result & installer_util::MASTER_PROFILE_IMPORT_SEARCH_ENGINE) | 180 if (parse_result & installer_util::MASTER_PROFILE_IMPORT_SEARCH_ENGINE) |
| 179 import_items += SEARCH_ENGINES; | 181 import_items += SEARCH_ENGINES; |
| 180 if (parse_result & installer_util::MASTER_PROFILE_IMPORT_HISTORY) | 182 if (parse_result & installer_util::MASTER_PROFILE_IMPORT_HISTORY) |
| 181 import_items += HISTORY; | 183 import_items += HISTORY; |
| 182 | 184 |
| 183 if (import_items) { | 185 if (import_items) { |
| 184 // There is something to import from the default browser. This launches | 186 // There is something to import from the default browser. This launches |
| 185 // the importer process and blocks until done or until it fails. | 187 // the importer process and blocks until done or until it fails. |
| 186 if (!FirstRun::ImportSettings(NULL, 0, import_items, NULL)) { | 188 if (!FirstRun::ImportSettings(NULL, 0, import_items, NULL)) { |
| 187 LOG(WARNING) << "silent import failed"; | 189 LOG(WARNING) << "silent import failed"; |
| 188 } | 190 } |
| 189 } | 191 } |
| 192 |
| 193 FirstRun::CreateSentinel(); |
| 190 return false; | 194 return false; |
| 191 } | 195 } |
| 192 | 196 |
| 193 bool Upgrade::IsBrowserAlreadyRunning() { | 197 bool Upgrade::IsBrowserAlreadyRunning() { |
| 194 static HANDLE handle = NULL; | 198 static HANDLE handle = NULL; |
| 195 std::wstring exe; | 199 std::wstring exe; |
| 196 PathService::Get(base::FILE_EXE, &exe); | 200 PathService::Get(base::FILE_EXE, &exe); |
| 197 std::replace(exe.begin(), exe.end(), '\\', '!'); | 201 std::replace(exe.begin(), exe.end(), '\\', '!'); |
| 198 std::transform(exe.begin(), exe.end(), exe.begin(), tolower); | 202 std::transform(exe.begin(), exe.end(), exe.begin(), tolower); |
| 199 exe = L"Global\\" + exe; | 203 exe = L"Global\\" + exe; |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 bool FirstRun::SetShowWelcomePagePref() { | 493 bool FirstRun::SetShowWelcomePagePref() { |
| 490 PrefService* local_state = g_browser_process->local_state(); | 494 PrefService* local_state = g_browser_process->local_state(); |
| 491 if (!local_state) | 495 if (!local_state) |
| 492 return false; | 496 return false; |
| 493 if (!local_state->IsPrefRegistered(prefs::kShouldShowWelcomePage)) { | 497 if (!local_state->IsPrefRegistered(prefs::kShouldShowWelcomePage)) { |
| 494 local_state->RegisterBooleanPref(prefs::kShouldShowWelcomePage, false); | 498 local_state->RegisterBooleanPref(prefs::kShouldShowWelcomePage, false); |
| 495 local_state->SetBoolean(prefs::kShouldShowWelcomePage, true); | 499 local_state->SetBoolean(prefs::kShouldShowWelcomePage, true); |
| 496 } | 500 } |
| 497 return true; | 501 return true; |
| 498 } | 502 } |
| OLD | NEW |