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 "stdafx.h" | 5 #include "stdafx.h" |
6 #include "winrt_utils.h" | 6 #include "winrt_utils.h" |
7 | 7 |
8 #include <shlobj.h> | 8 #include <shlobj.h> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/win/scoped_com_initializer.h" | 12 #include "base/win/scoped_com_initializer.h" |
13 #include "base/win/scoped_comptr.h" | 13 #include "base/win/scoped_comptr.h" |
| 14 #include "chrome/installer/util/browser_distribution.h" |
| 15 #include "chrome/installer/util/install_util.h" |
14 | 16 |
15 void CheckHR(HRESULT hr, const char* message) { | 17 void CheckHR(HRESULT hr, const char* message) { |
16 if (FAILED(hr)) { | 18 if (FAILED(hr)) { |
17 if (message) | 19 if (message) |
18 PLOG(DFATAL) << message << ", hr = " << std::hex << hr; | 20 PLOG(DFATAL) << message << ", hr = " << std::hex << hr; |
19 else | 21 else |
20 PLOG(DFATAL) << "COM ERROR" << ", hr = " << std::hex << hr; | 22 PLOG(DFATAL) << "COM ERROR" << ", hr = " << std::hex << hr; |
21 } | 23 } |
22 } | 24 } |
23 | 25 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 202 |
201 string16 ReadArgumentsFromPinnedTaskbarShortcut() { | 203 string16 ReadArgumentsFromPinnedTaskbarShortcut() { |
202 wchar_t path_buffer[MAX_PATH] = {}; | 204 wchar_t path_buffer[MAX_PATH] = {}; |
203 | 205 |
204 if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, | 206 if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, |
205 SHGFP_TYPE_CURRENT, path_buffer))) { | 207 SHGFP_TYPE_CURRENT, path_buffer))) { |
206 base::FilePath shortcut(path_buffer); | 208 base::FilePath shortcut(path_buffer); |
207 shortcut = shortcut.Append( | 209 shortcut = shortcut.Append( |
208 L"Microsoft\\Internet Explorer\\Quick Launch\\User Pinned\\TaskBar"); | 210 L"Microsoft\\Internet Explorer\\Quick Launch\\User Pinned\\TaskBar"); |
209 | 211 |
210 // TODO(robertshield): Get this stuff from BrowserDistribution. | 212 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
211 #if defined(GOOGLE_CHROME_BUILD) | 213 base::string16 link_name = dist->GetShortcutName( |
212 shortcut = shortcut.Append(L"Google Chrome.lnk"); | 214 BrowserDistribution::SHORTCUT_CHROME) + installer::kLnkExt; |
213 #else | 215 shortcut = shortcut.Append(link_name); |
214 shortcut = shortcut.Append(L"Chromium.lnk"); | |
215 #endif | |
216 | 216 |
217 string16 arguments; | 217 string16 arguments; |
218 if (GetArgumentsFromShortcut(shortcut, &arguments)) { | 218 if (GetArgumentsFromShortcut(shortcut, &arguments)) { |
219 return arguments; | 219 return arguments; |
220 } | 220 } |
221 } | 221 } |
222 | 222 |
223 return L""; | 223 return L""; |
224 } | 224 } |
225 | 225 |
226 } // namespace winrt_utils | 226 } // namespace winrt_utils |
OLD | NEW |