Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / first_run / first_run_internal_posix.cc
blob683b9371a97550696a7556e5d3b3db66d14509c0
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
3 // found in the LICENSE file.
5 #include "chrome/browser/first_run/first_run_internal.h"
7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h"
9 #include "base/path_service.h"
10 #include "base/prefs/pref_service.h"
11 #include "build/build_config.h"
12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/first_run/first_run_dialog.h"
14 #include "chrome/common/chrome_constants.h"
15 #include "chrome/common/chrome_paths.h"
16 #include "chrome/common/pref_names.h"
17 #include "chrome/installer/util/google_update_settings.h"
18 #include "chrome/installer/util/master_preferences.h"
19 #include "components/startup_metric_utils/startup_metric_utils.h"
21 namespace first_run {
22 namespace internal {
24 void DoPostImportPlatformSpecificTasks(Profile* profile) {
25 #if !defined(OS_CHROMEOS)
26 base::FilePath local_state_path;
27 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path);
28 bool local_state_file_exists = base::PathExists(local_state_path);
29 // Launch the first run dialog only for certain builds, and only if the user
30 // has not already set preferences.
31 if (internal::IsOrganicFirstRun() && !local_state_file_exists) {
32 if (ShowFirstRunDialog(profile))
33 startup_metric_utils::SetNonBrowserUIDisplayed();
36 // If stats reporting was turned on by the first run dialog then toggle
37 // the pref (on Windows, the download is tagged with enable/disable stats so
38 // this is POSIX-specific).
39 if (GoogleUpdateSettings::GetCollectStatsConsent()) {
40 g_browser_process->local_state()->SetBoolean(
41 prefs::kMetricsReportingEnabled, true);
43 #endif
46 bool IsFirstRunSentinelPresent() {
47 base::FilePath sentinel;
48 return !GetFirstRunSentinelFilePath(&sentinel) || base::PathExists(sentinel);
51 bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs) {
52 // The EULA is only handled on Windows.
53 return true;
56 } // namespace internal
57 } // namespace first_run