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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_FETCHERS_WEB_URL_LOADER_CLIENT_IMPL_H_
6 #define CONTENT_RENDERER_FETCHERS_WEB_URL_LOADER_CLIENT_IMPL_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
12 #include "third_party/WebKit/public/platform/WebURLResponse.h"
21 class WebURLLoaderClientImpl
: public blink::WebURLLoaderClient
{
29 WebURLLoaderClientImpl();
30 virtual ~WebURLLoaderClientImpl();
32 virtual void Cancel();
34 bool completed() const { return completed_
; }
35 const std::string
& data() const { return data_
; }
36 const blink::WebURLResponse
& response() const { return response_
; }
37 const std::string
& metadata() const { return metadata_
; }
38 LoadStatus
status() const { return status_
; }
40 virtual void OnLoadComplete() = 0;
43 void OnLoadCompleteInternal(LoadStatus
);
45 // WebWebURLLoaderClientImpl methods:
46 virtual void didReceiveResponse(
47 blink::WebURLLoader
* loader
, const blink::WebURLResponse
& response
);
48 virtual void didReceiveCachedMetadata(
49 blink::WebURLLoader
* loader
, const char* data
, int data_length
);
50 virtual void didReceiveData(
51 blink::WebURLLoader
* loader
,
54 int encoded_data_length
);
55 virtual void didFinishLoading(
56 blink::WebURLLoader
* loader
,
58 int64_t total_encoded_data_length
);
60 blink::WebURLLoader
* loader
, const blink::WebURLError
& error
);
63 // Set to true once the request is complete.
66 // Buffer to hold the content from the server.
69 // A copy of the original resource response.
70 blink::WebURLResponse response_
;
72 // Buffer to hold metadata from the cache.
73 std::string metadata_
;
77 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderClientImpl
);
80 } // namespace content
82 #endif // CONTENT_RENDERER_FETCHERS_WEB_URL_LOADER_CLIENT_IMPL_H_