OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
6 | 6 |
7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
803 // creatable, for example; on Windows in code below we bring up a | 803 // creatable, for example; on Windows in code below we bring up a |
804 // dialog prompting the user to pick a different directory. | 804 // dialog prompting the user to pick a different directory. |
805 // However, ProcessSingleton needs a real user_data_dir on Mac/Linux, | 805 // However, ProcessSingleton needs a real user_data_dir on Mac/Linux, |
806 // so it's better to fail here than fail mysteriously elsewhere. | 806 // so it's better to fail here than fail mysteriously elsewhere. |
807 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_)) | 807 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_)) |
808 << "Must be able to get user data directory!"; | 808 << "Must be able to get user data directory!"; |
809 #endif | 809 #endif |
810 | 810 |
811 // Whether this is First Run. |do_first_run_tasks_| should be prefered to this | 811 // Whether this is First Run. |do_first_run_tasks_| should be prefered to this |
812 // unless the desire is actually to know whether this is really First Run | 812 // unless the desire is actually to know whether this is really First Run |
813 // (i.e., even if --no-first-run is passed). | 813 // (i.e., even if --no-first-run is passed). |
gab
2013/02/11 23:44:01
ref.
| |
814 bool is_first_run = false; | 814 bool is_first_run = false; |
815 // Android's first run is done in Java instead of native. | 815 // Android's first run is done in Java instead of native. |
816 #if !defined(OS_ANDROID) | 816 #if !defined(OS_ANDROID) |
817 | 817 |
818 process_singleton_.reset(new ProcessSingleton(user_data_dir_)); | 818 process_singleton_.reset(new ProcessSingleton(user_data_dir_)); |
819 // Ensure ProcessSingleton won't process messages too early. It will be | 819 // Ensure ProcessSingleton won't process messages too early. It will be |
820 // unlocked in PostBrowserStart(). | 820 // unlocked in PostBrowserStart(). |
821 process_singleton_->Lock(NULL); | 821 process_singleton_->Lock(NULL); |
822 | 822 |
823 bool force_first_run = | 823 bool force_first_run = |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
945 !parsed_command_line().HasSwitch(switches::kApp) && | 945 !parsed_command_line().HasSwitch(switches::kApp) && |
946 !parsed_command_line().HasSwitch(switches::kAppId)); | 946 !parsed_command_line().HasSwitch(switches::kAppId)); |
947 | 947 |
948 if (do_first_run_tasks_) { | 948 if (do_first_run_tasks_) { |
949 AddFirstRunNewTabs(browser_creator_.get(), master_prefs_->new_tabs); | 949 AddFirstRunNewTabs(browser_creator_.get(), master_prefs_->new_tabs); |
950 } else if (parsed_command_line().HasSwitch(switches::kNoFirstRun)) { | 950 } else if (parsed_command_line().HasSwitch(switches::kNoFirstRun)) { |
951 // Create the First Run beacon anyways if --no-first-run was passed on the | 951 // Create the First Run beacon anyways if --no-first-run was passed on the |
952 // command line. | 952 // command line. |
953 first_run::CreateSentinel(); | 953 first_run::CreateSentinel(); |
954 } | 954 } |
955 | |
956 // Store the initial VariationsService seed in local state, if it exists in | |
957 // master prefs. | |
958 if (!master_prefs_->variations_seed.empty()) { | |
gab
2013/02/11 23:44:01
See referenced comment above, this should probably
Alexei Svitkine (slow)
2013/02/12 00:11:31
Done. Can you explain the difference between the t
gab
2013/02/12 00:31:06
No difference in the real world; using |do_first_r
| |
959 local_state_->SetString(prefs::kVariationsSeed, | |
960 master_prefs_->variations_seed); | |
961 // Set the variation seed date to the current system time. If the user's | |
962 // clock is incorrect, this may cause some field trial expiry checks to | |
963 // not do the right thing until the next seed update from the server, when | |
964 // this value will be updated. | |
965 local_state_->SetInt64(prefs::kVariationsSeedDate, | |
966 base::Time::Now().ToInternalValue()); | |
967 } | |
955 } | 968 } |
956 #endif | 969 #endif |
957 | 970 |
958 // TODO(viettrungluu): why don't we run this earlier? | 971 // TODO(viettrungluu): why don't we run this earlier? |
959 if (!parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) | 972 if (!parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) |
960 WarnAboutMinimumSystemRequirements(); | 973 WarnAboutMinimumSystemRequirements(); |
961 | 974 |
962 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) | 975 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) |
963 // Set the product channel for crash reports. | 976 // Set the product channel for crash reports. |
964 child_process_logging::SetChannel( | 977 child_process_logging::SetChannel( |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1783 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1796 if (base::win::GetVersion() <= base::win::VERSION_XP) |
1784 uma_name += "_XP"; | 1797 uma_name += "_XP"; |
1785 | 1798 |
1786 uma_name += "_PreRead_"; | 1799 uma_name += "_PreRead_"; |
1787 uma_name += pre_read_percentage; | 1800 uma_name += pre_read_percentage; |
1788 AddPreReadHistogramTime(uma_name.c_str(), time); | 1801 AddPreReadHistogramTime(uma_name.c_str(), time); |
1789 } | 1802 } |
1790 #endif | 1803 #endif |
1791 #endif | 1804 #endif |
1792 } | 1805 } |
OLD | NEW |