OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_BASE_NET_MODULE_H__ | 5 #ifndef NET_BASE_NET_MODULE_H__ |
6 #define NET_BASE_NET_MODULE_H__ | 6 #define NET_BASE_NET_MODULE_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
11 #include "net/base/net_api.h" | 11 #include "net/base/net_export.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 // Defines global initializers and associated methods for the net module. | 15 // Defines global initializers and associated methods for the net module. |
16 // | 16 // |
17 // The network module does not have direct access to the way application | 17 // The network module does not have direct access to the way application |
18 // resources are stored and fetched by the embedding application (e.g., it | 18 // resources are stored and fetched by the embedding application (e.g., it |
19 // cannot see the ResourceBundle class used by Chrome), so it uses this API to | 19 // cannot see the ResourceBundle class used by Chrome), so it uses this API to |
20 // get access to such resources. | 20 // get access to such resources. |
21 // | 21 // |
22 class NET_API NetModule { | 22 class NET_EXPORT NetModule { |
23 public: | 23 public: |
24 typedef base::StringPiece (*ResourceProvider)(int key); | 24 typedef base::StringPiece (*ResourceProvider)(int key); |
25 | 25 |
26 // Set the function to call when the net module needs resources | 26 // Set the function to call when the net module needs resources |
27 static void SetResourceProvider(ResourceProvider func); | 27 static void SetResourceProvider(ResourceProvider func); |
28 | 28 |
29 // Call the resource provider (if one exists) to get the specified resource. | 29 // Call the resource provider (if one exists) to get the specified resource. |
30 // Returns an empty string if the resource does not exist or if there is no | 30 // Returns an empty string if the resource does not exist or if there is no |
31 // resource provider. | 31 // resource provider. |
32 static base::StringPiece GetResource(int key); | 32 static base::StringPiece GetResource(int key); |
33 | 33 |
34 private: | 34 private: |
35 DISALLOW_IMPLICIT_CONSTRUCTORS(NetModule); | 35 DISALLOW_IMPLICIT_CONSTRUCTORS(NetModule); |
36 }; | 36 }; |
37 | 37 |
38 } // namespace net | 38 } // namespace net |
39 | 39 |
40 #endif // NET_BASE_NET_MODULE_H__ | 40 #endif // NET_BASE_NET_MODULE_H__ |
OLD | NEW |