| 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 <atlbase.h> | 5 #include <atlbase.h> |
| 6 #include <atlcom.h> | 6 #include <atlcom.h> |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shlobj.h> | 8 #include <shlobj.h> |
| 9 | 9 |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "base/registry.h" | 21 #include "base/registry.h" |
| 22 #include "base/string_util.h" | 22 #include "base/string_util.h" |
| 23 #include "chrome/common/chrome_constants.h" | 23 #include "chrome/common/chrome_constants.h" |
| 24 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 26 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
| 27 #include "chrome/browser/hang_monitor/hung_window_detector.h" | 27 #include "chrome/browser/hang_monitor/hung_window_detector.h" |
| 28 #include "chrome/browser/importer/importer.h" | 28 #include "chrome/browser/importer/importer.h" |
| 29 #include "chrome/browser/profile.h" | 29 #include "chrome/browser/profile.h" |
| 30 #include "chrome/browser/profile_manager.h" | 30 #include "chrome/browser/profile_manager.h" |
| 31 #include "chrome/browser/shell_integration.h" |
| 31 #include "chrome/browser/views/first_run_view.h" | 32 #include "chrome/browser/views/first_run_view.h" |
| 32 #include "chrome/common/chrome_constants.h" | 33 #include "chrome/common/chrome_constants.h" |
| 33 #include "chrome/common/chrome_paths.h" | 34 #include "chrome/common/chrome_paths.h" |
| 34 #include "chrome/common/pref_service.h" | 35 #include "chrome/common/pref_service.h" |
| 35 #include "chrome/common/resource_bundle.h" | 36 #include "chrome/common/resource_bundle.h" |
| 36 #include "chrome/common/result_codes.h" | 37 #include "chrome/common/result_codes.h" |
| 37 #include "chrome/installer/util/browser_distribution.h" | 38 #include "chrome/installer/util/browser_distribution.h" |
| 38 #include "chrome/installer/util/google_update_constants.h" | 39 #include "chrome/installer/util/google_update_constants.h" |
| 39 #include "chrome/installer/util/google_update_settings.h" | 40 #include "chrome/installer/util/google_update_settings.h" |
| 40 #include "chrome/installer/util/install_util.h" | 41 #include "chrome/installer/util/install_util.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 return false; | 281 return false; |
| 281 | 282 |
| 282 if (parse_result & installer_util::MASTER_PROFILE_SHOW_WELCOME) | 283 if (parse_result & installer_util::MASTER_PROFILE_SHOW_WELCOME) |
| 283 FirstRun::SetShowWelcomePagePref(); | 284 FirstRun::SetShowWelcomePagePref(); |
| 284 | 285 |
| 285 int import_items = 0; | 286 int import_items = 0; |
| 286 if (parse_result & installer_util::MASTER_PROFILE_IMPORT_SEARCH_ENGINE) | 287 if (parse_result & installer_util::MASTER_PROFILE_IMPORT_SEARCH_ENGINE) |
| 287 import_items += SEARCH_ENGINES; | 288 import_items += SEARCH_ENGINES; |
| 288 if (parse_result & installer_util::MASTER_PROFILE_IMPORT_HISTORY) | 289 if (parse_result & installer_util::MASTER_PROFILE_IMPORT_HISTORY) |
| 289 import_items += HISTORY; | 290 import_items += HISTORY; |
| 291 if (parse_result & installer_util::MASTER_PROFILE_IMPORT_BOOKMARKS) |
| 292 import_items += FAVORITES; |
| 290 | 293 |
| 291 if (import_items) { | 294 if (import_items) { |
| 292 // There is something to import from the default browser. This launches | 295 // There is something to import from the default browser. This launches |
| 293 // the importer process and blocks until done or until it fails. | 296 // the importer process and blocks until done or until it fails. |
| 294 ImporterHost importer_host; | 297 ImporterHost importer_host; |
| 295 if (!FirstRun::ImportSettings(NULL, | 298 if (!FirstRun::ImportSettings(NULL, |
| 296 importer_host.GetSourceProfileInfoAt(0).browser_type, | 299 importer_host.GetSourceProfileInfoAt(0).browser_type, |
| 297 import_items, NULL)) { | 300 import_items, NULL)) { |
| 298 LOG(WARNING) << "silent import failed"; | 301 LOG(WARNING) << "silent import failed"; |
| 299 } | 302 } |
| 300 } | 303 } |
| 301 | 304 |
| 305 if (parse_result & |
| 306 installer_util::MASTER_PROFILE_MAKE_CHROME_DEFAULT_FOR_USER) |
| 307 ShellIntegration::SetAsDefaultBrowser(); |
| 308 |
| 302 return false; | 309 return false; |
| 303 } | 310 } |
| 304 | 311 |
| 305 bool Upgrade::IsBrowserAlreadyRunning() { | 312 bool Upgrade::IsBrowserAlreadyRunning() { |
| 306 static HANDLE handle = NULL; | 313 static HANDLE handle = NULL; |
| 307 std::wstring exe; | 314 std::wstring exe; |
| 308 PathService::Get(base::FILE_EXE, &exe); | 315 PathService::Get(base::FILE_EXE, &exe); |
| 309 std::replace(exe.begin(), exe.end(), '\\', '!'); | 316 std::replace(exe.begin(), exe.end(), '\\', '!'); |
| 310 std::transform(exe.begin(), exe.end(), exe.begin(), tolower); | 317 std::transform(exe.begin(), exe.end(), exe.begin(), tolower); |
| 311 exe = L"Global\\" + exe; | 318 exe = L"Global\\" + exe; |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 bool FirstRun::SetShowWelcomePagePref() { | 619 bool FirstRun::SetShowWelcomePagePref() { |
| 613 PrefService* local_state = g_browser_process->local_state(); | 620 PrefService* local_state = g_browser_process->local_state(); |
| 614 if (!local_state) | 621 if (!local_state) |
| 615 return false; | 622 return false; |
| 616 if (!local_state->IsPrefRegistered(prefs::kShouldShowWelcomePage)) { | 623 if (!local_state->IsPrefRegistered(prefs::kShouldShowWelcomePage)) { |
| 617 local_state->RegisterBooleanPref(prefs::kShouldShowWelcomePage, false); | 624 local_state->RegisterBooleanPref(prefs::kShouldShowWelcomePage, false); |
| 618 local_state->SetBoolean(prefs::kShouldShowWelcomePage, true); | 625 local_state->SetBoolean(prefs::kShouldShowWelcomePage, true); |
| 619 } | 626 } |
| 620 return true; | 627 return true; |
| 621 } | 628 } |
| OLD | NEW |