Revert of Move fetching logic out of ApplicationManager, eliminate url mappings....
[chromium-blink-merge.git] / net / base / net_module.h
blob4ac8ab3a9653681f603d31cc00c786522685fb7d
1 // Copyright (c) 2011 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.
5 #ifndef NET_BASE_NET_MODULE_H__
6 #define NET_BASE_NET_MODULE_H__
8 #include "base/basictypes.h"
9 #include "base/strings/string_piece.h"
10 #include "net/base/net_export.h"
12 namespace net {
14 // Defines global initializers and associated methods for the net module.
16 // The network module does not have direct access to the way application
17 // resources are stored and fetched by the embedding application (e.g., it
18 // cannot see the ResourceBundle class used by Chrome), so it uses this API to
19 // get access to such resources.
21 class NET_EXPORT NetModule {
22 public:
23 typedef base::StringPiece (*ResourceProvider)(int key);
25 // Set the function to call when the net module needs resources
26 static void SetResourceProvider(ResourceProvider func);
28 // Call the resource provider (if one exists) to get the specified resource.
29 // Returns an empty string if the resource does not exist or if there is no
30 // resource provider.
31 static base::StringPiece GetResource(int key);
33 private:
34 DISALLOW_IMPLICIT_CONSTRUCTORS(NetModule);
37 } // namespace net
39 #endif // NET_BASE_NET_MODULE_H__