| 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 | |
| 53 #if defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET) | 47 #if defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET) |
| 54 namespace net { | 48 namespace net { |
| 55 class URLRequestContextGetter; | 49 class URLRequestContextGetter; |
| 56 } // namespace net | 50 } // namespace net |
| 57 #endif | 51 #endif |
| 58 | 52 |
| 59 namespace rlz_lib { | 53 namespace rlz_lib { |
| 60 | 54 |
| 61 class ScopedRlzValueStoreLock; | 55 class ScopedRlzValueStoreLock; |
| 62 | 56 |
| 63 // The maximum length of an access points RLZ in bytes. | 57 // The maximum length of an access points RLZ in bytes. |
| 64 const size_t kMaxRlzLength = 64; | 58 const size_t kMaxRlzLength = 64; |
| 65 // The maximum length of an access points RLZ in bytes. | 59 // The maximum length of an access points RLZ in bytes. |
| 66 const size_t kMaxDccLength = 128; | 60 const size_t kMaxDccLength = 128; |
| 67 // The maximum length of a CGI string in bytes. | 61 // The maximum length of a CGI string in bytes. |
| 68 const size_t kMaxCgiLength = 2048; | 62 const size_t kMaxCgiLength = 2048; |
| 69 // The maximum length of a ping response we will parse in bytes. If the response | 63 // The maximum length of a ping response we will parse in bytes. If the response |
| 70 // is bigger, please break it up into separate calls. | 64 // is bigger, please break it up into separate calls. |
| 71 const size_t kMaxPingResponseLength = 0x4000; // 16K | 65 const size_t kMaxPingResponseLength = 0x4000; // 16K |
| 72 | 66 |
| 73 #if defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET) | 67 #if defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET) |
| 74 // Set the URLRequestContextGetter used by SendFinancialPing(). The IO message | 68 // Set the URLRequestContextGetter used by SendFinancialPing(). The IO message |
| 75 // loop returned by this context will be used for the IO done by | 69 // loop returned by this context will be used for the IO done by |
| 76 // SendFinancialPing(). | 70 // SendFinancialPing(). |
| 77 bool RLZ_LIB_API SetURLRequestContext(net::URLRequestContextGetter* context); | 71 bool RLZ_LIB_API SetURLRequestContext(net::URLRequestContextGetter* context); |
| 78 #endif | 72 #endif |
| 79 | 73 |
| 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 | |
| 85 // Must be invoked during shutdown to finish any remaining tasks. | |
| 86 void RLZ_LIB_API CleanupRlz(); | |
| 87 #endif | |
| 88 | |
| 89 // RLZ storage functions. | 74 // RLZ storage functions. |
| 90 | 75 |
| 91 // Get all the events reported by this product as a CGI string to append to | 76 // Get all the events reported by this product as a CGI string to append to |
| 92 // the daily ping. | 77 // the daily ping. |
| 93 // Access: HKCU read. | 78 // Access: HKCU read. |
| 94 bool RLZ_LIB_API GetProductEventsAsCgi(Product product, char* unescaped_cgi, | 79 bool RLZ_LIB_API GetProductEventsAsCgi(Product product, char* unescaped_cgi, |
| 95 size_t unescaped_cgi_size); | 80 size_t unescaped_cgi_size); |
| 96 | 81 |
| 97 // Records an RLZ event. | 82 // Records an RLZ event. |
| 98 // Some events can be product-independent (e.g: First search from home page), | 83 // 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... |
| 341 | 326 |
| 342 static const std::string& GetBrand(); | 327 static const std::string& GetBrand(); |
| 343 | 328 |
| 344 private: | 329 private: |
| 345 ScopedRlzValueStoreLock* lock_; | 330 ScopedRlzValueStoreLock* lock_; |
| 346 }; | 331 }; |
| 347 | 332 |
| 348 } // namespace rlz_lib | 333 } // namespace rlz_lib |
| 349 | 334 |
| 350 #endif // RLZ_LIB_RLZ_LIB_H_ | 335 #endif // RLZ_LIB_RLZ_LIB_H_ |
| OLD | NEW |