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

Side by Side Diff: mojo/fetcher/about_fetcher.cc

Issue 1538823002: Convert Pass()→std::move() in mojo/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "mojo/fetcher/about_fetcher.h" 5 #include "mojo/fetcher/about_fetcher.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
12 14
13 namespace mojo { 15 namespace mojo {
14 namespace fetcher { 16 namespace fetcher {
15 namespace { 17 namespace {
16 18
17 void RunFetcherCallback(const shell::Fetcher::FetchCallback& callback, 19 void RunFetcherCallback(const shell::Fetcher::FetchCallback& callback,
18 scoped_ptr<shell::Fetcher> fetcher, 20 scoped_ptr<shell::Fetcher> fetcher,
19 bool success) { 21 bool success) {
20 callback.Run(success ? fetcher.Pass() : nullptr); 22 callback.Run(success ? std::move(fetcher) : nullptr);
21 } 23 }
22 24
23 } // namespace 25 } // namespace
24 26
25 const char AboutFetcher::kAboutScheme[] = "about"; 27 const char AboutFetcher::kAboutScheme[] = "about";
26 const char AboutFetcher::kAboutBlankURL[] = "about:blank"; 28 const char AboutFetcher::kAboutBlankURL[] = "about:blank";
27 29
28 // static 30 // static
29 void AboutFetcher::Start(const GURL& url, 31 void AboutFetcher::Start(const GURL& url,
30 const FetchCallback& loader_callback) { 32 const FetchCallback& loader_callback) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 78 }
77 79
78 URLResponsePtr AboutFetcher::AsURLResponse(base::TaskRunner* task_runner, 80 URLResponsePtr AboutFetcher::AsURLResponse(base::TaskRunner* task_runner,
79 uint32_t skip) { 81 uint32_t skip) {
80 DCHECK(response_); 82 DCHECK(response_);
81 83
82 // Ignore |skip| because the only URL handled currently is "about:blank" which 84 // Ignore |skip| because the only URL handled currently is "about:blank" which
83 // doesn't have a body. 85 // doesn't have a body.
84 DCHECK(!response_->body.is_valid()); 86 DCHECK(!response_->body.is_valid());
85 87
86 return response_.Pass(); 88 return std::move(response_);
87 } 89 }
88 90
89 void AboutFetcher::AsPath( 91 void AboutFetcher::AsPath(
90 base::TaskRunner* task_runner, 92 base::TaskRunner* task_runner,
91 base::Callback<void(const base::FilePath&, bool)> callback) { 93 base::Callback<void(const base::FilePath&, bool)> callback) {
92 NOTIMPLEMENTED(); 94 NOTIMPLEMENTED();
93 base::MessageLoop::current()->PostTask( 95 base::MessageLoop::current()->PostTask(
94 FROM_HERE, base::Bind(callback, base::FilePath(), false)); 96 FROM_HERE, base::Bind(callback, base::FilePath(), false));
95 } 97 }
96 98
97 std::string AboutFetcher::MimeType() { 99 std::string AboutFetcher::MimeType() {
98 DCHECK(response_); 100 DCHECK(response_);
99 return response_->mime_type; 101 return response_->mime_type;
100 } 102 }
101 103
102 bool AboutFetcher::HasMojoMagic() { 104 bool AboutFetcher::HasMojoMagic() {
103 return false; 105 return false;
104 } 106 }
105 107
106 bool AboutFetcher::PeekFirstLine(std::string* line) { 108 bool AboutFetcher::PeekFirstLine(std::string* line) {
107 // The only URL handled currently is "about:blank" which doesn't have a body. 109 // The only URL handled currently is "about:blank" which doesn't have a body.
108 return false; 110 return false;
109 } 111 }
110 112
111 } // namespace fetcher 113 } // namespace fetcher
112 } // namespace mojo 114 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/converters/transform/transform_type_converters.cc ('k') | mojo/fetcher/about_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698