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

Side by Side Diff: chrome/browser/media_galleries/fileapi/native_media_file_util.cc

Issue 1551503002: Convert Pass()→std::move() in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 (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/media_galleries/fileapi/native_media_file_util.h" 5 #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
11 #include "base/files/file_enumerator.h" 12 #include "base/files/file_enumerator.h"
12 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
13 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
14 #include "base/task_runner_util.h" 15 #include "base/task_runner_util.h"
15 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" 16 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h"
16 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
17 #include "net/base/io_buffer.h" 18 #include "net/base/io_buffer.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 void HoldFileRef( 50 void HoldFileRef(
50 const scoped_refptr<storage::ShareableFileReference>& file_ref) { 51 const scoped_refptr<storage::ShareableFileReference>& file_ref) {
51 } 52 }
52 53
53 void DidOpenSnapshot( 54 void DidOpenSnapshot(
54 const storage::AsyncFileUtil::CreateOrOpenCallback& callback, 55 const storage::AsyncFileUtil::CreateOrOpenCallback& callback,
55 const scoped_refptr<storage::ShareableFileReference>& file_ref, 56 const scoped_refptr<storage::ShareableFileReference>& file_ref,
56 base::File file) { 57 base::File file) {
57 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 58 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
58 if (!file.IsValid()) { 59 if (!file.IsValid()) {
59 callback.Run(file.Pass(), base::Closure()); 60 callback.Run(std::move(file), base::Closure());
60 return; 61 return;
61 } 62 }
62 callback.Run(file.Pass(), base::Bind(&HoldFileRef, file_ref)); 63 callback.Run(std::move(file), base::Bind(&HoldFileRef, file_ref));
63 } 64 }
64 65
65 } // namespace 66 } // namespace
66 67
67 NativeMediaFileUtil::NativeMediaFileUtil(MediaPathFilter* media_path_filter) 68 NativeMediaFileUtil::NativeMediaFileUtil(MediaPathFilter* media_path_filter)
68 : media_path_filter_(media_path_filter), 69 : media_path_filter_(media_path_filter),
69 weak_factory_(this) { 70 weak_factory_(this) {
70 } 71 }
71 72
72 NativeMediaFileUtil::~NativeMediaFileUtil() { 73 NativeMediaFileUtil::~NativeMediaFileUtil() {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 126 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
126 // Returns an error if any unsupported flag is found. 127 // Returns an error if any unsupported flag is found.
127 if (file_flags & ~(base::File::FLAG_OPEN | 128 if (file_flags & ~(base::File::FLAG_OPEN |
128 base::File::FLAG_READ | 129 base::File::FLAG_READ |
129 base::File::FLAG_WRITE_ATTRIBUTES)) { 130 base::File::FLAG_WRITE_ATTRIBUTES)) {
130 callback.Run(base::File(base::File::FILE_ERROR_SECURITY), base::Closure()); 131 callback.Run(base::File(base::File::FILE_ERROR_SECURITY), base::Closure());
131 return; 132 return;
132 } 133 }
133 scoped_refptr<base::SequencedTaskRunner> task_runner = context->task_runner(); 134 scoped_refptr<base::SequencedTaskRunner> task_runner = context->task_runner();
134 CreateSnapshotFile( 135 CreateSnapshotFile(
135 context.Pass(), 136 std::move(context), url,
136 url,
137 base::Bind(&NativeMediaFileUtil::CreatedSnapshotFileForCreateOrOpen, 137 base::Bind(&NativeMediaFileUtil::CreatedSnapshotFileForCreateOrOpen,
138 task_runner, 138 task_runner, file_flags, callback));
139 file_flags,
140 callback));
141 } 139 }
142 140
143 void NativeMediaFileUtil::EnsureFileExists( 141 void NativeMediaFileUtil::EnsureFileExists(
144 scoped_ptr<storage::FileSystemOperationContext> context, 142 scoped_ptr<storage::FileSystemOperationContext> context,
145 const storage::FileSystemURL& url, 143 const storage::FileSystemURL& url,
146 const EnsureFileExistsCallback& callback) { 144 const EnsureFileExistsCallback& callback) {
147 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 145 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
148 callback.Run(base::File::FILE_ERROR_SECURITY, false); 146 callback.Run(base::File::FILE_ERROR_SECURITY, false);
149 } 147 }
150 148
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 return base::File::FILE_ERROR_FAILED; 668 return base::File::FILE_ERROR_FAILED;
671 669
672 if (!file_info.is_directory && 670 if (!file_info.is_directory &&
673 !media_path_filter_->Match(file_path)) { 671 !media_path_filter_->Match(file_path)) {
674 return failure_error; 672 return failure_error;
675 } 673 }
676 674
677 *local_file_path = file_path; 675 *local_file_path = file_path;
678 return base::File::FILE_OK; 676 return base::File::FILE_OK;
679 } 677 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698