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

Side by Side Diff: content/common/net/url_fetcher_impl.h

Issue 9585009: Add URLFetcher::SaveResponseToFileAtPath (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits Created 8 years, 9 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 | « no previous file | content/common/net/url_fetcher_impl.cc » ('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 // This file contains URLFetcher, a wrapper around net::URLRequest that handles 5 // This file contains URLFetcher, a wrapper around net::URLRequest that handles
6 // low-level details like thread safety, ref counting, and incremental buffer 6 // low-level details like thread safety, ref counting, and incremental buffer
7 // reading. This is useful for callers who simply want to get the data from a 7 // reading. This is useful for callers who simply want to get the data from a
8 // URL and don't care about all the nitty-gritty details. 8 // URL and don't care about all the nitty-gritty details.
9 // 9 //
10 // NOTE(willchan): Only one "IO" thread is supported for URLFetcher. This is a 10 // NOTE(willchan): Only one "IO" thread is supported for URLFetcher. This is a
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 const std::string& extra_request_headers) OVERRIDE; 48 const std::string& extra_request_headers) OVERRIDE;
49 virtual void AddExtraRequestHeader(const std::string& header_line) OVERRIDE; 49 virtual void AddExtraRequestHeader(const std::string& header_line) OVERRIDE;
50 virtual void GetExtraRequestHeaders( 50 virtual void GetExtraRequestHeaders(
51 net::HttpRequestHeaders* headers) OVERRIDE; 51 net::HttpRequestHeaders* headers) OVERRIDE;
52 virtual void SetRequestContext( 52 virtual void SetRequestContext(
53 net::URLRequestContextGetter* request_context_getter) OVERRIDE; 53 net::URLRequestContextGetter* request_context_getter) OVERRIDE;
54 virtual void SetAutomaticallyRetryOn5xx(bool retry) OVERRIDE; 54 virtual void SetAutomaticallyRetryOn5xx(bool retry) OVERRIDE;
55 virtual void SetMaxRetries(int max_retries) OVERRIDE; 55 virtual void SetMaxRetries(int max_retries) OVERRIDE;
56 virtual int GetMaxRetries() const OVERRIDE; 56 virtual int GetMaxRetries() const OVERRIDE;
57 virtual base::TimeDelta GetBackoffDelay() const OVERRIDE; 57 virtual base::TimeDelta GetBackoffDelay() const OVERRIDE;
58 virtual void SaveResponseToFileAtPath(
59 const FilePath& file_path,
60 scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy) OVERRIDE;
58 virtual void SaveResponseToTemporaryFile( 61 virtual void SaveResponseToTemporaryFile(
59 scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy) OVERRIDE; 62 scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy) OVERRIDE;
60 virtual net::HttpResponseHeaders* GetResponseHeaders() const OVERRIDE; 63 virtual net::HttpResponseHeaders* GetResponseHeaders() const OVERRIDE;
61 virtual net::HostPortPair GetSocketAddress() const OVERRIDE; 64 virtual net::HostPortPair GetSocketAddress() const OVERRIDE;
62 virtual bool WasFetchedViaProxy() const OVERRIDE; 65 virtual bool WasFetchedViaProxy() const OVERRIDE;
63 virtual void Start() OVERRIDE; 66 virtual void Start() OVERRIDE;
64 virtual void StartWithRequestContextGetter( 67 virtual void StartWithRequestContextGetter(
65 net::URLRequestContextGetter* request_context_getter) OVERRIDE; 68 net::URLRequestContextGetter* request_context_getter) OVERRIDE;
66 virtual const GURL& GetOriginalURL() const OVERRIDE; 69 virtual const GURL& GetOriginalURL() const OVERRIDE;
67 virtual const GURL& GetURL() const OVERRIDE; 70 virtual const GURL& GetURL() const OVERRIDE;
68 virtual const net::URLRequestStatus& GetStatus() const OVERRIDE; 71 virtual const net::URLRequestStatus& GetStatus() const OVERRIDE;
69 virtual int GetResponseCode() const OVERRIDE; 72 virtual int GetResponseCode() const OVERRIDE;
70 virtual const net::ResponseCookies& GetCookies() const OVERRIDE; 73 virtual const net::ResponseCookies& GetCookies() const OVERRIDE;
71 virtual bool FileErrorOccurred( 74 virtual bool FileErrorOccurred(
72 base::PlatformFileError* out_error_code) const OVERRIDE; 75 base::PlatformFileError* out_error_code) const OVERRIDE;
73 virtual void ReceivedContentWasMalformed() OVERRIDE; 76 virtual void ReceivedContentWasMalformed() OVERRIDE;
74 virtual bool GetResponseAsString( 77 virtual bool GetResponseAsString(
75 std::string* out_response_string) const OVERRIDE; 78 std::string* out_response_string) const OVERRIDE;
76 virtual bool GetResponseAsFilePath( 79 virtual bool GetResponseAsFilePath(
77 bool take_ownership, 80 bool take_ownership,
78 FilePath* out_response_path) const OVERRIDE; 81 FilePath* out_response_path) const OVERRIDE;
79 82
80 static void CancelAll(); 83 static void CancelAll();
81 84
82 protected: 85 protected:
83 // How should the response be stored? 86 // How should the response be stored?
84 enum ResponseDestinationType { 87 enum ResponseDestinationType {
85 STRING, // Default: In a std::string 88 STRING, // Default: In a std::string
86 FILE // Write to a file 89 PERMANENT_FILE, // Write to a permanent file.
90 TEMP_FILE, // Write to a temporary file.
87 }; 91 };
88 92
89 // Returns the delegate. 93 // Returns the delegate.
90 content::URLFetcherDelegate* delegate() const; 94 content::URLFetcherDelegate* delegate() const;
91 95
92 // Used by tests. 96 // Used by tests.
93 const std::string& upload_data() const; 97 const std::string& upload_data() const;
94 98
95 // Used by tests. 99 // Used by tests.
96 void set_was_fetched_via_proxy(bool flag); 100 void set_was_fetched_via_proxy(bool flag);
(...skipping 19 matching lines...) Expand all
116 // NOTE: for safety, this should only be used through ScopedURLFetcherFactory! 120 // NOTE: for safety, this should only be used through ScopedURLFetcherFactory!
117 static void set_factory(content::URLFetcherFactory* factory); 121 static void set_factory(content::URLFetcherFactory* factory);
118 122
119 class Core; 123 class Core;
120 scoped_refptr<Core> core_; 124 scoped_refptr<Core> core_;
121 125
122 DISALLOW_COPY_AND_ASSIGN(URLFetcherImpl); 126 DISALLOW_COPY_AND_ASSIGN(URLFetcherImpl);
123 }; 127 };
124 128
125 #endif // CONTENT_COMMON_NET_URL_FETCHER_IMPL_H_ 129 #endif // CONTENT_COMMON_NET_URL_FETCHER_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/net/url_fetcher_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698