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

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

Issue 584553002: Extend the TestRunner so that the manifest-src CSP directive can be tested from layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Second try Created 6 years, 2 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 <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "content/common/content_export.h"
13 #include "third_party/WebKit/public/platform/WebURLResponse.h" 14 #include "third_party/WebKit/public/platform/WebURLResponse.h"
14 15
15 class GURL; 16 class GURL;
16 17
17 namespace blink { 18 namespace blink {
18 class WebFrame; 19 class WebFrame;
19 } 20 }
20 21
21 namespace content { 22 namespace content {
22 23
23 class ResourceFetcher; 24 class ResourceFetcher;
24 25
25 // 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
26 // 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.
27 // 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.
28 class ManifestFetcher { 29 class CONTENT_EXPORT ManifestFetcher {
29 public: 30 public:
30 // This will be called asynchronously after the URL has been fetched, 31 // 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 // 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 // empty. |response| and |data| are both valid until the URLFetcher instance
33 // is destroyed. 34 // is destroyed.
34 typedef base::Callback<void(const blink::WebURLResponse& response, 35 typedef base::Callback<void(const blink::WebURLResponse& response,
35 const std::string& data)> Callback; 36 const std::string& data)> Callback;
36 37
37 explicit ManifestFetcher(const GURL& url); 38 explicit ManifestFetcher(const GURL& url);
38 virtual ~ManifestFetcher(); 39 virtual ~ManifestFetcher();
39 40
40 void Start(blink::WebFrame* frame, const Callback& callback); 41 void Start(blink::WebFrame* frame, const Callback& callback);
41 void Cancel(); 42 void Cancel();
42 43
43 private: 44 private:
44 void OnLoadComplete(const blink::WebURLResponse& response, 45 void OnLoadComplete(const blink::WebURLResponse& response,
45 const std::string& data); 46 const std::string& data);
46 47
47 bool completed_; 48 bool completed_;
48 Callback callback_; 49 Callback callback_;
49 scoped_ptr<ResourceFetcher> fetcher_; 50 scoped_ptr<ResourceFetcher> fetcher_;
50 51
51 DISALLOW_COPY_AND_ASSIGN(ManifestFetcher); 52 DISALLOW_COPY_AND_ASSIGN(ManifestFetcher);
52 }; 53 };
53 54
54 } // namespace content 55 } // namespace content
55 56
56 #endif // CONTENT_RENDERER_FETCHERS_MANIFEST_FETCHER_H_ 57 #endif // CONTENT_RENDERER_FETCHERS_MANIFEST_FETCHER_H_
OLDNEW
« no previous file with comments | « content/public/test/layouttest_support.h ('k') | content/shell/renderer/test_runner/test_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698