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

Unified Diff: extensions/browser/extension_network_delegate.h

Issue 615583003: Introduce NetworkDelegate's implementation in extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/extension_network_delegate.h
diff --git a/chrome/browser/net/chrome_extensions_network_delegate.h b/extensions/browser/extension_network_delegate.h
similarity index 54%
copy from chrome/browser/net/chrome_extensions_network_delegate.h
copy to extensions/browser/extension_network_delegate.h
index 8f318742b1278a4da125d28dfd93dc89d4caed20..35ac28fa827963654f36f368223c760d806c1547 100644
--- a/chrome/browser/net/chrome_extensions_network_delegate.h
+++ b/extensions/browser/extension_network_delegate.h
@@ -2,48 +2,35 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_NET_CHROME_EXTENSIONS_NETWORK_DELEGATE_H_
-#define CHROME_BROWSER_NET_CHROME_EXTENSIONS_NETWORK_DELEGATE_H_
+#ifndef EXTENSIONS_BROWSER_EXTENSION_NETNETWORK_DELEGATE_H_
+#define EXTENSIONS_BROWSER_EXTENSION_NETNETWORK_DELEGATE_H_
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "base/memory/ref_counted.h"
+#include "content/shell/browser/shell_network_delegate.h"
+#include "extensions/browser/info_map.h"
#include "net/base/network_delegate.h"
namespace extensions {
-class EventRouterForwarder;
+
class InfoMap;
-}
-// ChromeExtensionsNetworkDelegate is the extensions-only portion of
-// ChromeNetworkDelegate. When extensions are disabled, do nothing.
-class ChromeExtensionsNetworkDelegate : public net::NetworkDelegate {
+class ExtensionNetworkDelegate : public content::ShellNetworkDelegate {
public:
- static ChromeExtensionsNetworkDelegate* Create(
- extensions::EventRouterForwarder* event_router);
-
- virtual ~ChromeExtensionsNetworkDelegate();
+ ExtensionNetworkDelegate();
+ virtual ~ExtensionNetworkDelegate();
- // Not inlined because we assign a scoped_refptr, which requires us to include
- // the header file.
- void set_extension_info_map(extensions::InfoMap* extension_info_map);
-
- // If |profile| is NULL or not set, events will be broadcast to all profiles,
- // otherwise they will only be sent to the specified profile.
- void set_profile(void* profile) {
- profile_ = profile;
+ void set_extension_info_map(extensions::InfoMap* extension_info_map) {
+ extension_info_map_ = extension_info_map;
}
- // If the |request| failed due to problems with a proxy, forward the error to
- // the proxy extension API.
- virtual void ForwardProxyErrors(net::URLRequest* request);
-
- // Notifies the extensions::ProcessManager for the associated RenderFrame, if
- // any, that a request has started or stopped.
- virtual void ForwardStartRequestStatus(net::URLRequest* request);
- virtual void ForwardDoneRequestStatus(net::URLRequest* request);
+ // If |browser_context| is NULL or not set, events will be broadcast to all
+ // browser_contexts, otherwise they will only be sent to the specified
+ // browser_context.
+ void set_browser_context(void* browser_context) {
+ browser_context_ = browser_context;
+ }
- // NetworkDelegate implementation.
+ private:
+ // ShellNetworkDelegate implementation.
virtual int OnBeforeURLRequest(net::URLRequest* request,
const net::CompletionCallback& callback,
GURL* new_url) OVERRIDE;
@@ -71,16 +58,12 @@ class ChromeExtensionsNetworkDelegate : public net::NetworkDelegate {
const AuthCallback& callback,
net::AuthCredentials* credentials) OVERRIDE;
- protected:
- ChromeExtensionsNetworkDelegate();
-
- void* profile_;
-
-#if defined(ENABLE_EXTENSIONS)
+ void* browser_context_;
scoped_refptr<extensions::InfoMap> extension_info_map_;
-#endif
- DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsNetworkDelegate);
+ DISALLOW_COPY_AND_ASSIGN(ExtensionNetworkDelegate);
};
-#endif // CHROME_BROWSER_NET_CHROME_EXTENSIONS_NETWORK_DELEGATE_H_
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_EXTENSION_NETNETWORK_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698