Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Side by Side Diff: chrome/browser/first_run/first_run_internal_posix.cc

Issue 208393020: Fix the new First Run sentinel file path determination. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and rebase; re-upload to kick CQ. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/first_run/first_run_internal.h" 5 #include "chrome/browser/first_run/first_run_internal.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/first_run/first_run_dialog.h" 13 #include "chrome/browser/first_run/first_run_dialog.h"
14 #include "chrome/common/chrome_constants.h" 14 #include "chrome/common/chrome_constants.h"
15 #include "chrome/common/chrome_paths.h" 15 #include "chrome/common/chrome_paths.h"
16 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
17 #include "chrome/installer/util/google_update_settings.h" 17 #include "chrome/installer/util/google_update_settings.h"
18 #include "chrome/installer/util/master_preferences.h" 18 #include "chrome/installer/util/master_preferences.h"
19 #include "components/startup_metric_utils/startup_metric_utils.h" 19 #include "components/startup_metric_utils/startup_metric_utils.h"
20 20
21 namespace first_run { 21 namespace first_run {
22 namespace internal { 22 namespace internal {
23 23
24 void DoPostImportPlatformSpecificTasks(Profile* profile) { 24 void DoPostImportPlatformSpecificTasks(Profile* profile) {
25 #if !defined(OS_CHROMEOS) 25 #if !defined(OS_CHROMEOS)
26 // Aura needs a views implementation of the first run dialog for Linux.
27 // http://crbug.com/234637
28 base::FilePath local_state_path; 26 base::FilePath local_state_path;
29 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); 27 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path);
30 bool local_state_file_exists = base::PathExists(local_state_path); 28 bool local_state_file_exists = base::PathExists(local_state_path);
31 // Launch the first run dialog only for certain builds, and only if the user 29 // Launch the first run dialog only for certain builds, and only if the user
32 // has not already set preferences. 30 // has not already set preferences.
33 if (internal::IsOrganicFirstRun() && !local_state_file_exists) { 31 if (internal::IsOrganicFirstRun() && !local_state_file_exists) {
34 if (ShowFirstRunDialog(profile)) 32 if (ShowFirstRunDialog(profile))
35 startup_metric_utils::SetNonBrowserUIDisplayed(); 33 startup_metric_utils::SetNonBrowserUIDisplayed();
36 } 34 }
37 35
38 // If stats reporting was turned on by the first run dialog then toggle 36 // If stats reporting was turned on by the first run dialog then toggle
39 // the pref (on Windows, the download is tagged with enable/disable stats so 37 // the pref (on Windows, the download is tagged with enable/disable stats so
40 // this is POSIX-specific). 38 // this is POSIX-specific).
41 if (GoogleUpdateSettings::GetCollectStatsConsent()) { 39 if (GoogleUpdateSettings::GetCollectStatsConsent()) {
42 g_browser_process->local_state()->SetBoolean( 40 g_browser_process->local_state()->SetBoolean(
43 prefs::kMetricsReportingEnabled, true); 41 prefs::kMetricsReportingEnabled, true);
44 } 42 }
45 #endif 43 #endif
46 } 44 }
47 45
48 bool GetFirstRunSentinelFilePath(base::FilePath* path) { 46 bool IsFirstRunSentinelPresent() {
49 base::FilePath first_run_sentinel; 47 base::FilePath sentinel;
50 48 return !GetFirstRunSentinelFilePath(&sentinel) || base::PathExists(sentinel);
51 if (!PathService::Get(chrome::DIR_USER_DATA, &first_run_sentinel))
52 return false;
53
54 *path = first_run_sentinel.Append(chrome::kFirstRunSentinel);
55 return true;
56 }
57
58 bool GetLegacyFirstRunSentinelFilePath(base::FilePath* path) {
59 // There is no legacy first run sentinel path on Posix.
60 return false;
61 } 49 }
62 50
63 bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs) { 51 bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs) {
64 // The EULA is only handled on Windows. 52 // The EULA is only handled on Windows.
65 return true; 53 return true;
66 } 54 }
67 55
68 } // namespace internal 56 } // namespace internal
69 } // namespace first_run 57 } // namespace first_run
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698