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

Side by Side Diff: webkit/glue/resource_fetcher.h

Issue 8741006: Add exports needed for glue to build as a component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase to r112585 Created 9 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 | Annotate | Revision Log
« no previous file with comments | « webkit/glue/password_form_dom_manager.h ('k') | webkit/glue/resource_loader_bridge.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // A wrapper around ResourceHandle and ResourceHandleClient that simplifies 5 // A wrapper around ResourceHandle and ResourceHandleClient that simplifies
6 // the download of an HTTP object. The interface is modeled after URLFetcher 6 // the download of an HTTP object. The interface is modeled after URLFetcher
7 // in the /chrome/browser. 7 // in the /chrome/browser.
8 // 8 //
9 // ResourceFetcher::Delegate::OnURLFetchComplete will be called async after 9 // ResourceFetcher::Delegate::OnURLFetchComplete will be called async after
10 // the ResourceFetcher object is created. 10 // the ResourceFetcher object is created.
11 11
12 #ifndef WEBKIT_GLUE_RESOURCE_FETCHER_H_ 12 #ifndef WEBKIT_GLUE_RESOURCE_FETCHER_H_
13 #define WEBKIT_GLUE_RESOURCE_FETCHER_H_ 13 #define WEBKIT_GLUE_RESOURCE_FETCHER_H_
14 14
15 #include <string> 15 #include <string>
16 16
17 #include "base/basictypes.h" 17 #include "base/basictypes.h"
18 #include "base/callback.h" 18 #include "base/callback.h"
19 #include "base/compiler_specific.h"
19 #include "base/memory/scoped_ptr.h" 20 #include "base/memory/scoped_ptr.h"
20 #include "base/timer.h" 21 #include "base/timer.h"
21 #include "googleurl/src/gurl.h" 22 #include "googleurl/src/gurl.h"
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoaderClient.h" 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoaderClient.h"
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h"
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h"
26 #include "webkit/glue/webkit_glue_export.h"
25 27
26 class GURL; 28 class GURL;
27 29
28 namespace WebKit { 30 namespace WebKit {
29 class WebFrame; 31 class WebFrame;
30 class WebURLLoader; 32 class WebURLLoader;
31 struct WebURLError; 33 struct WebURLError;
32 } 34 }
33 35
34 namespace webkit_glue { 36 namespace webkit_glue {
35 37
36 class ResourceFetcher : public WebKit::WebURLLoaderClient { 38 class WEBKIT_GLUE_EXPORT ResourceFetcher :
39 NON_EXPORTED_BASE(public WebKit::WebURLLoaderClient) {
37 public: 40 public:
38 // This will be called when the URL has been fetched, successfully or not. 41 // This will be called when the URL has been fetched, successfully or not.
39 // If there is a failure, response and data will both be empty. |response| 42 // If there is a failure, response and data will both be empty. |response|
40 // and |data| are both valid until the URLFetcher instance is destroyed. 43 // and |data| are both valid until the URLFetcher instance is destroyed.
41 typedef base::Callback<void(const WebKit::WebURLResponse&, 44 typedef base::Callback<void(const WebKit::WebURLResponse&,
42 const std::string&)> Callback; 45 const std::string&)> Callback;
43 46
44 // We need a frame to make requests. 47 // We need a frame to make requests.
45 ResourceFetcher( 48 ResourceFetcher(
46 const GURL& url, WebKit::WebFrame* frame, 49 const GURL& url, WebKit::WebFrame* frame,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 103
101 // Buffer to hold the content from the server. 104 // Buffer to hold the content from the server.
102 std::string data_; 105 std::string data_;
103 106
104 // Buffer to hold metadata from the cache. 107 // Buffer to hold metadata from the cache.
105 std::string metadata_; 108 std::string metadata_;
106 }; 109 };
107 110
108 ///////////////////////////////////////////////////////////////////////////// 111 /////////////////////////////////////////////////////////////////////////////
109 // A resource fetcher with a timeout 112 // A resource fetcher with a timeout
110 class ResourceFetcherWithTimeout : public ResourceFetcher { 113 class WEBKIT_GLUE_EXPORT ResourceFetcherWithTimeout : public ResourceFetcher {
111 public: 114 public:
112 ResourceFetcherWithTimeout(const GURL& url, 115 ResourceFetcherWithTimeout(const GURL& url,
113 WebKit::WebFrame* frame, 116 WebKit::WebFrame* frame,
114 WebKit::WebURLRequest::TargetType target_type, 117 WebKit::WebURLRequest::TargetType target_type,
115 int timeout_secs, 118 int timeout_secs,
116 const Callback& callback); 119 const Callback& callback);
117 virtual ~ResourceFetcherWithTimeout(); 120 virtual ~ResourceFetcherWithTimeout();
118 121
119 private: 122 private:
120 // Callback for timer that limits how long we wait for the alternate error 123 // Callback for timer that limits how long we wait for the alternate error
121 // page server. If this timer fires and the request hasn't completed, we 124 // page server. If this timer fires and the request hasn't completed, we
122 // kill the request. 125 // kill the request.
123 void TimeoutFired(); 126 void TimeoutFired();
124 127
125 // Limit how long we wait for the alternate error page server. 128 // Limit how long we wait for the alternate error page server.
126 base::OneShotTimer<ResourceFetcherWithTimeout> timeout_timer_; 129 base::OneShotTimer<ResourceFetcherWithTimeout> timeout_timer_;
127 }; 130 };
128 131
129 } // namespace webkit_glue 132 } // namespace webkit_glue
130 133
131 #endif // WEBKIT_GLUE_RESOURCE_FETCHER_H_ 134 #endif // WEBKIT_GLUE_RESOURCE_FETCHER_H_
OLDNEW
« no previous file with comments | « webkit/glue/password_form_dom_manager.h ('k') | webkit/glue/resource_loader_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698