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..c774cdcda67dfa6b6c81f7b7b1a242344fae3daf |
--- /dev/null |
+++ b/extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.h |
@@ -0,0 +1,49 @@ |
+// 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_GUEST_VIEW_WEB_VIEW_WEB_UI_URL_FETCHER_H |
+#define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_UI_URL_FETCHER_H |
+ |
+#include "net/url_request/url_fetcher.h" |
Devlin
2015/04/22 21:15:33
Forward declaration?
Xi Han
2015/04/22 22:34:00
We use scoped_ptr<net::URLFetcher> fetcher_, so we
Devlin
2015/04/22 23:20:50
scoped_ptr needs only a forward declaration.
Xi Han
2015/04/23 15:01:55
It seems yes, I got a wrong understanding for a lo
|
+#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, |
+ int render_process_id, |
+ int render_view_id, |
+ const GURL& url, |
+ const WebUILoadFileCallback& callback); |
+ ~WebUIURLFetcher() override; |
+ |
+ void Start(); |
+ |
+ private: |
+ // net::URLFetcherDelegate: |
+ void OnURLFetchComplete(const net::URLFetcher* source) override; |
+ |
+ content::BrowserContext* context_; |
+ int render_process_id_; |
+ int render_view_id_; |
+ GURL url_; |
+ WebUILoadFileCallback callback_; |
+ scoped_ptr<net::URLFetcher> fetcher_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(WebUIURLFetcher); |
+}; |
+ |
+#endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_UI_URL_FETCHER_H |