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/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 COMPARE_ATOMIC_PROPERTY_VALUES(UInt64, UINT64); | 173 COMPARE_ATOMIC_PROPERTY_VALUES(UInt64, UINT64); |
174 break; | 174 break; |
175 } | 175 } |
176 default: { | 176 default: { |
177 hr = E_NOTIMPL; | 177 hr = E_NOTIMPL; |
178 } | 178 } |
179 } | 179 } |
180 return hr; | 180 return hr; |
181 } | 181 } |
182 | 182 |
183 bool GetArgumentsFromShortcut(const FilePath& shortcut, | 183 bool GetArgumentsFromShortcut(const base::FilePath& shortcut, |
184 string16* arguments) { | 184 string16* arguments) { |
185 HRESULT result; | 185 HRESULT result; |
186 base::win::ScopedComPtr<IShellLink> i_shell_link; | 186 base::win::ScopedComPtr<IShellLink> i_shell_link; |
187 bool is_resolved = false; | 187 bool is_resolved = false; |
188 | 188 |
189 | 189 |
190 base::win::ScopedCOMInitializer sta_com_initializer; | 190 base::win::ScopedCOMInitializer sta_com_initializer; |
191 | 191 |
192 // Get pointer to the IShellLink interface | 192 // Get pointer to the IShellLink interface |
193 result = i_shell_link.CreateInstance(CLSID_ShellLink, NULL, | 193 result = i_shell_link.CreateInstance(CLSID_ShellLink, NULL, |
(...skipping 15 matching lines...) Expand all Loading... |
209 } | 209 } |
210 | 210 |
211 return is_resolved; | 211 return is_resolved; |
212 } | 212 } |
213 | 213 |
214 string16 ReadArgumentsFromPinnedTaskbarShortcut() { | 214 string16 ReadArgumentsFromPinnedTaskbarShortcut() { |
215 wchar_t path_buffer[MAX_PATH] = {}; | 215 wchar_t path_buffer[MAX_PATH] = {}; |
216 | 216 |
217 if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, | 217 if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, |
218 SHGFP_TYPE_CURRENT, path_buffer))) { | 218 SHGFP_TYPE_CURRENT, path_buffer))) { |
219 FilePath shortcut(path_buffer); | 219 base::FilePath shortcut(path_buffer); |
220 shortcut = shortcut.Append( | 220 shortcut = shortcut.Append( |
221 L"Microsoft\\Internet Explorer\\Quick Launch\\User Pinned\\TaskBar"); | 221 L"Microsoft\\Internet Explorer\\Quick Launch\\User Pinned\\TaskBar"); |
222 | 222 |
223 // TODO(robertshield): Get this stuff from BrowserDistribution. | 223 // TODO(robertshield): Get this stuff from BrowserDistribution. |
224 #if defined(GOOGLE_CHROME_BUILD) | 224 #if defined(GOOGLE_CHROME_BUILD) |
225 shortcut = shortcut.Append(L"Google Chrome.lnk"); | 225 shortcut = shortcut.Append(L"Google Chrome.lnk"); |
226 #else | 226 #else |
227 shortcut = shortcut.Append(L"Chromium.lnk"); | 227 shortcut = shortcut.Append(L"Chromium.lnk"); |
228 #endif | 228 #endif |
229 | 229 |
230 string16 arguments; | 230 string16 arguments; |
231 if (GetArgumentsFromShortcut(shortcut, &arguments)) { | 231 if (GetArgumentsFromShortcut(shortcut, &arguments)) { |
232 return arguments; | 232 return arguments; |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 return L""; | 236 return L""; |
237 } | 237 } |
238 | 238 |
239 HWND FindCoreWindow(DWORD thread_id, int wait_ms) { | 239 HWND FindCoreWindow(DWORD thread_id, int wait_ms) { |
240 HWND window = NULL; | 240 HWND window = NULL; |
241 do { | 241 do { |
242 ::Sleep(wait_ms); | 242 ::Sleep(wait_ms); |
243 ::EnumThreadWindows(thread_id, &CoreWindowFinder, LPARAM(&window)); | 243 ::EnumThreadWindows(thread_id, &CoreWindowFinder, LPARAM(&window)); |
244 } while (window == NULL); | 244 } while (window == NULL); |
245 return window; | 245 return window; |
246 } | 246 } |
247 | 247 |
248 } // namespace winrt_utils | 248 } // namespace winrt_utils |
OLD | NEW |