summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorgab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-30 04:57:32 +0000
committergab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-30 04:57:32 +0000
commitec509ee186db5eafcd6a42200241e74e339d1773 (patch)
tree57a979326f17417846e23e6a8b739328901adffa /chrome/browser
parent4229cfe9358eab93c43f2ecf3d0e1df7b9bc9ee2 (diff)
downloadchromium_src-ec509ee186db5eafcd6a42200241e74e339d1773.zip
chromium_src-ec509ee186db5eafcd6a42200241e74e339d1773.tar.gz
chromium_src-ec509ee186db5eafcd6a42200241e74e339d1773.tar.bz2
No longer install all-users shortcuts on system-level installs; instead install per-user shortcuts through Active Setup.
Design doc: https://docs.google.com/a/chromium.org/document/d/1FjFbmKVj0BIP7xBXMs4lLgQcrc--Jl5jiMiwdDxLeOs/edit BUG=148539 TEST=Shortcuts work as described in the design doc :)! installer_util_unittests.exe --gtest_filter=ShellUtilShortcut* setup_unittests.exe --gtest_filter=InstallShortcutTest* Review URL: https://chromiumcodereview.appspot.com/11229010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164849 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/chrome_browser_main.cc16
-rw-r--r--chrome/browser/chrome_browser_main_win.cc21
-rw-r--r--chrome/browser/first_run/first_run.cc1
-rw-r--r--chrome/browser/first_run/first_run_posix.cc3
-rw-r--r--chrome/browser/first_run/first_run_win.cc45
5 files changed, 32 insertions, 54 deletions
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index b4b87c0..1d98c38 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -27,6 +27,7 @@
#include "base/sys_info.h"
#include "base/sys_string_conversions.h"
#include "base/threading/platform_thread.h"
+#include "base/threading/sequenced_worker_pool.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
@@ -1166,6 +1167,21 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
// preferences are registered, since some of the code that the importer
// touches reads preferences.
if (is_first_run_) {
+#if defined(OS_WIN)
+ // On Windows, trigger the Active Setup command in some scenarios to finish
+ // configuring this user's install (e.g. per-user shortcuts on system-level
+ // installs).
+ // Delay the task slightly to give Chrome launch I/O priority while also
+ // making sure shortcuts are created promptly to avoid annoying the user by
+ // re-creating shortcuts he previously deleted.
+ // TODO(gab): Add a first run section to ChromeBrowserMainParts and remove
+ // OS specific sections below.
+ static const int64 kTiggerActiveSetupDelaySeconds = 5;
+ BrowserThread::GetBlockingPool()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&InstallUtil::TriggerActiveSetupCommandIfNeeded),
+ base::TimeDelta::FromSeconds(kTiggerActiveSetupDelaySeconds));
+#endif // OS_WIN
if (!first_run_ui_bypass_) {
first_run::AutoImport(profile_,
master_prefs_->homepage_defined,
diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc
index acb8c1d..3731ac1 100644
--- a/chrome/browser/chrome_browser_main_win.cc
+++ b/chrome/browser/chrome_browser_main_win.cc
@@ -142,17 +142,20 @@ int DoUninstallTasks(bool chrome_still_running) {
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
FilePath chrome_exe;
if (PathService::Get(base::FILE_EXE, &chrome_exe)) {
- if (!ShellUtil::RemoveChromeShortcut(
- ShellUtil::SHORTCUT_DESKTOP, dist, chrome_exe.value(),
- ShellUtil::CURRENT_USER, NULL)) {
- VLOG(1) << "Failed to delete desktop shortcut.";
+ ShellUtil::ChromeShortcutLocation user_shortcut_locations[] = {
+ ShellUtil::SHORTCUT_DESKTOP,
+ ShellUtil::SHORTCUT_QUICK_LAUNCH,
+ ShellUtil::SHORTCUT_START_MENU,
+ };
+ for (size_t i = 0; i < arraysize(user_shortcut_locations); ++i) {
+ if (!ShellUtil::RemoveChromeShortcut(
+ user_shortcut_locations[i], dist, chrome_exe.value(),
+ ShellUtil::CURRENT_USER, NULL)) {
+ VLOG(1) << "Failed to delete shortcut at location "
+ << user_shortcut_locations[i];
+ }
}
// TODO(rlp): Cleanup profiles shortcuts.
- if (!ShellUtil::RemoveChromeShortcut(
- ShellUtil::SHORTCUT_QUICK_LAUNCH, dist, chrome_exe.value(),
- ShellUtil::CURRENT_USER, NULL)) {
- VLOG(1) << "Failed to delete quick launch shortcut.";
- }
} else {
NOTREACHED();
}
diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc
index 88a462d..ce1716a 100644
--- a/chrome/browser/first_run/first_run.cc
+++ b/chrome/browser/first_run/first_run.cc
@@ -147,7 +147,6 @@ int ImportFromFile(Profile* profile, const CommandLine& cmdline) {
namespace first_run {
namespace internal {
-const char* const kSentinelFile = "First Run";
FirstRunState first_run_ = FIRST_RUN_UNKNOWN;
installer::MasterPreferences* LoadMasterPrefs(FilePath* master_prefs_path)
diff --git a/chrome/browser/first_run/first_run_posix.cc b/chrome/browser/first_run/first_run_posix.cc
index 6724ec2..bf81cbb 100644
--- a/chrome/browser/first_run/first_run_posix.cc
+++ b/chrome/browser/first_run/first_run_posix.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/importer/importer_progress_dialog.h"
#include "chrome/browser/importer/importer_progress_observer.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/installer/util/master_preferences.h"
#include "chrome/installer/util/master_preferences_constants.h"
@@ -66,7 +67,7 @@ bool GetFirstRunSentinelFilePath(FilePath* path) {
if (!PathService::Get(chrome::DIR_USER_DATA, &first_run_sentinel))
return false;
- *path = first_run_sentinel.AppendASCII(kSentinelFile);
+ *path = first_run_sentinel.Append(chrome::kFirstRunSentinel);
return true;
}
diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc
index 851c979..4fede553 100644
--- a/chrome/browser/first_run/first_run_win.cc
+++ b/chrome/browser/first_run/first_run_win.cc
@@ -31,6 +31,7 @@
#include "chrome/browser/process_singleton.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/shell_integration.h"
+#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_result_codes.h"
@@ -102,46 +103,6 @@ class FirstRunDelayedTasks : public content::NotificationObserver {
content::NotificationRegistrar registrar_;
};
-// Creates the desktop shortcut to chrome for the current user. Returns
-// false if it fails. It will overwrite the shortcut if it exists.
-bool CreateChromeDesktopShortcut() {
- FilePath chrome_exe;
- if (!PathService::Get(base::FILE_EXE, &chrome_exe))
- return false;
- BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- if (!dist || !dist->CanCreateDesktopShortcuts())
- return false;
- ShellUtil::ChromeShortcutProperties shortcut_properties(
- ShellUtil::CURRENT_USER);
- shortcut_properties.set_chrome_exe(chrome_exe);
- return ShellUtil::CreateOrUpdateChromeShortcut(
- ShellUtil::SHORTCUT_DESKTOP, dist, shortcut_properties,
- ShellUtil::SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL);
-}
-
-// Creates the quick launch shortcut to chrome for the current user. Returns
-// false if it fails. It will overwrite the shortcut if it exists.
-bool CreateChromeQuickLaunchShortcut() {
- FilePath chrome_exe;
- if (!PathService::Get(base::FILE_EXE, &chrome_exe))
- return false;
- BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- ShellUtil::ChromeShortcutProperties shortcut_properties(
- ShellUtil::CURRENT_USER);
- shortcut_properties.set_chrome_exe(chrome_exe);
- return ShellUtil::CreateOrUpdateChromeShortcut(
- ShellUtil::SHORTCUT_QUICK_LAUNCH, dist, shortcut_properties,
- ShellUtil::SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL);
-}
-
-void PlatformSetup(Profile* profile) {
- CreateChromeDesktopShortcut();
-
- // Windows 7 has deprecated the quick launch bar.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- CreateChromeQuickLaunchShortcut();
-}
-
// Launches the setup exe with the given parameter/value on the command-line.
// For non-metro Windows, it waits for its termination, returns its exit code
// in |*ret_code|, and returns true if the exit code is valid.
@@ -511,7 +472,7 @@ bool ImportSettings(Profile* profile,
bool GetFirstRunSentinelFilePath(FilePath* path) {
return InstallUtil::GetSentinelFilePath(
- kSentinelFile,
+ chrome::kFirstRunSentinel,
BrowserDistribution::GetDistribution(),
path);
}
@@ -573,8 +534,6 @@ void AutoImport(
// discarded, which is the correct behavior during the import process.
process_singleton->Lock(NULL);
- PlatformSetup(profile);
-
scoped_refptr<ImporterHost> importer_host;
importer_host = new ImporterHost;