Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(807)

Side by Side Diff: chrome/browser/shell_integration_win.cc

Issue 10914109: Refactoring and tests for the highly undertested file_util::CreateOrUpdateShortcutLink() method. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better path matching Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/shell_integration.h" 5 #include "chrome/browser/shell_integration.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shobjidl.h> 8 #include <shobjidl.h>
9 #include <propkey.h> 9 #include <propkey.h>
10 #include <propvarutil.h> 10 #include <propvarutil.h>
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 string16 expected_app_id; 329 string16 expected_app_id;
330 if (!GetExpectedAppId(chrome_exe, shell_link, &expected_app_id) || 330 if (!GetExpectedAppId(chrome_exe, shell_link, &expected_app_id) ||
331 expected_app_id.empty()) 331 expected_app_id.empty())
332 continue; 332 continue;
333 333
334 // Get existing app id from shortcut if any. 334 // Get existing app id from shortcut if any.
335 string16 existing_app_id; 335 string16 existing_app_id;
336 GetShortcutAppId(shell_link, &existing_app_id); 336 GetShortcutAppId(shell_link, &existing_app_id);
337 337
338 if (expected_app_id != existing_app_id) { 338 if (expected_app_id != existing_app_id) {
339 file_util::CreateOrUpdateShortcutLink(NULL, shortcut.value().c_str(), 339 file_util::ShortcutProperties properties_app_id_only;
340 NULL, NULL, NULL, NULL, 0, 340 properties_app_id_only.set_app_id(expected_app_id);
341 expected_app_id.c_str(), 341 file_util::CreateOrUpdateShortcutLink(
342 file_util::SHORTCUT_NO_OPTIONS); 342 shortcut.value().c_str(), properties_app_id_only,
343 file_util::SHORTCUT_UPDATE_EXISTING);
343 } 344 }
344 } 345 }
345 } 346 }
346 347
347 void MigrateChromiumShortcutsCallback() { 348 void MigrateChromiumShortcutsCallback() {
348 // This should run on the file thread. 349 // This should run on the file thread.
349 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 350 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
350 351
351 // Get full path of chrome. 352 // Get full path of chrome.
352 FilePath chrome_exe; 353 FilePath chrome_exe;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 continue; 585 continue;
585 } 586 }
586 587
587 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + L".lnk"); 588 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + L".lnk");
588 if (file_util::PathExists(shortcut)) 589 if (file_util::PathExists(shortcut))
589 return shortcut; 590 return shortcut;
590 } 591 }
591 592
592 return FilePath(); 593 return FilePath();
593 } 594 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698