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

Side by Side Diff: components/drive/drive_api_util.cc

Issue 2842493004: Add OnceCallback support to PostTaskAndReplyWithResult (Closed)
Patch Set: s/can not/cannot/ 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 | « components/drive/drive_api_util.h ('k') | content/public/browser/browser_thread.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/drive/drive_api_util.h" 5 #include "components/drive/drive_api_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/files/file.h" 12 #include "base/files/file.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/md5.h" 15 #include "base/md5.h"
16 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
19 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
20 #include "base/synchronization/cancellation_flag.h" 20 #include "base/synchronization/cancellation_flag.h"
21 #include "base/task_runner_util.h"
21 #include "base/values.h" 22 #include "base/values.h"
22 #include "google_apis/drive/drive_api_parser.h" 23 #include "google_apis/drive/drive_api_parser.h"
23 #include "net/base/escape.h" 24 #include "net/base/escape.h"
24 #include "net/base/net_errors.h" 25 #include "net/base/net_errors.h"
25 #include "third_party/re2/src/re2/re2.h" 26 #include "third_party/re2/src/re2/re2.h"
26 #include "url/gurl.h" 27 #include "url/gurl.h"
27 28
28 namespace drive { 29 namespace drive {
29 namespace util { 30 namespace util {
30 namespace { 31 namespace {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 193
193 bool HasHostedDocumentExtension(const base::FilePath& path) { 194 bool HasHostedDocumentExtension(const base::FilePath& path) {
194 const std::string extension = base::FilePath(path.Extension()).AsUTF8Unsafe(); 195 const std::string extension = base::FilePath(path.Extension()).AsUTF8Unsafe();
195 for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) { 196 for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) {
196 if (extension == kHostedDocumentKinds[i].extension) 197 if (extension == kHostedDocumentKinds[i].extension)
197 return true; 198 return true;
198 } 199 }
199 return extension == kUnknownHostedDocumentExtension; 200 return extension == kUnknownHostedDocumentExtension;
200 } 201 }
201 202
203 void RunAsyncTask(base::TaskRunner* task_runner,
204 const tracked_objects::Location& from_here,
205 base::OnceCallback<FileError()> task,
206 base::OnceCallback<void(FileError)> reply) {
207 PostTaskAndReplyWithResult(task_runner, from_here, std::move(task),
208 std::move(reply));
209 }
210
202 } // namespace util 211 } // namespace util
203 } // namespace drive 212 } // namespace drive
OLDNEW
« no previous file with comments | « components/drive/drive_api_util.h ('k') | content/public/browser/browser_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698