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

Side by Side Diff: chrome/utility/shell_handler_impl_win.cc

Issue 2894483002: Migrate from ScopedComPtr::CreateInstance() to CoCreateInstance in chrome/... (Closed)
Patch Set: Fix Header Include Location Created 3 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
« no previous file with comments | « chrome/utility/importer/ie_importer_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/utility/shell_handler_impl_win.h" 5 #include "chrome/utility/shell_handler_impl_win.h"
6 6
7 #include <objbase.h>
7 #include <shldisp.h> 8 #include <shldisp.h>
8 9
9 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
10 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
11 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
12 #include "base/path_service.h" 13 #include "base/path_service.h"
13 #include "base/scoped_native_library.h" 14 #include "base/scoped_native_library.h"
14 #include "base/win/scoped_bstr.h" 15 #include "base/win/scoped_bstr.h"
15 #include "base/win/scoped_com_initializer.h" 16 #include "base/win/scoped_com_initializer.h"
16 #include "base/win/scoped_comptr.h" 17 #include "base/win/scoped_comptr.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 constexpr uint32_t kUnpinFromTaskbarID = 5387; 82 constexpr uint32_t kUnpinFromTaskbarID = 5387;
82 83
83 base::string16 verb_name(LoadShellResourceString(kUnpinFromTaskbarID)); 84 base::string16 verb_name(LoadShellResourceString(kUnpinFromTaskbarID));
84 if (verb_name.empty()) { 85 if (verb_name.empty()) {
85 error_occured_ = true; 86 error_occured_ = true;
86 return false; 87 return false;
87 } 88 }
88 89
89 base::win::ScopedComPtr<IShellDispatch> shell_dispatch; 90 base::win::ScopedComPtr<IShellDispatch> shell_dispatch;
90 HRESULT hresult = 91 HRESULT hresult =
91 shell_dispatch.CreateInstance(CLSID_Shell, nullptr, CLSCTX_INPROC_SERVER); 92 ::CoCreateInstance(CLSID_Shell, nullptr, CLSCTX_INPROC_SERVER,
93 IID_PPV_ARGS(&shell_dispatch));
92 if (FAILED(hresult) || !shell_dispatch) { 94 if (FAILED(hresult) || !shell_dispatch) {
93 error_occured_ = true; 95 error_occured_ = true;
94 return false; 96 return false;
95 } 97 }
96 98
97 base::win::ScopedComPtr<Folder> folder; 99 base::win::ScopedComPtr<Folder> folder;
98 hresult = shell_dispatch->NameSpace( 100 hresult = shell_dispatch->NameSpace(
99 base::win::ScopedVariant(shortcut.DirName().value().c_str()), 101 base::win::ScopedVariant(shortcut.DirName().value().c_str()),
100 folder.GetAddressOf()); 102 folder.GetAddressOf());
101 if (FAILED(hresult) || !folder) { 103 if (FAILED(hresult) || !folder) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 mojo::MakeStrongBinding(base::MakeUnique<ShellHandlerImpl>(), 223 mojo::MakeStrongBinding(base::MakeUnique<ShellHandlerImpl>(),
222 std::move(request)); 224 std::move(request));
223 } 225 }
224 226
225 void ShellHandlerImpl::IsPinnedToTaskbar( 227 void ShellHandlerImpl::IsPinnedToTaskbar(
226 const IsPinnedToTaskbarCallback& callback) { 228 const IsPinnedToTaskbarCallback& callback) {
227 IsPinnedToTaskbarHelper helper; 229 IsPinnedToTaskbarHelper helper;
228 bool is_pinned_to_taskbar = helper.GetResult(); 230 bool is_pinned_to_taskbar = helper.GetResult();
229 callback.Run(!helper.error_occured(), is_pinned_to_taskbar); 231 callback.Run(!helper.error_occured(), is_pinned_to_taskbar);
230 } 232 }
OLDNEW
« no previous file with comments | « chrome/utility/importer/ie_importer_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698