- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / first_run / first_run_internal_posix.cc
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.
4
5 #include "chrome/browser/first_run/first_run_internal.h"
6
7 #include "base/file_util.h"
8 #include "base/files/file_path.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"
20
21 namespace first_run {
22 namespace internal {
23
24 void DoPostImportPlatformSpecificTasks(Profile* profile) {
25 #if !defined(OS_CHROMEOS)
26   // Aura needs a views implementation of the first run dialog for Linux.
27   // http://crbug.com/234637
28 #if !defined(USE_AURA)
29   base::FilePath local_state_path;
30   PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path);
31   bool local_state_file_exists = base::PathExists(local_state_path);
32   // Launch the first run dialog only for certain builds, and only if the user
33   // has not already set preferences.
34   if (internal::IsOrganicFirstRun() && !local_state_file_exists) {
35     if (ShowFirstRunDialog(profile))
36       startup_metric_utils::SetNonBrowserUIDisplayed();
37   }
38 #endif
39
40   // If stats reporting was turned on by the first run dialog then toggle
41   // the pref (on Windows, the download is tagged with enable/disable stats so
42   // this is POSIX-specific).
43   if (GoogleUpdateSettings::GetCollectStatsConsent()) {
44     g_browser_process->local_state()->SetBoolean(
45         prefs::kMetricsReportingEnabled, true);
46   }
47 #endif
48 }
49
50 bool GetFirstRunSentinelFilePath(base::FilePath* path) {
51   base::FilePath first_run_sentinel;
52
53   if (!PathService::Get(chrome::DIR_USER_DATA, &first_run_sentinel))
54     return false;
55
56   *path = first_run_sentinel.Append(chrome::kFirstRunSentinel);
57   return true;
58 }
59
60 bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs) {
61   // The EULA is only handled on Windows.
62   return true;
63 }
64
65 }  // namespace internal
66 }  // namespace first_run