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

Side by Side Diff: base/file_util_win.cc

Issue 10889028: Install a user-level Start Menu shortcut for every user on system-installs through Active Setup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: grt comments 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
« no previous file with comments | « no previous file | chrome/installer/setup/install.h » ('j') | chrome/installer/setup/install.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/file_util.h" 5 #include "base/file_util.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <propvarutil.h> 8 #include <propvarutil.h>
9 #include <psapi.h> 9 #include <psapi.h>
10 #include <shellapi.h> 10 #include <shellapi.h>
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 if (app_id && !base::win::SetAppIdForPropertyStore(property_store, app_id)) 439 if (app_id && !base::win::SetAppIdForPropertyStore(property_store, app_id))
440 return false; 440 return false;
441 if (is_dual_mode && 441 if (is_dual_mode &&
442 !base::win::SetDualModeForPropertyStore(property_store)) { 442 !base::win::SetDualModeForPropertyStore(property_store)) {
443 return false; 443 return false;
444 } 444 }
445 } 445 }
446 446
447 HRESULT result = i_persist_file->Save(destination, TRUE); 447 HRESULT result = i_persist_file->Save(destination, TRUE);
448 448
449 // If we successfully updated the icon, notify the shell that we have done so. 449 // Release the interfaces in case the SHChangeNotify call below depends on
450 if (!create && SUCCEEDED(result)) { 450 // the operations above being fully completed.
451 // Release the interfaces in case the SHChangeNotify call below depends on 451 i_persist_file.Release();
452 // the operations above being fully completed. 452 i_shell_link.Release();
453 i_persist_file.Release();
454 i_shell_link.Release();
455 453
456 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); 454 // If we successfully created/updated the icon, notify the shell that we have
455 // done so.
456 const bool succeeded = SUCCEEDED(result);
457 if (succeeded) {
458 if (create) {
459 SHChangeNotify(SHCNE_CREATE, SHCNF_PATH, destination, NULL);
460 } else {
461 // TODO(gab): Only use SHCNE_ASSOCCHANGED when the icon changed.
462 // Otherwise a simple SHCNE_UPDATEITEM should be sufficient.
463 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
464 }
457 } 465 }
458 466
459 return SUCCEEDED(result); 467 return succeeded;
460 } 468 }
461 469
462 bool TaskbarPinShortcutLink(const wchar_t* shortcut) { 470 bool TaskbarPinShortcutLink(const wchar_t* shortcut) {
463 base::ThreadRestrictions::AssertIOAllowed(); 471 base::ThreadRestrictions::AssertIOAllowed();
464 472
465 // "Pin to taskbar" is only supported after Win7. 473 // "Pin to taskbar" is only supported after Win7.
466 if (base::win::GetVersion() < base::win::VERSION_WIN7) 474 if (base::win::GetVersion() < base::win::VERSION_WIN7)
467 return false; 475 return false;
468 476
469 int result = reinterpret_cast<int>(ShellExecute(NULL, L"taskbarpin", shortcut, 477 int result = reinterpret_cast<int>(ShellExecute(NULL, L"taskbarpin", shortcut,
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 HANDLE cp = GetCurrentProcess(); 1130 HANDLE cp = GetCurrentProcess();
1123 if (::GetMappedFileNameW(cp, file_view, mapped_file_path, kMaxPathLength)) { 1131 if (::GetMappedFileNameW(cp, file_view, mapped_file_path, kMaxPathLength)) {
1124 *nt_path = FilePath(mapped_file_path); 1132 *nt_path = FilePath(mapped_file_path);
1125 success = true; 1133 success = true;
1126 } 1134 }
1127 ::UnmapViewOfFile(file_view); 1135 ::UnmapViewOfFile(file_view);
1128 return success; 1136 return success;
1129 } 1137 }
1130 1138
1131 } // namespace file_util 1139 } // namespace file_util
OLDNEW
« no previous file with comments | « no previous file | chrome/installer/setup/install.h » ('j') | chrome/installer/setup/install.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698