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

Side by Side Diff: remoting/host/url_fetcher.h

Issue 10637008: Remove UrlFetcher from remoting and use the one in net instead. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use enum instead of bool to distinguish fetchers. Created 8 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
« no previous file with comments | « remoting/host/host_port_allocator.cc ('k') | remoting/host/url_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_HOST_URL_FETCHER_H_
6 #define REMOTING_HOST_URL_FETCHER_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/callback_forward.h"
12 #include "base/memory/ref_counted.h"
13
14 class GURL;
15
16 namespace net {
17 class URLRequestContextGetter;
18 class URLRequestStatus;
19 } // namespace net
20
21 namespace remoting {
22
23 // UrlFetcher implements HTTP querying functionality that is used in
24 // remoting code (e.g. in GaiaOAuthClient). It takes care of switching
25 // threads when neccessary and provides interface that is simpler to
26 // use than net::UrlRequest.
27 //
28 // This code is a simplified version of content::UrlFetcher from
29 // content/common/net. It implements only features that remoting code
30 // needs.
31 class UrlFetcher {
32 public:
33 enum Method {
34 GET,
35 POST,
36 };
37
38 typedef base::Callback<void(const net::URLRequestStatus& status,
39 int response_code,
40 const std::string& response)>
41 DoneCallback;
42
43 UrlFetcher(const GURL& url, Method method);
44 ~UrlFetcher();
45
46 void SetRequestContext(
47 net::URLRequestContextGetter* request_context_getter);
48 void SetUploadData(const std::string& upload_content_type,
49 const std::string& upload_content);
50 void SetHeader(const std::string& key, const std::string& value);
51 void Start(const DoneCallback& done_callback);
52
53 private:
54 // Ref-counted core of the implementation.
55 class Core;
56
57 scoped_refptr<Core> core_;
58
59 DISALLOW_COPY_AND_ASSIGN(UrlFetcher);
60 };
61
62 } // namespace remoting
63
64 #endif // REMOTING_HOST_URL_FETCHER_H_
OLDNEW
« no previous file with comments | « remoting/host/host_port_allocator.cc ('k') | remoting/host/url_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698