summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authorjoaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-07 12:30:19 +0000
committerjoaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-07 12:30:19 +0000
commitd1630ac3b8f7a6087a50758e2125a4a8b1f1f662 (patch)
tree8c52baadd4363430d13eba558e5e3b0ef8d3f6ec /chrome/installer
parent672c8c1e10e9b8f8b3416ed812cdfeae16005505 (diff)
downloadchromium_src-d1630ac3b8f7a6087a50758e2125a4a8b1f1f662.zip
chromium_src-d1630ac3b8f7a6087a50758e2125a4a8b1f1f662.tar.gz
chromium_src-d1630ac3b8f7a6087a50758e2125a4a8b1f1f662.tar.bz2
Added master_preferences to control shortcuts on windows.
do_not_create_taskbar_shortcut prevents pinning the start menu shortcut to the taskbar on windows 7 and later. do_not_create_any_shortcuts is a catch-all that prevents the creation of all shortcuts, including the start menu shortcut. BUG=178076,174465 Review URL: https://chromiumcodereview.appspot.com/12316097 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186681 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/setup/install.cc16
-rw-r--r--chrome/installer/util/master_preferences_constants.cc2
-rw-r--r--chrome/installer/util/master_preferences_constants.h6
-rw-r--r--chrome/installer/util/master_preferences_unittest.cc22
4 files changed, 43 insertions, 3 deletions
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index f477080..f64ed8e 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -360,14 +360,23 @@ void CreateOrUpdateShortcuts(
const MasterPreferences& prefs,
InstallShortcutLevel install_level,
InstallShortcutOperation install_operation) {
+ bool do_not_create_any_shortcuts = false;
+ prefs.GetBool(master_preferences::kDoNotCreateAnyShortcuts,
+ &do_not_create_any_shortcuts);
+ if (do_not_create_any_shortcuts)
+ return;
+
// Extract shortcut preferences from |prefs|.
bool do_not_create_desktop_shortcut = false;
bool do_not_create_quick_launch_shortcut = false;
+ bool do_not_create_taskbar_shortcut = false;
bool alternate_desktop_shortcut = false;
prefs.GetBool(master_preferences::kDoNotCreateDesktopShortcut,
&do_not_create_desktop_shortcut);
prefs.GetBool(master_preferences::kDoNotCreateQuickLaunchShortcut,
&do_not_create_quick_launch_shortcut);
+ prefs.GetBool(master_preferences::kDoNotCreateTaskbarShortcut,
+ &do_not_create_taskbar_shortcut);
prefs.GetBool(master_preferences::kAltShortcutText,
&alternate_desktop_shortcut);
@@ -435,9 +444,10 @@ void CreateOrUpdateShortcuts(
// shortcut in the Start menu (Start screen on Win8+) should be made dual
// mode.
start_menu_properties.set_dual_mode(true);
- if (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS ||
- shortcut_operation ==
- ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL) {
+ if (!do_not_create_taskbar_shortcut &&
+ (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS ||
+ shortcut_operation ==
+ ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)) {
start_menu_properties.set_pin_to_taskbar(true);
}
ExecuteAndLogShortcutOperation(ShellUtil::SHORTCUT_LOCATION_START_MENU,
diff --git a/chrome/installer/util/master_preferences_constants.cc b/chrome/installer/util/master_preferences_constants.cc
index bf53a29..cfcf3f9 100644
--- a/chrome/installer/util/master_preferences_constants.cc
+++ b/chrome/installer/util/master_preferences_constants.cc
@@ -26,9 +26,11 @@ namespace master_preferences {
const char kDistroImportSearchPref[] = "import_search_engine";
const char kDistroPingDelay[] = "ping_delay";
const char kDistroSuppressFirstRunBubble[] = "suppress_first_run_bubble";
+ const char kDoNotCreateAnyShortcuts[] = "do_not_create_any_shortcuts";
const char kDoNotCreateDesktopShortcut[] = "do_not_create_desktop_shortcut";
const char kDoNotCreateQuickLaunchShortcut[] =
"do_not_create_quick_launch_shortcut";
+ const char kDoNotCreateTaskbarShortcut[] = "do_not_create_taskbar_shortcut";
const char kDoNotLaunchChrome[] = "do_not_launch_chrome";
const char kDoNotRegisterForUpdateLaunch[] =
"do_not_register_for_update_launch";
diff --git a/chrome/installer/util/master_preferences_constants.h b/chrome/installer/util/master_preferences_constants.h
index 6bfee0a..c4ae615 100644
--- a/chrome/installer/util/master_preferences_constants.h
+++ b/chrome/installer/util/master_preferences_constants.h
@@ -57,12 +57,18 @@ extern const char kDistroImportSearchPref[];
extern const char kDistroPingDelay[];
// Boolean. Do not show first run bubble, even if it would otherwise be shown.
extern const char kDistroSuppressFirstRunBubble[];
+// Boolean. Prevent creation of all shortcuts to chrome, including the
+// desktop, quick launch, taskbar and the start menu shortcuts.
+extern const char kDoNotCreateAnyShortcuts[];
// Boolean. Prevent creation of the Desktop shortcut on install (and later on
// Active Setup for each user on a system-level install).
extern const char kDoNotCreateDesktopShortcut[];
// Boolean. Prevent creation of the Quick Launch shortcut on install (and later
// on Active Setup for each user on a system-level install).
extern const char kDoNotCreateQuickLaunchShortcut[];
+// Boolean. Prevent creation of the Taskbar (since Windows 7) shortcut on
+// install (and later on Active Setup for each user on a system-level install).
+extern const char kDoNotCreateTaskbarShortcut[];
// Boolean. Do not launch Chrome after first install. Cmd line override present.
extern const char kDoNotLaunchChrome[];
// Boolean. Do not register with Google Update to have Chrome launched after
diff --git a/chrome/installer/util/master_preferences_unittest.cc b/chrome/installer/util/master_preferences_unittest.cc
index 9f756af..276470c 100644
--- a/chrome/installer/util/master_preferences_unittest.cc
+++ b/chrome/installer/util/master_preferences_unittest.cc
@@ -56,8 +56,10 @@ TEST_F(MasterPreferencesTest, ParseDistroParams) {
" \"import_bookmarks\": true,\n"
" \"import_bookmarks_from_file\": \"c:\\\\foo\",\n"
" \"import_home_page\": true,\n"
+ " \"do_not_create_any_shortcuts\": true,\n"
" \"do_not_create_desktop_shortcut\": true,\n"
" \"do_not_create_quick_launch_shortcut\": true,\n"
+ " \"do_not_create_taskbar_shortcut\": true,\n"
" \"do_not_launch_chrome\": true,\n"
" \"make_chrome_default\": true,\n"
" \"make_chrome_default_for_user\": true,\n"
@@ -82,8 +84,10 @@ TEST_F(MasterPreferencesTest, ParseDistroParams) {
installer::master_preferences::kDistroImportHistoryPref,
installer::master_preferences::kDistroImportBookmarksPref,
installer::master_preferences::kDistroImportHomePagePref,
+ installer::master_preferences::kDoNotCreateAnyShortcuts,
installer::master_preferences::kDoNotCreateDesktopShortcut,
installer::master_preferences::kDoNotCreateQuickLaunchShortcut,
+ installer::master_preferences::kDoNotCreateTaskbarShortcut,
installer::master_preferences::kDoNotLaunchChrome,
installer::master_preferences::kMakeChromeDefault,
installer::master_preferences::kMakeChromeDefaultForUser,
@@ -358,14 +362,22 @@ TEST_F(MasterPreferencesTest, EnforceLegacyCreateAllShortcutsFalse) {
bool do_not_create_desktop_shortcut = false;
bool do_not_create_quick_launch_shortcut = false;
+ bool do_not_create_taskbar_shortcut = false;
prefs.GetBool(
installer::master_preferences::kDoNotCreateDesktopShortcut,
&do_not_create_desktop_shortcut);
prefs.GetBool(
installer::master_preferences::kDoNotCreateQuickLaunchShortcut,
&do_not_create_quick_launch_shortcut);
+ prefs.GetBool(
+ installer::master_preferences::kDoNotCreateTaskbarShortcut,
+ &do_not_create_taskbar_shortcut);
+ // create_all_shortcuts is a legacy preference that should only enforce
+ // do_not_create_desktop_shortcut and do_not_create_quick_launch_shortcut
+ // when set to false.
EXPECT_TRUE(do_not_create_desktop_shortcut);
EXPECT_TRUE(do_not_create_quick_launch_shortcut);
+ EXPECT_FALSE(do_not_create_taskbar_shortcut);
}
TEST_F(MasterPreferencesTest, DontEnforceLegacyCreateAllShortcutsTrue) {
@@ -380,14 +392,19 @@ TEST_F(MasterPreferencesTest, DontEnforceLegacyCreateAllShortcutsTrue) {
bool do_not_create_desktop_shortcut = false;
bool do_not_create_quick_launch_shortcut = false;
+ bool do_not_create_taskbar_shortcut = false;
prefs.GetBool(
installer::master_preferences::kDoNotCreateDesktopShortcut,
&do_not_create_desktop_shortcut);
prefs.GetBool(
installer::master_preferences::kDoNotCreateQuickLaunchShortcut,
&do_not_create_quick_launch_shortcut);
+ prefs.GetBool(
+ installer::master_preferences::kDoNotCreateTaskbarShortcut,
+ &do_not_create_taskbar_shortcut);
EXPECT_FALSE(do_not_create_desktop_shortcut);
EXPECT_FALSE(do_not_create_quick_launch_shortcut);
+ EXPECT_FALSE(do_not_create_taskbar_shortcut);
}
TEST_F(MasterPreferencesTest, DontEnforceLegacyCreateAllShortcutsNotSpecified) {
@@ -402,12 +419,17 @@ TEST_F(MasterPreferencesTest, DontEnforceLegacyCreateAllShortcutsNotSpecified) {
bool do_not_create_desktop_shortcut = false;
bool do_not_create_quick_launch_shortcut = false;
+ bool do_not_create_taskbar_shortcut = false;
prefs.GetBool(
installer::master_preferences::kDoNotCreateDesktopShortcut,
&do_not_create_desktop_shortcut);
prefs.GetBool(
installer::master_preferences::kDoNotCreateQuickLaunchShortcut,
&do_not_create_quick_launch_shortcut);
+ prefs.GetBool(
+ installer::master_preferences::kDoNotCreateTaskbarShortcut,
+ &do_not_create_taskbar_shortcut);
EXPECT_FALSE(do_not_create_desktop_shortcut);
EXPECT_FALSE(do_not_create_quick_launch_shortcut);
+ EXPECT_FALSE(do_not_create_taskbar_shortcut);
}