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

Side by Side Diff: base/file_util_win.cc

Issue 10386167: Always do DelegateExecute handler COM registration and make set dual mode prop on shortcuts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | base/win/win_util.cc » ('j') | base/win/win_util.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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 return false; 409 return false;
410 410
411 if (description && FAILED(i_shell_link->SetDescription(description))) 411 if (description && FAILED(i_shell_link->SetDescription(description)))
412 return false; 412 return false;
413 413
414 if (icon && FAILED(i_shell_link->SetIconLocation(icon, icon_index))) 414 if (icon && FAILED(i_shell_link->SetIconLocation(icon, icon_index)))
415 return false; 415 return false;
416 416
417 bool is_dual_mode = (options & SHORTCUT_DUAL_MODE) != 0; 417 bool is_dual_mode = (options & SHORTCUT_DUAL_MODE) != 0;
418 if ((app_id || is_dual_mode) && 418 if ((app_id || is_dual_mode) &&
419 base::win::GetVersion() >= base::win::VERSION_WIN7) { 419 base::win::GetVersion() >= base::win::VERSION_WIN7) {
gab 2012/05/16 17:04:22 You probably also want to get rid of this to suppo
grt (UTC plus 2) 2012/05/16 17:16:16 Excellent point. I've changed it to >= VERSION_VI
420 base::win::ScopedComPtr<IPropertyStore> property_store; 420 base::win::ScopedComPtr<IPropertyStore> property_store;
421 if (FAILED(property_store.QueryFrom(i_shell_link)) || !property_store.get()) 421 if (FAILED(property_store.QueryFrom(i_shell_link)) || !property_store.get())
422 return false; 422 return false;
423 423
424 if (app_id && !base::win::SetAppIdForPropertyStore(property_store, app_id)) 424 if (app_id && !base::win::SetAppIdForPropertyStore(property_store, app_id))
425 return false; 425 return false;
426 if (is_dual_mode && 426 if (is_dual_mode &&
427 base::win::GetVersion() >= base::win::VERSION_WIN8 &&
428 !base::win::SetDualModeForPropertyStore(property_store)) { 427 !base::win::SetDualModeForPropertyStore(property_store)) {
429 return false; 428 return false;
430 } 429 }
431 } 430 }
432 431
433 HRESULT result = i_persist_file->Save(destination, TRUE); 432 HRESULT result = i_persist_file->Save(destination, TRUE);
434 433
435 // If we successfully updated the icon, notify the shell that we have done so. 434 // If we successfully updated the icon, notify the shell that we have done so.
436 if (!create && SUCCEEDED(result)) { 435 if (!create && SUCCEEDED(result)) {
437 // Release the interfaces in case the SHChangeNotify call below depends on 436 // Release the interfaces in case the SHChangeNotify call below depends on
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 HANDLE cp = GetCurrentProcess(); 1108 HANDLE cp = GetCurrentProcess();
1110 if (::GetMappedFileNameW(cp, file_view, mapped_file_path, kMaxPathLength)) { 1109 if (::GetMappedFileNameW(cp, file_view, mapped_file_path, kMaxPathLength)) {
1111 *nt_path = FilePath(mapped_file_path); 1110 *nt_path = FilePath(mapped_file_path);
1112 success = true; 1111 success = true;
1113 } 1112 }
1114 ::UnmapViewOfFile(file_view); 1113 ::UnmapViewOfFile(file_view);
1115 return success; 1114 return success;
1116 } 1115 }
1117 1116
1118 } // namespace file_util 1117 } // namespace file_util
OLDNEW
« no previous file with comments | « no previous file | base/win/win_util.cc » ('j') | base/win/win_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698