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

Side by Side Diff: net/base/net_module.h

Issue 11506: Make the net resource interface use StringPiece instead of std::string. This... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browser_main.cc ('k') | net/base/net_module.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/string_piece.h"
11 12
12 namespace net { 13 namespace net {
13 14
14 // Defines global initializers and associated methods for the net module. 15 // Defines global initializers and associated methods for the net module.
15 // 16 //
16 // 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
17 // 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
18 // 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
19 // get access to such resources. 20 // get access to such resources.
20 // 21 //
21 class NetModule { 22 class NetModule {
22 public: 23 public:
23 typedef std::string (*ResourceProvider)(int key); 24 typedef StringPiece (*ResourceProvider)(int key);
24 25
25 // Set the function to call when the net module needs resources 26 // Set the function to call when the net module needs resources
26 static void SetResourceProvider(ResourceProvider func); 27 static void SetResourceProvider(ResourceProvider func);
27 28
28 // 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.
29 // 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
30 // resource provider. 31 // resource provider.
31 static std::string GetResource(int key); 32 static StringPiece GetResource(int key);
32 33
33 private: 34 private:
34 DISALLOW_IMPLICIT_CONSTRUCTORS(NetModule); 35 DISALLOW_IMPLICIT_CONSTRUCTORS(NetModule);
35 }; 36 };
36 37
37 } // namespace net 38 } // namespace net
38 39
39 #endif // NET_BASE_NET_MODULE_H__ 40 #endif // NET_BASE_NET_MODULE_H__
40 41
OLDNEW
« no previous file with comments | « chrome/browser/browser_main.cc ('k') | net/base/net_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698