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

Side by Side Diff: content/renderer/fetchers/web_url_loader_client_impl.h

Issue 532773002: Implement ManifestFetcher, helper to fetch Web Manifests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
(Empty)
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.
4
5 #ifndef CONTENT_RENDERER_FETCHERS_WEB_URL_LOADER_CLIENT_IMPL_H_
6 #define CONTENT_RENDERER_FETCHERS_WEB_URL_LOADER_CLIENT_IMPL_H_
7
8 #include <string>
9
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"
13
14 namespace blink {
15 class WebURLLoader;
16 struct WebURLError;
17 }
18
19 namespace content {
20
21 class WebURLLoaderClientImpl : public blink::WebURLLoaderClient {
22 protected:
23 enum LoadStatus {
24 LOADING,
25 LOAD_FAILED,
26 LOAD_SUCCEEDED,
27 };
28
29 WebURLLoaderClientImpl();
30 virtual ~WebURLLoaderClientImpl();
31
32 virtual void Cancel();
33
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_; }
39
40 virtual void OnLoadComplete() = 0;
41
42 private:
43 void OnLoadCompleteInternal(LoadStatus);
44
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,
52 const char* data,
53 int data_length,
54 int encoded_data_length);
55 virtual void didFinishLoading(
56 blink::WebURLLoader* loader,
57 double finishTime,
58 int64_t total_encoded_data_length);
59 virtual void didFail(
60 blink::WebURLLoader* loader, const blink::WebURLError& error);
61
62 private:
63 // Set to true once the request is complete.
64 bool completed_;
65
66 // Buffer to hold the content from the server.
67 std::string data_;
68
69 // A copy of the original resource response.
70 blink::WebURLResponse response_;
71
72 // Buffer to hold metadata from the cache.
73 std::string metadata_;
74
75 LoadStatus status_;
76
77 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderClientImpl);
78 };
79
80 } // namespace content
81
82 #endif // CONTENT_RENDERER_FETCHERS_URL_LOADER_CLIENT_H_
OLDNEW
« no previous file with comments | « content/renderer/fetchers/resource_fetcher_impl.cc ('k') | content/renderer/fetchers/web_url_loader_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698