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 "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/install_util.h" | |
| 14 | 15 |
| 15 void CheckHR(HRESULT hr, const char* message) { | 16 void CheckHR(HRESULT hr, const char* message) { |
| 16 if (FAILED(hr)) { | 17 if (FAILED(hr)) { |
| 17 if (message) | 18 if (message) |
| 18 PLOG(DFATAL) << message << ", hr = " << std::hex << hr; | 19 PLOG(DFATAL) << message << ", hr = " << std::hex << hr; |
| 19 else | 20 else |
| 20 PLOG(DFATAL) << "COM ERROR" << ", hr = " << std::hex << hr; | 21 PLOG(DFATAL) << "COM ERROR" << ", hr = " << std::hex << hr; |
| 21 } | 22 } |
| 22 } | 23 } |
| 23 | 24 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 | 201 |
| 201 string16 ReadArgumentsFromPinnedTaskbarShortcut() { | 202 string16 ReadArgumentsFromPinnedTaskbarShortcut() { |
| 202 wchar_t path_buffer[MAX_PATH] = {}; | 203 wchar_t path_buffer[MAX_PATH] = {}; |
| 203 | 204 |
| 204 if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, | 205 if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, |
| 205 SHGFP_TYPE_CURRENT, path_buffer))) { | 206 SHGFP_TYPE_CURRENT, path_buffer))) { |
| 206 base::FilePath shortcut(path_buffer); | 207 base::FilePath shortcut(path_buffer); |
| 207 shortcut = shortcut.Append( | 208 shortcut = shortcut.Append( |
| 208 L"Microsoft\\Internet Explorer\\Quick Launch\\User Pinned\\TaskBar"); | 209 L"Microsoft\\Internet Explorer\\Quick Launch\\User Pinned\\TaskBar"); |
| 209 | 210 |
| 210 // TODO(robertshield): Get this stuff from BrowserDistribution. | 211 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 211 #if defined(GOOGLE_CHROME_BUILD) | 212 base::string16 link_name = dist->GetShortcutName( |
| 212 shortcut = shortcut.Append(L"Google Chrome.lnk"); | 213 BrowserDistribution::SHORTCUT_CHROME); |
| 213 #else | 214 link_name.append(installer::kLnkExt); |
|
gab
2013/09/06 18:40:08
I think it's fine to do this inline above (i.e. Ge
zturner
2013/09/06 20:53:16
Done.
| |
| 214 shortcut = shortcut.Append(L"Chromium.lnk"); | 215 shortcut = shortcut.Append(link_name); |
| 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 |