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