url_request_about_job.cc 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright (c) 2016 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #include "atom/browser/net/url_request_about_job.h"
  5. #include "base/threading/thread_task_runner_handle.h"
  6. namespace atom {
  7. URLRequestAboutJob::URLRequestAboutJob(net::URLRequest* request,
  8. net::NetworkDelegate* network_delegate)
  9. : net::URLRequestJob(request, network_delegate), weak_ptr_factory_(this) {}
  10. void URLRequestAboutJob::Start() {
  11. base::ThreadTaskRunnerHandle::Get()->PostTask(
  12. FROM_HERE, base::BindOnce(&URLRequestAboutJob::StartAsync,
  13. weak_ptr_factory_.GetWeakPtr()));
  14. }
  15. void URLRequestAboutJob::Kill() {
  16. weak_ptr_factory_.InvalidateWeakPtrs();
  17. URLRequestJob::Kill();
  18. }
  19. bool URLRequestAboutJob::GetMimeType(std::string* mime_type) const {
  20. *mime_type = "text/html";
  21. return true;
  22. }
  23. URLRequestAboutJob::~URLRequestAboutJob() {}
  24. void URLRequestAboutJob::StartAsync() {
  25. NotifyHeadersComplete();
  26. }
  27. } // namespace atom