OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // A library to manage RLZ information for access-points shared | 5 // A library to manage RLZ information for access-points shared |
6 // across different client applications. | 6 // across different client applications. |
7 // | 7 // |
8 // All functions return true on success and false on error. | 8 // All functions return true on success and false on error. |
9 // This implemenation is thread safe. | 9 // This implemenation is thread safe. |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 #endif | 37 #endif |
38 #if !defined(RLZ_NETWORK_IMPLEMENTATION_WIN_INET) && \ | 38 #if !defined(RLZ_NETWORK_IMPLEMENTATION_WIN_INET) && \ |
39 !defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET) | 39 !defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET) |
40 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
41 #define RLZ_NETWORK_IMPLEMENTATION_WIN_INET | 41 #define RLZ_NETWORK_IMPLEMENTATION_WIN_INET |
42 #else | 42 #else |
43 #define RLZ_NETWORK_IMPLEMENTATION_CHROME_NET | 43 #define RLZ_NETWORK_IMPLEMENTATION_CHROME_NET |
44 #endif | 44 #endif |
45 #endif | 45 #endif |
46 | 46 |
| 47 #if defined(OS_CHROMEOS) |
| 48 namespace base { |
| 49 class SequencedTaskRunner; |
| 50 } // namespace base |
| 51 #endif |
| 52 |
47 #if defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET) | 53 #if defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET) |
48 namespace net { | 54 namespace net { |
49 class URLRequestContextGetter; | 55 class URLRequestContextGetter; |
50 } // namespace net | 56 } // namespace net |
51 #endif | 57 #endif |
52 | 58 |
53 namespace rlz_lib { | 59 namespace rlz_lib { |
54 | 60 |
55 class ScopedRlzValueStoreLock; | 61 class ScopedRlzValueStoreLock; |
56 | 62 |
57 // The maximum length of an access points RLZ in bytes. | 63 // The maximum length of an access points RLZ in bytes. |
58 const size_t kMaxRlzLength = 64; | 64 const size_t kMaxRlzLength = 64; |
59 // The maximum length of an access points RLZ in bytes. | 65 // The maximum length of an access points RLZ in bytes. |
60 const size_t kMaxDccLength = 128; | 66 const size_t kMaxDccLength = 128; |
61 // The maximum length of a CGI string in bytes. | 67 // The maximum length of a CGI string in bytes. |
62 const size_t kMaxCgiLength = 2048; | 68 const size_t kMaxCgiLength = 2048; |
63 // The maximum length of a ping response we will parse in bytes. If the response | 69 // The maximum length of a ping response we will parse in bytes. If the response |
64 // is bigger, please break it up into separate calls. | 70 // is bigger, please break it up into separate calls. |
65 const size_t kMaxPingResponseLength = 0x4000; // 16K | 71 const size_t kMaxPingResponseLength = 0x4000; // 16K |
66 | 72 |
67 #if defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET) | 73 #if defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET) |
68 // Set the URLRequestContextGetter used by SendFinancialPing(). The IO message | 74 // Set the URLRequestContextGetter used by SendFinancialPing(). The IO message |
69 // loop returned by this context will be used for the IO done by | 75 // loop returned by this context will be used for the IO done by |
70 // SendFinancialPing(). | 76 // SendFinancialPing(). |
71 bool RLZ_LIB_API SetURLRequestContext(net::URLRequestContextGetter* context); | 77 bool RLZ_LIB_API SetURLRequestContext(net::URLRequestContextGetter* context); |
72 #endif | 78 #endif |
73 | 79 |
| 80 #if defined(OS_CHROMEOS) |
| 81 // Set the MessageLoopProxy used by RLZ store to run I/O tasks on. Should be |
| 82 // called before any other API calls. |
| 83 void RLZ_LIB_API SetIOTaskRunner(base::SequencedTaskRunner* io_task_runner); |
| 84 #endif |
| 85 |
74 // RLZ storage functions. | 86 // RLZ storage functions. |
75 | 87 |
76 // Get all the events reported by this product as a CGI string to append to | 88 // Get all the events reported by this product as a CGI string to append to |
77 // the daily ping. | 89 // the daily ping. |
78 // Access: HKCU read. | 90 // Access: HKCU read. |
79 bool RLZ_LIB_API GetProductEventsAsCgi(Product product, char* unescaped_cgi, | 91 bool RLZ_LIB_API GetProductEventsAsCgi(Product product, char* unescaped_cgi, |
80 size_t unescaped_cgi_size); | 92 size_t unescaped_cgi_size); |
81 | 93 |
82 // Records an RLZ event. | 94 // Records an RLZ event. |
83 // Some events can be product-independent (e.g: First search from home page), | 95 // Some events can be product-independent (e.g: First search from home page), |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 | 338 |
327 static const std::string& GetBrand(); | 339 static const std::string& GetBrand(); |
328 | 340 |
329 private: | 341 private: |
330 ScopedRlzValueStoreLock* lock_; | 342 ScopedRlzValueStoreLock* lock_; |
331 }; | 343 }; |
332 | 344 |
333 } // namespace rlz_lib | 345 } // namespace rlz_lib |
334 | 346 |
335 #endif // RLZ_LIB_RLZ_LIB_H_ | 347 #endif // RLZ_LIB_RLZ_LIB_H_ |
OLD | NEW |