OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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 EXTENSIONS_BROWSER_WEB_UI_URL_FETCHER_H | |
Fady Samuel
2015/04/20 13:01:04
Update this?
Xi Han
2015/04/20 22:40:10
Done.
| |
6 #define EXTENSIONS_BROWSER_WEB_UI_URL_FETCHER_H | |
7 | |
8 #include "net/url_request/url_fetcher.h" | |
9 #include "net/url_request/url_fetcher_delegate.h" | |
10 | |
11 namespace content { | |
12 class BrowserContext; | |
13 } | |
14 | |
15 // WebUIURLFetcher downloads the content of a file by giving its |url| on WebUI. | |
16 // Each WebUIURLFetcher is associated with a given |render_process_id, | |
17 // render_view_id| pair. | |
18 class WebUIURLFetcher : public net::URLFetcherDelegate { | |
19 public: | |
20 // Called when a file URL request is complete. | |
21 // Parameters: | |
22 // - whether the request is success. | |
23 // - If yes, the content of the file. | |
24 using WebUILoadFileCallback = base::Callback<void(bool, const std::string&)>; | |
25 | |
26 WebUIURLFetcher(content::BrowserContext* context, | |
27 const WebUILoadFileCallback& callback); | |
28 ~WebUIURLFetcher() override; | |
29 | |
30 void Start(int render_process_id, int render_view_id, const GURL& url); | |
31 | |
32 private: | |
33 // net::URLFetcherDelegate: | |
34 void OnURLFetchComplete(const net::URLFetcher* source) override; | |
35 | |
36 content::BrowserContext* context_; | |
37 WebUILoadFileCallback callback_; | |
38 scoped_ptr<net::URLFetcher> fetcher_; | |
39 | |
40 DISALLOW_COPY_AND_ASSIGN(WebUIURLFetcher); | |
41 }; | |
42 | |
43 #endif // EXTENSIONS_BROWSER_WEB_UI_URL_FETCHER_H | |
OLD | NEW |