blob: 69e57667445363396794610e4ea3d06aa2a4a778 [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "build/build_config.h"
class Profile;
namespace base {
class FilePath;
namespace installer {
class MasterPreferences;
namespace first_run {
struct MasterPrefs;
namespace internal {
enum FirstRunState {
FIRST_RUN_UNKNOWN, // The state is not tested or set yet.
// Sets up master preferences by preferences passed by installer.
void SetupMasterPrefsFromInstallPrefs(
const installer::MasterPreferences& install_prefs,
MasterPrefs* out_prefs);
// Get the file path of the first run sentinel; returns false on failure.
bool GetFirstRunSentinelFilePath(base::FilePath* path);
// Create the first run sentinel file; returns false on failure.
bool CreateSentinel();
// -- Platform-specific functions --
void DoPostImportPlatformSpecificTasks(Profile* profile);
// Returns true if the sentinel file exists (or the path cannot be obtained).
bool IsFirstRunSentinelPresent();
// This function has a common implementationin for all non-linux platforms, and
// a linux specific implementation.
bool IsOrganicFirstRun();
// Shows the EULA dialog if required. Returns true if the EULA is accepted,
// returns false if the EULA has not been accepted, in which case the browser
// should exit.
bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs);
// Returns the path for the master preferences file.
base::FilePath MasterPrefsPath();
// Helper for IsChromeFirstRun. Exposed for testing.
FirstRunState DetermineFirstRunState(bool has_sentinel,
bool force_first_run,
bool no_first_run);
#if defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
// For testing, forces the first run dialog to either be shown or not. If not
// called, the decision to show the dialog or not will be made by Chrome based
// on a number of factors (such as install type, whether it's a Chrome-branded
// build, etc).
void ForceFirstRunDialogShownForTesting(bool shown);
#endif // defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
} // namespace internal
} // namespace first_run