summaryrefslogtreecommitdiffstats
path: root/chrome/browser/first_run
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2011-05-11 20:53:37 +0100
committerKristian Monsen <kristianm@google.com>2011-05-16 13:54:48 +0100
commit21d179b334e59e9a3bfcaed4c4430bef1bc5759d (patch)
tree64e2bb6da27af6a5c93ca34f6051584aafbfcb9e /chrome/browser/first_run
parent0c63f00edd6ed0482fd5cbcea937ca088baf7858 (diff)
downloadexternal_chromium-21d179b334e59e9a3bfcaed4c4430bef1bc5759d.zip
external_chromium-21d179b334e59e9a3bfcaed4c4430bef1bc5759d.tar.gz
external_chromium-21d179b334e59e9a3bfcaed4c4430bef1bc5759d.tar.bz2
Merge Chromium at 10.0.621.0: Initial merge by git.
Change-Id: I070cc91c608dfa4a968a5a54c173260765ac8097
Diffstat (limited to 'chrome/browser/first_run')
-rw-r--r--chrome/browser/first_run/first_run.cc56
-rw-r--r--chrome/browser/first_run/first_run.h12
-rw-r--r--chrome/browser/first_run/first_run_mac.mm6
-rw-r--r--chrome/browser/first_run/first_run_win.cc54
4 files changed, 67 insertions, 61 deletions
diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc
index ce89af5..4235a8a 100644
--- a/chrome/browser/first_run/first_run.cc
+++ b/chrome/browser/first_run/first_run.cc
@@ -21,7 +21,7 @@
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/process_singleton.h"
-#include "chrome/browser/profile_manager.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/common/chrome_paths.h"
@@ -94,9 +94,9 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
FilePath master_prefs;
if (!PathService::Get(base::DIR_EXE, &master_prefs))
return true;
- master_prefs = master_prefs.AppendASCII(installer_util::kDefaultMasterPrefs);
+ master_prefs = master_prefs.AppendASCII(installer::kDefaultMasterPrefs);
- installer_util::MasterPreferences prefs(master_prefs);
+ installer::MasterPreferences prefs(master_prefs);
if (!prefs.read_from_file())
return true;
@@ -107,14 +107,14 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
#if defined(OS_WIN)
// RLZ is currently a Windows-only phenomenon. When it comes to the Mac/
// Linux, enable it here.
- if (!prefs.GetInt(installer_util::master_preferences::kDistroPingDelay,
+ if (!prefs.GetInt(installer::master_preferences::kDistroPingDelay,
&out_prefs->ping_delay)) {
// 90 seconds is the default that we want to use in case master
// preferences is missing, corrupt or ping_delay is missing.
out_prefs->ping_delay = 90;
}
- if (prefs.GetBool(installer_util::master_preferences::kRequireEula, &value) &&
+ if (prefs.GetBool(installer::master_preferences::kRequireEula, &value) &&
value) {
// Show the post-installation EULA. This is done by setup.exe and the
// result determines if we continue or not. We wait here until the user
@@ -125,16 +125,16 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
FilePath inner_html;
if (WriteEULAtoTempFile(&inner_html)) {
int retcode = 0;
- if (!LaunchSetupWithParam(installer_util::switches::kShowEula,
+ if (!LaunchSetupWithParam(installer::switches::kShowEula,
inner_html.ToWStringHack(), &retcode) ||
- (retcode == installer_util::EULA_REJECTED)) {
+ (retcode == installer::EULA_REJECTED)) {
LOG(WARNING) << "EULA rejected. Fast exit.";
::ExitProcess(1);
}
- if (retcode == installer_util::EULA_ACCEPTED) {
+ if (retcode == installer::EULA_ACCEPTED) {
VLOG(1) << "EULA : no collection";
GoogleUpdateSettings::SetCollectStatsConsent(false);
- } else if (retcode == installer_util::EULA_ACCEPTED_OPT_IN) {
+ } else if (retcode == installer::EULA_ACCEPTED_OPT_IN) {
VLOG(1) << "EULA : collection consent";
GoogleUpdateSettings::SetCollectStatsConsent(true);
}
@@ -142,7 +142,7 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
}
#endif
- if (prefs.GetBool(installer_util::master_preferences::kAltFirstRunBubble,
+ if (prefs.GetBool(installer::master_preferences::kAltFirstRunBubble,
&value) && value) {
FirstRun::SetOEMFirstRunBubblePref();
}
@@ -164,7 +164,7 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
}
#endif
- if (prefs.GetBool(installer_util::master_preferences::kDistroImportSearchPref,
+ if (prefs.GetBool(installer::master_preferences::kDistroImportSearchPref,
&value)) {
if (value) {
out_prefs->do_import_items |= importer::SEARCH_ENGINES;
@@ -175,7 +175,7 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
// Check to see if search engine logos should be randomized.
if (prefs.GetBool(
- installer_util::master_preferences::
+ installer::master_preferences::
kSearchEngineExperimentRandomizePref,
&value) && value) {
out_prefs->randomize_search_engine_experiment = true;
@@ -186,12 +186,12 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
// user is guaranteed to see the bubble iff he or she has completed the first
// run process.
if (prefs.GetBool(
- installer_util::master_preferences::kDistroSuppressFirstRunBubble,
+ installer::master_preferences::kDistroSuppressFirstRunBubble,
&value) && value)
FirstRun::SetShowFirstRunBubblePref(false);
if (prefs.GetBool(
- installer_util::master_preferences::kDistroImportHistoryPref,
+ installer::master_preferences::kDistroImportHistoryPref,
&value)) {
if (value) {
out_prefs->do_import_items |= importer::HISTORY;
@@ -204,7 +204,7 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
out_prefs->homepage_defined = prefs.GetString(prefs::kHomePage, &not_used);
if (prefs.GetBool(
- installer_util::master_preferences::kDistroImportHomePagePref,
+ installer::master_preferences::kDistroImportHomePagePref,
&value)) {
if (value) {
out_prefs->do_import_items |= importer::HOME_PAGE;
@@ -215,13 +215,13 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
// Bookmarks are never imported unless specifically turned on.
if (prefs.GetBool(
- installer_util::master_preferences::kDistroImportBookmarksPref,
+ installer::master_preferences::kDistroImportBookmarksPref,
&value) && value) {
out_prefs->do_import_items |= importer::FAVORITES;
}
if (prefs.GetBool(
- installer_util::master_preferences::kMakeChromeDefaultForUser,
+ installer::master_preferences::kMakeChromeDefaultForUser,
&value) && value) {
out_prefs->make_chrome_default = true;
}
@@ -231,7 +231,7 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
// Note we are skipping all other master preferences if skip-first-run-ui
// is *not* specified. (That is, we continue only if skipping first run ui.)
if (!prefs.GetBool(
- installer_util::master_preferences::kDistroSkipFirstRunPref,
+ installer::master_preferences::kDistroSkipFirstRunPref,
&value) || !value) {
return true;
}
@@ -248,14 +248,14 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
if (!FirstRun::CreateSentinel())
return false;
- if (prefs.GetBool(installer_util::master_preferences::kDistroShowWelcomePage,
+ if (prefs.GetBool(installer::master_preferences::kDistroShowWelcomePage,
&value) && value) {
FirstRun::SetShowWelcomePagePref();
}
std::string import_bookmarks_path;
prefs.GetString(
- installer_util::master_preferences::kDistroImportBookmarksFromFilePref,
+ installer::master_preferences::kDistroImportBookmarksFromFilePref,
&import_bookmarks_path);
#if defined(OS_WIN)
@@ -302,7 +302,7 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
#endif
if (prefs.GetBool(
- installer_util::master_preferences::kMakeChromeDefaultForUser,
+ installer::master_preferences::kMakeChromeDefaultForUser,
&value) && value) {
ShellIntegration::SetAsDefaultBrowser();
}
@@ -472,6 +472,20 @@ void Upgrade::RelaunchChromeBrowserWithNewCommandLineIfNeeded() {
}
#endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
+FirstRunBrowserProcess::FirstRunBrowserProcess(const CommandLine& command_line)
+ : BrowserProcessImpl(command_line) {
+}
+
+FirstRunBrowserProcess::~FirstRunBrowserProcess() {}
+
+GoogleURLTracker* FirstRunBrowserProcess::google_url_tracker() {
+ return NULL;
+}
+
+IntranetRedirectDetector* FirstRunBrowserProcess::intranet_redirect_detector() {
+ return NULL;
+}
+
FirstRunImportObserver::FirstRunImportObserver()
: loop_running_(false), import_result_(ResultCodes::NORMAL_EXIT) {
}
diff --git a/chrome/browser/first_run/first_run.h b/chrome/browser/first_run/first_run.h
index c131756..415753f 100644
--- a/chrome/browser/first_run/first_run.h
+++ b/chrome/browser/first_run/first_run.h
@@ -282,15 +282,11 @@ class Upgrade {
// thread to fetch on).
class FirstRunBrowserProcess : public BrowserProcessImpl {
public:
- explicit FirstRunBrowserProcess(const CommandLine& command_line)
- : BrowserProcessImpl(command_line) {
- }
- virtual ~FirstRunBrowserProcess() { }
+ explicit FirstRunBrowserProcess(const CommandLine& command_line);
+ virtual ~FirstRunBrowserProcess();
- virtual GoogleURLTracker* google_url_tracker() { return NULL; }
- virtual IntranetRedirectDetector* intranet_redirect_detector() {
- return NULL;
- }
+ virtual GoogleURLTracker* google_url_tracker();
+ virtual IntranetRedirectDetector* intranet_redirect_detector();
private:
DISALLOW_COPY_AND_ASSIGN(FirstRunBrowserProcess);
diff --git a/chrome/browser/first_run/first_run_mac.mm b/chrome/browser/first_run/first_run_mac.mm
index b297d15..e4ec8df 100644
--- a/chrome/browser/first_run/first_run_mac.mm
+++ b/chrome/browser/first_run/first_run_mac.mm
@@ -6,12 +6,12 @@
#import "base/scoped_nsobject.h"
#import "chrome/app/breakpad_mac.h"
-#import "chrome/browser/cocoa/first_run_dialog.h"
-#import "chrome/browser/cocoa/search_engine_dialog_controller.h"
#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/browser/profile.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/shell_integration.h"
+#import "chrome/browser/ui/cocoa/first_run_dialog.h"
+#import "chrome/browser/ui/cocoa/search_engine_dialog_controller.h"
#include "chrome/common/pref_names.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/google_update_settings.h"
diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc
index 35037d5..995dcb2 100644
--- a/chrome/browser/first_run/first_run_win.cc
+++ b/chrome/browser/first_run/first_run_win.cc
@@ -25,14 +25,15 @@
#include "base/utf_string_conversions.h"
#include "base/win/registry.h"
#include "base/win/windows_version.h"
-#include "chrome/browser/extensions/extensions_service.h"
+#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_updater.h"
#include "chrome/browser/importer/importer.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/process_singleton.h"
-#include "chrome/browser/profile.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/views/first_run_search_engine_view.h"
+#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
@@ -64,14 +65,7 @@ namespace {
bool GetNewerChromeFile(FilePath* path) {
if (!PathService::Get(base::DIR_EXE, path))
return false;
- *path = path->Append(installer_util::kChromeNewExe);
- return true;
-}
-
-bool GetBackupChromeFile(std::wstring* path) {
- if (!PathService::Get(base::DIR_EXE, path))
- return false;
- file_util::AppendToPath(path, installer_util::kChromeOldExe);
+ *path = path->Append(installer::kChromeNewExe);
return true;
}
@@ -89,7 +83,7 @@ bool InvokeGoogleUpdateForRename() {
DWORD exit_code;
::GetExitCodeProcess(handle, &exit_code);
::CloseHandle(handle);
- if (exit_code == installer_util::RENAME_SUCCESSFUL)
+ if (exit_code == installer::RENAME_SUCCESSFUL)
return true;
}
}
@@ -101,8 +95,8 @@ bool LaunchSetupWithParam(const std::string& param, const std::wstring& value,
FilePath exe_path;
if (!PathService::Get(base::DIR_MODULE, &exe_path))
return false;
- exe_path = exe_path.Append(installer_util::kInstallerDir);
- exe_path = exe_path.Append(installer_util::kSetupExe);
+ exe_path = exe_path.Append(installer::kInstallerDir);
+ exe_path = exe_path.Append(installer::kSetupExe);
base::ProcessHandle ph;
CommandLine cl(exe_path);
cl.AppendSwitchNative(param, value);
@@ -156,7 +150,7 @@ class FirstRunDelayedTasks : public NotificationObserver {
const NotificationDetails& details) {
// After processing the notification we always delete ourselves.
if (type.value == NotificationType::EXTENSIONS_READY)
- DoExtensionWork(Source<Profile>(source).ptr()->GetExtensionsService());
+ DoExtensionWork(Source<Profile>(source).ptr()->GetExtensionService());
delete this;
return;
}
@@ -168,7 +162,7 @@ class FirstRunDelayedTasks : public NotificationObserver {
// The extension work is to basically trigger an extension update check.
// If the extension specified in the master pref is older than the live
// extension it will get updated which is the same as get it installed.
- void DoExtensionWork(ExtensionsService* service) {
+ void DoExtensionWork(ExtensionService* service) {
if (!service)
return;
service->updater()->CheckNow();
@@ -186,8 +180,8 @@ bool FirstRun::LaunchSetupWithParam(const std::string& param,
FilePath exe_path;
if (!PathService::Get(base::DIR_MODULE, &exe_path))
return false;
- exe_path = exe_path.Append(installer_util::kInstallerDir);
- exe_path = exe_path.Append(installer_util::kSetupExe);
+ exe_path = exe_path.Append(installer::kInstallerDir);
+ exe_path = exe_path.Append(installer::kSetupExe);
base::ProcessHandle ph;
CommandLine cl(exe_path);
cl.AppendSwitchNative(param, value);
@@ -225,30 +219,32 @@ void FirstRun::DoDelayedInstallExtensions() {
CommandLine* Upgrade::new_command_line_ = NULL;
bool FirstRun::CreateChromeDesktopShortcut() {
- std::wstring chrome_exe;
+ FilePath chrome_exe;
if (!PathService::Get(base::FILE_EXE, &chrome_exe))
return false;
BrowserDistribution *dist = BrowserDistribution::GetDistribution();
if (!dist)
return false;
- return ShellUtil::CreateChromeDesktopShortcut(chrome_exe,
+ return ShellUtil::CreateChromeDesktopShortcut(dist, chrome_exe.value(),
dist->GetAppDescription(), ShellUtil::CURRENT_USER,
false, true); // create if doesn't exist.
}
bool FirstRun::CreateChromeQuickLaunchShortcut() {
- std::wstring chrome_exe;
+ FilePath chrome_exe;
if (!PathService::Get(base::FILE_EXE, &chrome_exe))
return false;
- return ShellUtil::CreateChromeQuickLaunchShortcut(chrome_exe,
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ return ShellUtil::CreateChromeQuickLaunchShortcut(dist, chrome_exe.value(),
ShellUtil::CURRENT_USER, // create only for current user.
true); // create if doesn't exist.
}
bool Upgrade::IsBrowserAlreadyRunning() {
static HANDLE handle = NULL;
- std::wstring exe;
- PathService::Get(base::FILE_EXE, &exe);
+ FilePath exe_path;
+ PathService::Get(base::FILE_EXE, &exe_path);
+ std::wstring exe = exe_path.value();
std::replace(exe.begin(), exe.end(), '\\', '!');
std::transform(exe.begin(), exe.end(), exe.begin(), tolower);
exe = L"Global\\" + exe;
@@ -261,8 +257,7 @@ bool Upgrade::IsBrowserAlreadyRunning() {
bool Upgrade::RelaunchChromeBrowser(const CommandLine& command_line) {
scoped_ptr<base::Environment> env(base::Environment::Create());
- env->UnSetVar(WideToUTF8(
- BrowserDistribution::GetDistribution()->GetEnvVersionKey()).c_str());
+ env->UnSetVar(chrome::kChromeVersionEnvVar);
return base::LaunchApp(command_line.command_line_string(),
false, false, NULL);
}
@@ -273,12 +268,13 @@ bool Upgrade::SwapNewChromeExeIfPresent() {
return false;
if (!file_util::PathExists(new_chrome_exe))
return false;
- std::wstring curr_chrome_exe;
- if (!PathService::Get(base::FILE_EXE, &curr_chrome_exe))
+ FilePath cur_chrome_exe;
+ if (!PathService::Get(base::FILE_EXE, &cur_chrome_exe))
return false;
// First try to rename exe by launching rename command ourselves.
- bool user_install = InstallUtil::IsPerUserInstall(curr_chrome_exe.c_str());
+ bool user_install =
+ InstallUtil::IsPerUserInstall(cur_chrome_exe.value().c_str());
HKEY reg_root = user_install ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
BrowserDistribution *dist = BrowserDistribution::GetDistribution();
base::win::RegKey key;
@@ -290,7 +286,7 @@ bool Upgrade::SwapNewChromeExeIfPresent() {
DWORD exit_code;
::GetExitCodeProcess(handle, &exit_code);
::CloseHandle(handle);
- if (exit_code == installer_util::RENAME_SUCCESSFUL)
+ if (exit_code == installer::RENAME_SUCCESSFUL)
return true;
}
}