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

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

Issue 2928033002: Move GetDocument method from WebFrame to WebLocalFrame. (Closed)
Patch Set: Split a DCHECK in two as suggested by boliu@. Created 3 years, 6 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #ifndef CONTENT_RENDERER_FETCHERS_MANIFEST_FETCHER_H_ 5 #ifndef CONTENT_RENDERER_FETCHERS_MANIFEST_FETCHER_H_
6 #define CONTENT_RENDERER_FETCHERS_MANIFEST_FETCHER_H_ 6 #define CONTENT_RENDERER_FETCHERS_MANIFEST_FETCHER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "third_party/WebKit/public/platform/WebURLResponse.h" 14 #include "third_party/WebKit/public/platform/WebURLResponse.h"
15 15
16 class GURL; 16 class GURL;
17 17
18 namespace blink { 18 namespace blink {
19 class WebFrame; 19 class WebLocalFrame;
20 } 20 }
21 21
22 namespace content { 22 namespace content {
23 23
24 class AssociatedResourceFetcher; 24 class AssociatedResourceFetcher;
25 25
26 // Helper class to download a Web Manifest. When an instance is created, the 26 // Helper class to download a Web Manifest. When an instance is created, the
27 // caller need to call Start() and wait for the passed callback to be executed. 27 // caller need to call Start() and wait for the passed callback to be executed.
28 // If the fetch fails, the callback will be called with two empty objects. 28 // If the fetch fails, the callback will be called with two empty objects.
29 class CONTENT_EXPORT ManifestFetcher { 29 class CONTENT_EXPORT ManifestFetcher {
30 public: 30 public:
31 // This will be called asynchronously after the URL has been fetched, 31 // This will be called asynchronously after the URL has been fetched,
32 // successfully or not. If there is a failure, response and data will both be 32 // successfully or not. If there is a failure, response and data will both be
33 // empty. |response| and |data| are both valid until the URLFetcher instance 33 // empty. |response| and |data| are both valid until the URLFetcher instance
34 // is destroyed. 34 // is destroyed.
35 typedef base::Callback<void(const blink::WebURLResponse& response, 35 typedef base::Callback<void(const blink::WebURLResponse& response,
36 const std::string& data)> Callback; 36 const std::string& data)> Callback;
37 37
38 explicit ManifestFetcher(const GURL& url); 38 explicit ManifestFetcher(const GURL& url);
39 virtual ~ManifestFetcher(); 39 virtual ~ManifestFetcher();
40 40
41 void Start(blink::WebFrame* frame, 41 void Start(blink::WebLocalFrame* frame,
42 bool use_credentials, 42 bool use_credentials,
43 const Callback& callback); 43 const Callback& callback);
44 void Cancel(); 44 void Cancel();
45 45
46 private: 46 private:
47 void OnLoadComplete(const blink::WebURLResponse& response, 47 void OnLoadComplete(const blink::WebURLResponse& response,
48 const std::string& data); 48 const std::string& data);
49 49
50 bool completed_; 50 bool completed_;
51 Callback callback_; 51 Callback callback_;
52 std::unique_ptr<AssociatedResourceFetcher> fetcher_; 52 std::unique_ptr<AssociatedResourceFetcher> fetcher_;
53 53
54 DISALLOW_COPY_AND_ASSIGN(ManifestFetcher); 54 DISALLOW_COPY_AND_ASSIGN(ManifestFetcher);
55 }; 55 };
56 56
57 } // namespace content 57 } // namespace content
58 58
59 #endif // CONTENT_RENDERER_FETCHERS_MANIFEST_FETCHER_H_ 59 #endif // CONTENT_RENDERER_FETCHERS_MANIFEST_FETCHER_H_
OLDNEW
« no previous file with comments | « content/renderer/fetchers/associated_resource_fetcher_impl.cc ('k') | content/renderer/fetchers/manifest_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698