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

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

Issue 745333002: Remove implicit conversions from scoped_refptr to T* in chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
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 <shlwapi.h> 8 #include <shlwapi.h>
9 #include <shobjidl.h> 9 #include <shobjidl.h>
10 #include <propkey.h> // Needs to come after shobjidl.h. 10 #include <propkey.h> // Needs to come after shobjidl.h.
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 base::string16 expected_app_id( 469 base::string16 expected_app_id(
470 GetExpectedAppId(command_line, is_per_user_install)); 470 GetExpectedAppId(command_line, is_per_user_install));
471 if (expected_app_id.empty()) 471 if (expected_app_id.empty())
472 continue; 472 continue;
473 473
474 // Load the shortcut. 474 // Load the shortcut.
475 base::win::ScopedComPtr<IShellLink> shell_link; 475 base::win::ScopedComPtr<IShellLink> shell_link;
476 base::win::ScopedComPtr<IPersistFile> persist_file; 476 base::win::ScopedComPtr<IPersistFile> persist_file;
477 if (FAILED(shell_link.CreateInstance(CLSID_ShellLink, NULL, 477 if (FAILED(shell_link.CreateInstance(CLSID_ShellLink, NULL,
478 CLSCTX_INPROC_SERVER)) || 478 CLSCTX_INPROC_SERVER)) ||
479 FAILED(persist_file.QueryFrom(shell_link)) || 479 FAILED(persist_file.QueryFrom(shell_link.get())) ||
480 FAILED(persist_file->Load(shortcut.value().c_str(), STGM_READ))) { 480 FAILED(persist_file->Load(shortcut.value().c_str(), STGM_READ))) {
481 DLOG(WARNING) << "Failed loading shortcut at " << shortcut.value(); 481 DLOG(WARNING) << "Failed loading shortcut at " << shortcut.value();
482 continue; 482 continue;
483 } 483 }
484 484
485 // Any properties that need to be updated on the shortcut will be stored in 485 // Any properties that need to be updated on the shortcut will be stored in
486 // |updated_properties|. 486 // |updated_properties|.
487 base::win::ShortcutProperties updated_properties; 487 base::win::ShortcutProperties updated_properties;
488 488
489 // Validate the existing app id for the shortcut. 489 // Validate the existing app id for the shortcut.
490 base::win::ScopedComPtr<IPropertyStore> property_store; 490 base::win::ScopedComPtr<IPropertyStore> property_store;
491 propvariant.Reset(); 491 propvariant.Reset();
492 if (FAILED(property_store.QueryFrom(shell_link)) || 492 if (FAILED(property_store.QueryFrom(shell_link.get())) ||
493 property_store->GetValue(PKEY_AppUserModel_ID, 493 property_store->GetValue(PKEY_AppUserModel_ID, propvariant.Receive()) !=
Lei Zhang 2014/11/21 17:44:28 nit: the prev code looks more readable to me.
dcheng 2014/11/21 19:12:11 This was the result of clang-format. I'm happy to
494 propvariant.Receive()) != S_OK) { 494 S_OK) {
495 // When in doubt, prefer not updating the shortcut. 495 // When in doubt, prefer not updating the shortcut.
496 NOTREACHED(); 496 NOTREACHED();
497 continue; 497 continue;
498 } else { 498 } else {
499 switch (propvariant.get().vt) { 499 switch (propvariant.get().vt) {
500 case VT_EMPTY: 500 case VT_EMPTY:
501 // If there is no app_id set, set our app_id if one is expected. 501 // If there is no app_id set, set our app_id if one is expected.
502 if (!expected_app_id.empty()) 502 if (!expected_app_id.empty())
503 updated_properties.set_app_id(expected_app_id); 503 updated_properties.set_app_id(expected_app_id);
504 break; 504 break;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 } 577 }
578 578
579 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + 579 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name +
580 installer::kLnkExt); 580 installer::kLnkExt);
581 if (base::PathExists(shortcut)) 581 if (base::PathExists(shortcut))
582 return shortcut; 582 return shortcut;
583 } 583 }
584 584
585 return base::FilePath(); 585 return base::FilePath();
586 } 586 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698