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

Side by Side Diff: chrome/browser/chromeos/file_manager/filesystem_api_util.cc

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chromeos/file_manager/filesystem_api_util.h" 5 #include "chrome/browser/chromeos/file_manager/filesystem_api_util.h"
6 6
7 #include <memory>
8
7 #include "base/callback.h" 9 #include "base/callback.h"
8 #include "base/files/file.h" 10 #include "base/files/file.h"
9 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/chromeos/drive/file_system_util.h" 12 #include "chrome/browser/chromeos/drive/file_system_util.h"
12 #include "chrome/browser/chromeos/file_manager/app_id.h" 13 #include "chrome/browser/chromeos/file_manager/app_id.h"
13 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" 14 #include "chrome/browser/chromeos/file_manager/fileapi_util.h"
14 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h" 15 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h"
15 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h" 16 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h"
16 #include "chrome/browser/extensions/extension_util.h" 17 #include "chrome/browser/extensions/extension_util.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "components/drive/file_errors.h" 19 #include "components/drive/file_errors.h"
19 #include "components/drive/file_system_core_util.h" 20 #include "components/drive/file_system_core_util.h"
20 #include "components/drive/file_system_interface.h" 21 #include "components/drive/file_system_interface.h"
21 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/storage_partition.h" 23 #include "content/public/browser/storage_partition.h"
23 #include "google_apis/drive/task_util.h" 24 #include "google_apis/drive/task_util.h"
24 #include "storage/browser/fileapi/file_system_context.h" 25 #include "storage/browser/fileapi/file_system_context.h"
25 26
26 namespace file_manager { 27 namespace file_manager {
27 namespace util { 28 namespace util {
28 namespace { 29 namespace {
29 30
30 // Helper function used to implement GetNonNativeLocalPathMimeType. It extracts 31 // Helper function used to implement GetNonNativeLocalPathMimeType. It extracts
31 // the mime type from the passed Drive resource entry. 32 // the mime type from the passed Drive resource entry.
32 void GetMimeTypeAfterGetResourceEntryForDrive( 33 void GetMimeTypeAfterGetResourceEntryForDrive(
33 const base::Callback<void(bool, const std::string&)>& callback, 34 const base::Callback<void(bool, const std::string&)>& callback,
34 drive::FileError error, 35 drive::FileError error,
35 scoped_ptr<drive::ResourceEntry> entry) { 36 std::unique_ptr<drive::ResourceEntry> entry) {
36 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 37 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
37 38
38 if (error != drive::FILE_ERROR_OK || !entry->has_file_specific_info() || 39 if (error != drive::FILE_ERROR_OK || !entry->has_file_specific_info() ||
39 entry->file_specific_info().content_mime_type().empty()) { 40 entry->file_specific_info().content_mime_type().empty()) {
40 callback.Run(false, std::string()); 41 callback.Run(false, std::string());
41 return; 42 return;
42 } 43 }
43 callback.Run(true, entry->file_specific_info().content_mime_type()); 44 callback.Run(true, entry->file_specific_info().content_mime_type());
44 } 45 }
45 46
46 // Helper function used to implement GetNonNativeLocalPathMimeType. It extracts 47 // Helper function used to implement GetNonNativeLocalPathMimeType. It extracts
47 // the mime type from the passed metadata from a providing extension. 48 // the mime type from the passed metadata from a providing extension.
48 void GetMimeTypeAfterGetMetadataForProvidedFileSystem( 49 void GetMimeTypeAfterGetMetadataForProvidedFileSystem(
49 const base::Callback<void(bool, const std::string&)>& callback, 50 const base::Callback<void(bool, const std::string&)>& callback,
50 scoped_ptr<chromeos::file_system_provider::EntryMetadata> metadata, 51 std::unique_ptr<chromeos::file_system_provider::EntryMetadata> metadata,
51 base::File::Error result) { 52 base::File::Error result) {
52 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 53 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
53 54
54 if (result != base::File::FILE_OK || !metadata->mime_type.get()) { 55 if (result != base::File::FILE_OK || !metadata->mime_type.get()) {
55 callback.Run(false, std::string()); 56 callback.Run(false, std::string());
56 return; 57 return;
57 } 58 }
58 callback.Run(true, *metadata->mime_type); 59 callback.Run(true, *metadata->mime_type);
59 } 60 }
60 61
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 backend->CreateInternalURL(file_system_context.get(), path); 232 backend->CreateInternalURL(file_system_context.get(), path);
232 233
233 content::BrowserThread::PostTask( 234 content::BrowserThread::PostTask(
234 content::BrowserThread::IO, FROM_HERE, 235 content::BrowserThread::IO, FROM_HERE,
235 base::Bind(&PrepareFileOnIOThread, file_system_context, internal_url, 236 base::Bind(&PrepareFileOnIOThread, file_system_context, internal_url,
236 google_apis::CreateRelayCallback(callback))); 237 google_apis::CreateRelayCallback(callback)));
237 } 238 }
238 239
239 } // namespace util 240 } // namespace util
240 } // namespace file_manager 241 } // namespace file_manager
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/file_manager/fileapi_util.cc ('k') | chrome/browser/chromeos/file_manager/url_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698