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

Side by Side Diff: chrome/browser/extensions/api/file_handlers/directory_util.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 years, 8 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
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/browser/extensions/api/file_handlers/directory_util.h" 5 #include "chrome/browser/extensions/api/file_handlers/directory_util.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 10 matching lines...) Expand all
21 21
22 namespace { 22 namespace {
23 23
24 void GetIsDirectoryFromFileInfo(const base::FilePath& path, 24 void GetIsDirectoryFromFileInfo(const base::FilePath& path,
25 bool* is_directory) { 25 bool* is_directory) {
26 base::File::Info file_info; 26 base::File::Info file_info;
27 *is_directory = GetFileInfo(path, &file_info) && file_info.is_directory; 27 *is_directory = GetFileInfo(path, &file_info) && file_info.is_directory;
28 } 28 }
29 29
30 void OnGetIsDirectoryFromFileInfoCompleted( 30 void OnGetIsDirectoryFromFileInfoCompleted(
31 scoped_ptr<bool> is_directory, 31 std::unique_ptr<bool> is_directory,
32 const base::Callback<void(bool)>& callback) { 32 const base::Callback<void(bool)>& callback) {
33 callback.Run(*is_directory); 33 callback.Run(*is_directory);
34 } 34 }
35 35
36 // The callback parameter contains the result and is required to support 36 // The callback parameter contains the result and is required to support
37 // both native local directories to avoid UI thread and non native local 37 // both native local directories to avoid UI thread and non native local
38 // path directories for the IsNonNativeLocalPathDirectory API. 38 // path directories for the IsNonNativeLocalPathDirectory API.
39 void EntryIsDirectory(Profile* profile, 39 void EntryIsDirectory(Profile* profile,
40 const base::FilePath& path, 40 const base::FilePath& path,
41 const base::Callback<void(bool)>& callback) { 41 const base::Callback<void(bool)>& callback) {
42 #if defined(OS_CHROMEOS) 42 #if defined(OS_CHROMEOS)
43 if (file_manager::util::IsUnderNonNativeLocalPath(profile, path)) { 43 if (file_manager::util::IsUnderNonNativeLocalPath(profile, path)) {
44 file_manager::util::IsNonNativeLocalPathDirectory(profile, path, callback); 44 file_manager::util::IsNonNativeLocalPathDirectory(profile, path, callback);
45 return; 45 return;
46 } 46 }
47 #endif 47 #endif
48 48
49 scoped_ptr<bool> is_directory(new bool); 49 std::unique_ptr<bool> is_directory(new bool);
50 bool* const is_directory_ptr = is_directory.get(); 50 bool* const is_directory_ptr = is_directory.get();
51 51
52 content::BrowserThread::PostBlockingPoolTaskAndReply( 52 content::BrowserThread::PostBlockingPoolTaskAndReply(
53 FROM_HERE, 53 FROM_HERE,
54 base::Bind(&GetIsDirectoryFromFileInfo, path, is_directory_ptr), 54 base::Bind(&GetIsDirectoryFromFileInfo, path, is_directory_ptr),
55 base::Bind(&OnGetIsDirectoryFromFileInfoCompleted, 55 base::Bind(&OnGetIsDirectoryFromFileInfoCompleted,
56 base::Passed(&is_directory), callback)); 56 base::Passed(&is_directory), callback));
57 } 57 }
58 58
59 } // namespace 59 } // namespace
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 FROM_HERE, base::Bind(callback_, base::Passed(&result_))); 98 FROM_HERE, base::Bind(callback_, base::Passed(&result_)));
99 // Release the callback to avoid a circullar reference in case an instance 99 // Release the callback to avoid a circullar reference in case an instance
100 // of this class is a member of a ref counted class, which instance is bound 100 // of this class is a member of a ref counted class, which instance is bound
101 // to this callback. 101 // to this callback.
102 callback_ = CompletionCallback(); 102 callback_ = CompletionCallback();
103 } 103 }
104 } 104 }
105 105
106 } // namespace app_file_handler_util 106 } // namespace app_file_handler_util
107 } // namespace extensions 107 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698