Chromium Code Reviews| OLD | NEW |
|---|---|
| 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.h" | 5 #include "chrome/browser/first_run/first_run.h" |
| 6 | 6 |
| 7 #include <shellapi.h> | 7 #include <shellapi.h> |
| 8 #include <shlobj.h> | 8 #include <shlobj.h> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 | 10 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 | 104 |
| 105 // Creates the desktop shortcut to chrome for the current user. Returns | 105 // Creates the desktop shortcut to chrome for the current user. Returns |
| 106 // false if it fails. It will overwrite the shortcut if it exists. | 106 // false if it fails. It will overwrite the shortcut if it exists. |
| 107 bool CreateChromeDesktopShortcut() { | 107 bool CreateChromeDesktopShortcut() { |
| 108 FilePath chrome_exe; | 108 FilePath chrome_exe; |
| 109 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) | 109 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) |
| 110 return false; | 110 return false; |
| 111 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 111 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 112 if (!dist || !dist->CanCreateDesktopShortcuts()) | 112 if (!dist || !dist->CanCreateDesktopShortcuts()) |
| 113 return false; | 113 return false; |
| 114 return ShellUtil::CreateChromeDesktopShortcut( | 114 ShellUtil::ChromeShortcutProperties properties(ShellUtil::CURRENT_USER); |
|
robertshield
2012/10/04 00:25:23
nit: vague preference for shortcut_properties over
gab
2012/10/04 04:10:32
Sure, although this makes the definition take 2 li
| |
| 115 dist, | 115 properties.set_chrome_exe(chrome_exe); |
| 116 chrome_exe.value(), | 116 return ShellUtil::CreateOrUpdateChromeShortcut( |
| 117 dist->GetAppDescription(), | 117 ShellUtil::SHORTCUT_DESKTOP, dist, properties, |
| 118 L"", | 118 ShellUtil::SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL); |
| 119 L"", | |
| 120 chrome_exe.value(), | |
| 121 dist->GetIconIndex(), | |
| 122 ShellUtil::CURRENT_USER, | |
| 123 ShellUtil::SHORTCUT_CREATE_ALWAYS); | |
| 124 } | 119 } |
| 125 | 120 |
| 126 // Creates the quick launch shortcut to chrome for the current user. Returns | 121 // Creates the quick launch shortcut to chrome for the current user. Returns |
| 127 // false if it fails. It will overwrite the shortcut if it exists. | 122 // false if it fails. It will overwrite the shortcut if it exists. |
| 128 bool CreateChromeQuickLaunchShortcut() { | 123 bool CreateChromeQuickLaunchShortcut() { |
| 129 FilePath chrome_exe; | 124 FilePath chrome_exe; |
| 130 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) | 125 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) |
| 131 return false; | 126 return false; |
| 132 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 127 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 133 return ShellUtil::CreateChromeQuickLaunchShortcut( | 128 ShellUtil::ChromeShortcutProperties properties(ShellUtil::CURRENT_USER); |
| 134 dist, | 129 properties.set_chrome_exe(chrome_exe); |
| 135 chrome_exe.value(), | 130 return ShellUtil::CreateOrUpdateChromeShortcut( |
| 136 ShellUtil::CURRENT_USER, // create only for current user. | 131 ShellUtil::SHORTCUT_QUICK_LAUNCH, dist, properties, |
| 137 ShellUtil::SHORTCUT_CREATE_ALWAYS); | 132 ShellUtil::SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL); |
| 138 } | 133 } |
| 139 | 134 |
| 140 void PlatformSetup(Profile* profile) { | 135 void PlatformSetup(Profile* profile) { |
| 141 CreateChromeDesktopShortcut(); | 136 CreateChromeDesktopShortcut(); |
| 142 | 137 |
| 143 // Windows 7 has deprecated the quick launch bar. | 138 // Windows 7 has deprecated the quick launch bar. |
| 144 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 139 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
| 145 CreateChromeQuickLaunchShortcut(); | 140 CreateChromeQuickLaunchShortcut(); |
| 146 } | 141 } |
| 147 | 142 |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 646 return SKIP_FIRST_RUN; | 641 return SKIP_FIRST_RUN; |
| 647 | 642 |
| 648 internal::SetShowWelcomePagePrefIfNeeded(install_prefs.get()); | 643 internal::SetShowWelcomePagePrefIfNeeded(install_prefs.get()); |
| 649 internal::SetImportPreferencesAndLaunchImport(out_prefs, install_prefs.get()); | 644 internal::SetImportPreferencesAndLaunchImport(out_prefs, install_prefs.get()); |
| 650 internal::SetDefaultBrowser(install_prefs.get()); | 645 internal::SetDefaultBrowser(install_prefs.get()); |
| 651 | 646 |
| 652 return SKIP_FIRST_RUN; | 647 return SKIP_FIRST_RUN; |
| 653 } | 648 } |
| 654 | 649 |
| 655 } // namespace first_run | 650 } // namespace first_run |
| OLD | NEW |