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

Side by Side Diff: chrome/browser/chromeos/drive/file_system/touch_operation.cc

Issue 16998003: Update CrOS to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/drive/file_system/touch_operation.h" 5 #include "chrome/browser/chromeos/drive/file_system/touch_operation.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/sequenced_task_runner.h" 9 #include "base/sequenced_task_runner.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 26 matching lines...) Expand all
37 37
38 void TouchOperation::TouchFile(const base::FilePath& file_path, 38 void TouchOperation::TouchFile(const base::FilePath& file_path,
39 const base::Time& last_access_time, 39 const base::Time& last_access_time,
40 const base::Time& last_modified_time, 40 const base::Time& last_modified_time,
41 const FileOperationCallback& callback) { 41 const FileOperationCallback& callback) {
42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
43 DCHECK(!callback.is_null()); 43 DCHECK(!callback.is_null());
44 44
45 ResourceEntry* entry = new ResourceEntry; 45 ResourceEntry* entry = new ResourceEntry;
46 base::PostTaskAndReplyWithResult( 46 base::PostTaskAndReplyWithResult(
47 blocking_task_runner_, 47 blocking_task_runner_.get(),
48 FROM_HERE, 48 FROM_HERE,
49 base::Bind(&internal::ResourceMetadata::GetResourceEntryByPath, 49 base::Bind(&internal::ResourceMetadata::GetResourceEntryByPath,
50 base::Unretained(metadata_), file_path, entry), 50 base::Unretained(metadata_),
51 file_path,
52 entry),
51 base::Bind(&TouchOperation::TouchFileAfterGetResourceEntry, 53 base::Bind(&TouchOperation::TouchFileAfterGetResourceEntry,
52 weak_ptr_factory_.GetWeakPtr(), 54 weak_ptr_factory_.GetWeakPtr(),
53 file_path, last_access_time, last_modified_time, callback, 55 file_path,
56 last_access_time,
57 last_modified_time,
58 callback,
54 base::Owned(entry))); 59 base::Owned(entry)));
55 } 60 }
56 61
57 void TouchOperation::TouchFileAfterGetResourceEntry( 62 void TouchOperation::TouchFileAfterGetResourceEntry(
58 const base::FilePath& file_path, 63 const base::FilePath& file_path,
59 const base::Time& last_access_time, 64 const base::Time& last_access_time,
60 const base::Time& last_modified_time, 65 const base::Time& last_modified_time,
61 const FileOperationCallback& callback, 66 const FileOperationCallback& callback,
62 ResourceEntry* entry, 67 ResourceEntry* entry,
63 FileError error) { 68 FileError error) {
(...skipping 23 matching lines...) Expand all
87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 92 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
88 DCHECK(!callback.is_null()); 93 DCHECK(!callback.is_null());
89 94
90 FileError error = util::GDataToFileError(gdata_error); 95 FileError error = util::GDataToFileError(gdata_error);
91 if (error != FILE_ERROR_OK) { 96 if (error != FILE_ERROR_OK) {
92 callback.Run(error); 97 callback.Run(error);
93 return; 98 return;
94 } 99 }
95 100
96 base::PostTaskAndReplyWithResult( 101 base::PostTaskAndReplyWithResult(
97 blocking_task_runner_, 102 blocking_task_runner_.get(),
98 FROM_HERE, 103 FROM_HERE,
99 base::Bind(&internal::ResourceMetadata::RefreshEntry, 104 base::Bind(&internal::ResourceMetadata::RefreshEntry,
100 base::Unretained(metadata_), 105 base::Unretained(metadata_),
101 ConvertToResourceEntry(*resource_entry)), 106 ConvertToResourceEntry(*resource_entry)),
102 base::Bind(&TouchOperation::TouchFileAfterRefreshMetadata, 107 base::Bind(&TouchOperation::TouchFileAfterRefreshMetadata,
103 weak_ptr_factory_.GetWeakPtr(), file_path, callback)); 108 weak_ptr_factory_.GetWeakPtr(),
109 file_path,
110 callback));
104 } 111 }
105 112
106 void TouchOperation::TouchFileAfterRefreshMetadata( 113 void TouchOperation::TouchFileAfterRefreshMetadata(
107 const base::FilePath& file_path, 114 const base::FilePath& file_path,
108 const FileOperationCallback& callback, 115 const FileOperationCallback& callback,
109 FileError error) { 116 FileError error) {
110 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
111 DCHECK(!callback.is_null()); 118 DCHECK(!callback.is_null());
112 119
113 if (error == FILE_ERROR_OK) 120 if (error == FILE_ERROR_OK)
114 observer_->OnDirectoryChangedByOperation(file_path.DirName()); 121 observer_->OnDirectoryChangedByOperation(file_path.DirName());
115 122
116 callback.Run(error); 123 callback.Run(error);
117 } 124 }
118 125
119 } // namespace file_system 126 } // namespace file_system
120 } // namespace drive 127 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698