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

Unified Diff: extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.h

Issue 1056533002: Implement <webview>.addContentScript/removeContentScript API [2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webview_addremove_contentscripts_2
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
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..8142da8048e55e06e0c9619facb495faafc99ae4
--- /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_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"
+#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_GUEST_VIEW_WEB_VIEW_WEB_UI_URL_FETCHER_H

Powered by Google App Engine
This is Rietveld 408576698