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

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: 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 string16 expected_app_id; 331 string16 expected_app_id;
332 if (!GetExpectedAppId(chrome_exe, shell_link, &expected_app_id) || 332 if (!GetExpectedAppId(chrome_exe, shell_link, &expected_app_id) ||
333 expected_app_id.empty()) 333 expected_app_id.empty())
334 continue; 334 continue;
335 335
336 // Get existing app id from shortcut if any. 336 // Get existing app id from shortcut if any.
337 string16 existing_app_id; 337 string16 existing_app_id;
338 GetShortcutAppId(shell_link, &existing_app_id); 338 GetShortcutAppId(shell_link, &existing_app_id);
339 339
340 if (expected_app_id != existing_app_id) { 340 if (expected_app_id != existing_app_id) {
341 file_util::CreateOrUpdateShortcutLink(NULL, shortcut.value().c_str(), 341 file_util::ShortcutProperties properties_app_id_only;
342 NULL, NULL, NULL, NULL, 0, 342 properties_app_id_only.set_app_id(expected_app_id);
343 expected_app_id.c_str(), 343 file_util::CreateOrUpdateShortcutLink(
344 file_util::SHORTCUT_NO_OPTIONS); 344 shortcut.value().c_str(), properties_app_id_only,
345 file_util::SHORTCUT_UPDATE_EXISTING);
345 } 346 }
346 } 347 }
347 } 348 }
348 349
349 void MigrateChromiumShortcutsCallback() { 350 void MigrateChromiumShortcutsCallback() {
350 // This should run on the file thread. 351 // This should run on the file thread.
351 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 352 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
352 353
353 // Get full path of chrome. 354 // Get full path of chrome.
354 FilePath chrome_exe; 355 FilePath chrome_exe;
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 continue; 633 continue;
633 } 634 }
634 635
635 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + L".lnk"); 636 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + L".lnk");
636 if (file_util::PathExists(shortcut)) 637 if (file_util::PathExists(shortcut))
637 return shortcut; 638 return shortcut;
638 } 639 }
639 640
640 return FilePath(); 641 return FilePath();
641 } 642 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698