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

Side by Side Diff: chrome/browser/ui/webui/settings/certificates_handler.cc

Issue 2824363002: Rewrite base::Bind to base::BindOnce with base_bind_rewriters in //chrome/browser/ui (Closed)
Patch Set: Created 3 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/ui/webui/settings/certificates_handler.h" 5 #include "chrome/browser/ui/webui/settings/certificates_handler.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 const ReadCallback& callback, 291 const ReadCallback& callback,
292 base::CancelableTaskTracker* tracker) { 292 base::CancelableTaskTracker* tracker) {
293 // Owned by reply callback posted below. 293 // Owned by reply callback posted below.
294 int* saved_errno = new int(0); 294 int* saved_errno = new int(0);
295 std::string* data = new std::string(); 295 std::string* data = new std::string();
296 296
297 // Post task to file thread to read file. 297 // Post task to file thread to read file.
298 return tracker->PostTaskAndReply( 298 return tracker->PostTaskAndReply(
299 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get(), 299 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get(),
300 FROM_HERE, 300 FROM_HERE,
301 base::Bind(&FileAccessProvider::DoRead, this, path, saved_errno, data), 301 base::BindOnce(&FileAccessProvider::DoRead, this, path, saved_errno,
302 base::Bind(callback, base::Owned(saved_errno), base::Owned(data))); 302 data),
303 base::BindOnce(callback, base::Owned(saved_errno), base::Owned(data)));
303 } 304 }
304 305
305 base::CancelableTaskTracker::TaskId FileAccessProvider::StartWrite( 306 base::CancelableTaskTracker::TaskId FileAccessProvider::StartWrite(
306 const base::FilePath& path, 307 const base::FilePath& path,
307 const std::string& data, 308 const std::string& data,
308 const WriteCallback& callback, 309 const WriteCallback& callback,
309 base::CancelableTaskTracker* tracker) { 310 base::CancelableTaskTracker* tracker) {
310 // Owned by reply callback posted below. 311 // Owned by reply callback posted below.
311 int* saved_errno = new int(0); 312 int* saved_errno = new int(0);
312 int* bytes_written = new int(0); 313 int* bytes_written = new int(0);
313 314
314 // Post task to file thread to write file. 315 // Post task to file thread to write file.
315 return tracker->PostTaskAndReply( 316 return tracker->PostTaskAndReply(
316 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get(), 317 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get(),
317 FROM_HERE, base::Bind(&FileAccessProvider::DoWrite, this, path, data, 318 FROM_HERE,
318 saved_errno, bytes_written), 319 base::BindOnce(&FileAccessProvider::DoWrite, this, path, data,
319 base::Bind(callback, base::Owned(saved_errno), 320 saved_errno, bytes_written),
320 base::Owned(bytes_written))); 321 base::BindOnce(callback, base::Owned(saved_errno),
322 base::Owned(bytes_written)));
321 } 323 }
322 324
323 void FileAccessProvider::DoRead(const base::FilePath& path, 325 void FileAccessProvider::DoRead(const base::FilePath& path,
324 int* saved_errno, 326 int* saved_errno,
325 std::string* data) { 327 std::string* data) {
326 bool success = base::ReadFileToString(path, data); 328 bool success = base::ReadFileToString(path, data);
327 *saved_errno = success ? 0 : errno; 329 *saved_errno = success ? 0 : errno;
328 } 330 }
329 331
330 void FileAccessProvider::DoWrite(const base::FilePath& path, 332 void FileAccessProvider::DoWrite(const base::FilePath& path,
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 error_info->Set(kCertificateErrors, 1139 error_info->Set(kCertificateErrors,
1138 base::WrapUnique(cert_error_list.release())); 1140 base::WrapUnique(cert_error_list.release()));
1139 RejectCallback(*error_info); 1141 RejectCallback(*error_info);
1140 } 1142 }
1141 1143
1142 gfx::NativeWindow CertificatesHandler::GetParentWindow() const { 1144 gfx::NativeWindow CertificatesHandler::GetParentWindow() const {
1143 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); 1145 return web_ui()->GetWebContents()->GetTopLevelNativeWindow();
1144 } 1146 }
1145 1147
1146 } // namespace settings 1148 } // namespace settings
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/quota_internals/quota_internals_proxy.cc ('k') | chrome/browser/ui/webui/settings_utils_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698