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

Side by Side Diff: content/renderer/fetchers/manifest_fetcher.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 2014 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_MANIFEST_FETCHER_H_
6 #define CONTENT_RENDERER_FETCHERS_MANIFEST_FETCHER_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "third_party/WebKit/public/platform/WebURLResponse.h"
14
15 class GURL;
16
17 namespace blink {
18 class WebFrame;
19 }
20
21 namespace content {
22
23 class ResourceFetcher;
24
25 // Helper class to download a Web Manifest. When an instance is created, the
26 // caller need to call Start() and wait for the passed callback to be executed.
27 // If the fetch fails, the callback will be called with two empty objects.
28 class ManifestFetcher {
29 public:
30 // This will be called asynchronously after the URL has been fetched,
31 // successfully or not. If there is a failure, response and data will both be
32 // empty. |response| and |data| are both valid until the URLFetcher instance
33 // is destroyed.
34 typedef base::Callback<void(const blink::WebURLResponse& response,
35 const std::string& data)> Callback;
36
37 explicit ManifestFetcher(const GURL& url);
38 virtual ~ManifestFetcher();
39
40 void Start(blink::WebFrame* frame, const Callback& callback);
41 void Cancel();
42
43 private:
44 void OnLoadComplete(const blink::WebURLResponse& response,
45 const std::string& data);
46
47 bool completed_;
48 Callback callback_;
49 scoped_ptr<ResourceFetcher> fetcher_;
50
51 DISALLOW_COPY_AND_ASSIGN(ManifestFetcher);
52 };
53
54 } // namespace content
55
56 #endif // CONTENT_RENDERER_FETCHERS_MANIFEST_FETCHER_H_
OLDNEW
« no previous file with comments | « content/renderer/fetchers/image_resource_fetcher.cc ('k') | content/renderer/fetchers/manifest_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698