| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 // styles the dialog as well. | 379 // styles the dialog as well. |
| 380 gtk_util::InitRCStyles(); | 380 gtk_util::InitRCStyles(); |
| 381 #elif defined(TOOLKIT_VIEWS) | 381 #elif defined(TOOLKIT_VIEWS) |
| 382 // The delegate needs to be set before any UI is created so that windows | 382 // The delegate needs to be set before any UI is created so that windows |
| 383 // display the correct icon. | 383 // display the correct icon. |
| 384 if (!views::ViewsDelegate::views_delegate) | 384 if (!views::ViewsDelegate::views_delegate) |
| 385 views::ViewsDelegate::views_delegate = new ChromeViewsDelegate; | 385 views::ViewsDelegate::views_delegate = new ChromeViewsDelegate; |
| 386 #endif | 386 #endif |
| 387 | 387 |
| 388 | 388 |
| 389 #if defined(OS_POSIX) | |
| 390 // On Mac OS X / Linux we display the first run dialog as early as possible, | |
| 391 // so we can get the stats enabled. | |
| 392 // TODO(port): | |
| 393 // We check the kNoFirstRun command line switch explicitly here since the | |
| 394 // early placement of this block happens before that's factored into | |
| 395 // first_run_ui_bypass, we probably want to move that block up | |
| 396 // and remove the explicit check from here in the long run. | |
| 397 if (is_first_run && !first_run_ui_bypass && | |
| 398 !parsed_command_line.HasSwitch(switches::kNoFirstRun)) { | |
| 399 // Dummy value, we don't need the profile for the OS X version of this | |
| 400 // method at present. | |
| 401 Profile* profile = NULL; | |
| 402 OpenFirstRunDialog(profile, &process_singleton); | |
| 403 | |
| 404 #if defined(GOOGLE_CHROME_BUILD) | |
| 405 // If user cancelled the first run dialog box, the first run sentinel file | |
| 406 // didn't get created and we should exit Chrome. | |
| 407 if (FirstRun::IsChromeFirstRun()) | |
| 408 return ResultCodes::NORMAL_EXIT; | |
| 409 #endif | |
| 410 } | |
| 411 #endif // OS_POSIX | |
| 412 | |
| 413 // During first run we read the google_update registry key to find what | 389 // During first run we read the google_update registry key to find what |
| 414 // language the user selected when downloading the installer. This | 390 // language the user selected when downloading the installer. This |
| 415 // becomes our default language in the prefs. | 391 // becomes our default language in the prefs. |
| 416 if (is_first_run) { | 392 if (is_first_run) { |
| 417 std::wstring install_lang; | 393 std::wstring install_lang; |
| 418 if (GoogleUpdateSettings::GetLanguage(&install_lang)) | 394 if (GoogleUpdateSettings::GetLanguage(&install_lang)) |
| 419 local_state->SetString(prefs::kApplicationLocale, install_lang); | 395 local_state->SetString(prefs::kApplicationLocale, install_lang); |
| 420 if (GoogleUpdateSettings::GetCollectStatsConsent()) | 396 if (GoogleUpdateSettings::GetCollectStatsConsent()) |
| 421 local_state->SetBoolean(prefs::kMetricsReportingEnabled, true); | 397 local_state->SetBoolean(prefs::kMetricsReportingEnabled, true); |
| 422 } | 398 } |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 // allow the user level Chrome to run. So we notify the user and uninstall | 581 // allow the user level Chrome to run. So we notify the user and uninstall |
| 606 // user level Chrome. | 582 // user level Chrome. |
| 607 // Note this check should only happen here, after all the checks above | 583 // Note this check should only happen here, after all the checks above |
| 608 // (uninstall, resource bundle initialization, other chrome browser | 584 // (uninstall, resource bundle initialization, other chrome browser |
| 609 // processes etc). | 585 // processes etc). |
| 610 if (CheckMachineLevelInstall()) | 586 if (CheckMachineLevelInstall()) |
| 611 return ResultCodes::MACHINE_LEVEL_INSTALL_EXISTS; | 587 return ResultCodes::MACHINE_LEVEL_INSTALL_EXISTS; |
| 612 | 588 |
| 613 process_singleton.Create(); | 589 process_singleton.Create(); |
| 614 | 590 |
| 615 // TODO(port): This block of code should probably be used on all platforms! | |
| 616 // On Mac OS X / Linux we display this dialog before setting the value of | |
| 617 // kMetricsReportingEnabled, so we display this dialog much earlier. | |
| 618 // On Windows a download is tagged with stats enabled/disabled so the UI | |
| 619 // can be displayed later in the startup process. | |
| 620 #if !defined(OS_POSIX) | |
| 621 // Show the First Run UI if this is the first time Chrome has been run on | 591 // Show the First Run UI if this is the first time Chrome has been run on |
| 622 // this computer, or we're being compelled to do so by a command line flag. | 592 // this computer, or we're being compelled to do so by a command line flag. |
| 623 // Note that this be done _after_ the PrefService is initialized and all | 593 // Note that this be done _after_ the PrefService is initialized and all |
| 624 // preferences are registered, since some of the code that the importer | 594 // preferences are registered, since some of the code that the importer |
| 625 // touches reads preferences. | 595 // touches reads preferences. |
| 626 if (is_first_run && !first_run_ui_bypass) { | 596 if (is_first_run && !first_run_ui_bypass) { |
| 627 if (!OpenFirstRunDialog(profile, &process_singleton)) { | 597 if (!OpenFirstRunDialog(profile, &process_singleton)) { |
| 628 // The user cancelled the first run dialog box, we should exit Chrome. | 598 // The user cancelled the first run dialog box, we should exit Chrome. |
| 599 |
| 629 return ResultCodes::NORMAL_EXIT; | 600 return ResultCodes::NORMAL_EXIT; |
| 630 } | 601 } |
| 631 } | 602 } |
| 632 #endif // OS_POSIX | |
| 633 | 603 |
| 634 // Sets things up so that if we crash from this point on, a dialog will | 604 // Sets things up so that if we crash from this point on, a dialog will |
| 635 // popup asking the user to restart chrome. It is done this late to avoid | 605 // popup asking the user to restart chrome. It is done this late to avoid |
| 636 // testing against a bunch of special cases that are taken care early on. | 606 // testing against a bunch of special cases that are taken care early on. |
| 637 PrepareRestartOnCrashEnviroment(parsed_command_line); | 607 PrepareRestartOnCrashEnviroment(parsed_command_line); |
| 638 | 608 |
| 639 #if defined(OS_WIN) | 609 #if defined(OS_WIN) |
| 640 // Initialize Winsock. | 610 // Initialize Winsock. |
| 641 net::EnsureWinsockInit(); | 611 net::EnsureWinsockInit(); |
| 642 #endif // defined(OS_WIN) | 612 #endif // defined(OS_WIN) |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 if (metrics) | 770 if (metrics) |
| 801 metrics->Stop(); | 771 metrics->Stop(); |
| 802 | 772 |
| 803 // browser_shutdown takes care of deleting browser_process, so we need to | 773 // browser_shutdown takes care of deleting browser_process, so we need to |
| 804 // release it. | 774 // release it. |
| 805 browser_process.release(); | 775 browser_process.release(); |
| 806 browser_shutdown::Shutdown(); | 776 browser_shutdown::Shutdown(); |
| 807 | 777 |
| 808 return result_code; | 778 return result_code; |
| 809 } | 779 } |
| OLD | NEW |