Chromium Code Reviews| Index: extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.h |
| diff --git a/extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.h b/extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4ee7270da24104ecd5619280c41104ac91d30391 |
| --- /dev/null |
| +++ b/extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.h |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#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.
|
| +#define EXTENSIONS_BROWSER_WEB_UI_URL_FETCHER_H |
| + |
| +#include "net/url_request/url_fetcher.h" |
| +#include "net/url_request/url_fetcher_delegate.h" |
| + |
| +namespace content { |
| +class BrowserContext; |
| +} |
| + |
| +// WebUIURLFetcher downloads the content of a file by giving its |url| on WebUI. |
| +// Each WebUIURLFetcher is associated with a given |render_process_id, |
| +// render_view_id| pair. |
| +class WebUIURLFetcher : public net::URLFetcherDelegate { |
| + public: |
| + // Called when a file URL request is complete. |
| + // Parameters: |
| + // - whether the request is success. |
| + // - If yes, the content of the file. |
| + using WebUILoadFileCallback = base::Callback<void(bool, const std::string&)>; |
| + |
| + WebUIURLFetcher(content::BrowserContext* context, |
| + const WebUILoadFileCallback& callback); |
| + ~WebUIURLFetcher() override; |
| + |
| + void Start(int render_process_id, int render_view_id, const GURL& url); |
| + |
| + private: |
| + // net::URLFetcherDelegate: |
| + void OnURLFetchComplete(const net::URLFetcher* source) override; |
| + |
| + content::BrowserContext* context_; |
| + WebUILoadFileCallback callback_; |
| + scoped_ptr<net::URLFetcher> fetcher_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WebUIURLFetcher); |
| +}; |
| + |
| +#endif // EXTENSIONS_BROWSER_WEB_UI_URL_FETCHER_H |