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 shortcut_properties( |
115 dist, | 115 ShellUtil::CURRENT_USER); |
116 chrome_exe.value(), | 116 shortcut_properties.set_chrome_exe(chrome_exe); |
117 dist->GetAppDescription(), | 117 return ShellUtil::CreateOrUpdateChromeShortcut( |
118 L"", | 118 ShellUtil::SHORTCUT_DESKTOP, dist, shortcut_properties, |
119 L"", | 119 ShellUtil::SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL); |
120 chrome_exe.value(), | |
121 dist->GetIconIndex(), | |
122 ShellUtil::CURRENT_USER, | |
123 ShellUtil::SHORTCUT_CREATE_ALWAYS); | |
124 } | 120 } |
125 | 121 |
126 // Creates the quick launch shortcut to chrome for the current user. Returns | 122 // 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. | 123 // false if it fails. It will overwrite the shortcut if it exists. |
128 bool CreateChromeQuickLaunchShortcut() { | 124 bool CreateChromeQuickLaunchShortcut() { |
129 FilePath chrome_exe; | 125 FilePath chrome_exe; |
130 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) | 126 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) |
131 return false; | 127 return false; |
132 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 128 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
133 return ShellUtil::CreateChromeQuickLaunchShortcut( | 129 ShellUtil::ChromeShortcutProperties shortcut_properties( |
134 dist, | 130 ShellUtil::CURRENT_USER); |
135 chrome_exe.value(), | 131 shortcut_properties.set_chrome_exe(chrome_exe); |
136 ShellUtil::CURRENT_USER, // create only for current user. | 132 return ShellUtil::CreateOrUpdateChromeShortcut( |
137 ShellUtil::SHORTCUT_CREATE_ALWAYS); | 133 ShellUtil::SHORTCUT_QUICK_LAUNCH, dist, shortcut_properties, |
| 134 ShellUtil::SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL); |
138 } | 135 } |
139 | 136 |
140 void PlatformSetup(Profile* profile) { | 137 void PlatformSetup(Profile* profile) { |
141 CreateChromeDesktopShortcut(); | 138 CreateChromeDesktopShortcut(); |
142 | 139 |
143 // Windows 7 has deprecated the quick launch bar. | 140 // Windows 7 has deprecated the quick launch bar. |
144 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 141 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
145 CreateChromeQuickLaunchShortcut(); | 142 CreateChromeQuickLaunchShortcut(); |
146 } | 143 } |
147 | 144 |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 return SKIP_FIRST_RUN; | 643 return SKIP_FIRST_RUN; |
647 | 644 |
648 internal::SetShowWelcomePagePrefIfNeeded(install_prefs.get()); | 645 internal::SetShowWelcomePagePrefIfNeeded(install_prefs.get()); |
649 internal::SetImportPreferencesAndLaunchImport(out_prefs, install_prefs.get()); | 646 internal::SetImportPreferencesAndLaunchImport(out_prefs, install_prefs.get()); |
650 internal::SetDefaultBrowser(install_prefs.get()); | 647 internal::SetDefaultBrowser(install_prefs.get()); |
651 | 648 |
652 return SKIP_FIRST_RUN; | 649 return SKIP_FIRST_RUN; |
653 } | 650 } |
654 | 651 |
655 } // namespace first_run | 652 } // namespace first_run |
OLD | NEW |