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 <shlobj.h> | 7 #include <shlobj.h> |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 // Creates the desktop shortcut to chrome for the current user. Returns | 102 // Creates the desktop shortcut to chrome for the current user. Returns |
103 // false if it fails. It will overwrite the shortcut if it exists. | 103 // false if it fails. It will overwrite the shortcut if it exists. |
104 bool CreateChromeDesktopShortcut() { | 104 bool CreateChromeDesktopShortcut() { |
105 FilePath chrome_exe; | 105 FilePath chrome_exe; |
106 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) | 106 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) |
107 return false; | 107 return false; |
108 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 108 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
109 if (!dist || !dist->CanCreateDesktopShortcuts()) | 109 if (!dist || !dist->CanCreateDesktopShortcuts()) |
110 return false; | 110 return false; |
111 return ShellUtil::CreateChromeDesktopShortcut( | 111 return ShellUtil::CreateOrUpdateChromeShortcut( |
| 112 ShellUtil::SHORTCUT_DESKTOP, |
112 dist, | 113 dist, |
113 chrome_exe.value(), | 114 chrome_exe.value(), |
114 dist->GetAppDescription(), | 115 dist->GetAppDescription(), |
115 L"", | 116 string16(), |
116 L"", | 117 string16(), |
117 chrome_exe.value(), | 118 chrome_exe.value(), |
118 dist->GetIconIndex(), | 119 dist->GetIconIndex(), |
119 ShellUtil::CURRENT_USER, | |
120 ShellUtil::SHORTCUT_CREATE_ALWAYS); | 120 ShellUtil::SHORTCUT_CREATE_ALWAYS); |
121 } | 121 } |
122 | 122 |
123 // Creates the quick launch shortcut to chrome for the current user. Returns | 123 // Creates the quick launch shortcut to chrome for the current user. Returns |
124 // false if it fails. It will overwrite the shortcut if it exists. | 124 // false if it fails. It will overwrite the shortcut if it exists. |
125 bool CreateChromeQuickLaunchShortcut() { | 125 bool CreateChromeQuickLaunchShortcut() { |
126 FilePath chrome_exe; | 126 FilePath chrome_exe; |
127 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) | 127 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) |
128 return false; | 128 return false; |
129 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 129 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
130 return ShellUtil::CreateChromeQuickLaunchShortcut( | 130 return ShellUtil::CreateOrUpdateChromeShortcut( |
| 131 ShellUtil::SHORTCUT_QUICK_LAUNCH, |
131 dist, | 132 dist, |
132 chrome_exe.value(), | 133 chrome_exe.value(), |
133 ShellUtil::CURRENT_USER, // create only for current user. | 134 dist->GetAppDescription(), |
| 135 string16(), |
| 136 string16(), |
| 137 chrome_exe.value(), |
| 138 dist->GetIconIndex(), |
134 ShellUtil::SHORTCUT_CREATE_ALWAYS); | 139 ShellUtil::SHORTCUT_CREATE_ALWAYS); |
135 } | 140 } |
136 | 141 |
137 void PlatformSetup(Profile* profile) { | 142 void PlatformSetup(Profile* profile) { |
138 if (CreateChromeDesktopShortcut()) | 143 if (CreateChromeDesktopShortcut()) |
139 profile->GetPrefs()->SetBoolean(prefs::kProfileShortcutCreated, true); | 144 profile->GetPrefs()->SetBoolean(prefs::kProfileShortcutCreated, true); |
140 | 145 |
141 // Windows 7 has deprecated the quick launch bar. | 146 // Windows 7 has deprecated the quick launch bar. |
142 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 147 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
143 CreateChromeQuickLaunchShortcut(); | 148 CreateChromeQuickLaunchShortcut(); |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 return false; | 615 return false; |
611 | 616 |
612 internal::SetShowWelcomePagePrefIfNeeded(install_prefs.get()); | 617 internal::SetShowWelcomePagePrefIfNeeded(install_prefs.get()); |
613 internal::SetImportPreferencesAndLaunchImport(out_prefs, install_prefs.get()); | 618 internal::SetImportPreferencesAndLaunchImport(out_prefs, install_prefs.get()); |
614 internal::SetDefaultBrowser(install_prefs.get()); | 619 internal::SetDefaultBrowser(install_prefs.get()); |
615 | 620 |
616 return false; | 621 return false; |
617 } | 622 } |
618 | 623 |
619 } // namespace first_run | 624 } // namespace first_run |
OLD | NEW |