| 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 #ifndef CHROME_BROWSER_RLZ_RLZ_H_ | 5 #ifndef CHROME_BROWSER_RLZ_RLZ_H_ |
| 6 #define CHROME_BROWSER_RLZ_RLZ_H_ | 6 #define CHROME_BROWSER_RLZ_RLZ_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #if defined(ENABLE_RLZ) | 10 #if defined(ENABLE_RLZ) |
| 11 | 11 |
| 12 #include <map> | 12 #include <map> |
| 13 #include <string> | 13 #include <string> |
| 14 | 14 |
| 15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 16 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
| 17 #include "base/string16.h" | 17 #include "base/string16.h" |
| 18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
| 19 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
| 20 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
| 21 #include "rlz/lib/rlz_lib.h" | 21 #include "rlz/lib/rlz_lib.h" |
| 22 | 22 |
| 23 class Profile; |
| 23 namespace net { | 24 namespace net { |
| 24 class URLRequestContextGetter; | 25 class URLRequestContextGetter; |
| 25 } | 26 } |
| 26 | 27 |
| 27 // RLZ is a library which is used to measure distribution scenarios. | 28 // RLZ is a library which is used to measure distribution scenarios. |
| 28 // Its job is to record certain lifetime events in the registry and to send | 29 // Its job is to record certain lifetime events in the registry and to send |
| 29 // them encoded as a compact string at most twice. The sent data does | 30 // them encoded as a compact string at most twice. The sent data does |
| 30 // not contain information that can be used to identify a user or to infer | 31 // not contain information that can be used to identify a user or to infer |
| 31 // browsing habits. The API in this file is a wrapper around the open source | 32 // browsing habits. The API in this file is a wrapper around the open source |
| 32 // RLZ library which can be found at http://code.google.com/p/rlz. | 33 // RLZ library which can be found at http://code.google.com/p/rlz. |
| 33 // | 34 // |
| 34 // For partner or bundled installs, the RLZ might send more information | 35 // For partner or bundled installs, the RLZ might send more information |
| 35 // according to the terms disclosed in the EULA. | 36 // according to the terms disclosed in the EULA. |
| 36 | 37 |
| 37 class RLZTracker : public content::NotificationObserver { | 38 class RLZTracker : public content::NotificationObserver { |
| 38 public: | 39 public: |
| 39 // Initializes the RLZ library services for use in chrome. Schedules a | 40 // Initializes the RLZ library services for use in chrome. Schedules a |
| 40 // delayed task (delayed by |delay| seconds) that performs the ping and | 41 // delayed task (delayed by |delay| seconds) that performs the ping and |
| 41 // registers some events when 'first-run' is true. | 42 // registers some events when 'first-run' is true. |
| 42 // | 43 // |
| 43 // If the chrome brand is organic (no partners) then the pings don't occur. | 44 // If the chrome brand is organic (no partners) then the pings don't occur. |
| 44 static bool InitRlzDelayed(bool first_run, | 45 static bool InitRlzDelayed(bool first_run, |
| 45 int delay, | 46 int delay, |
| 46 bool is_google_default_search, | 47 bool is_google_default_search, |
| 47 bool is_google_homepage, | 48 bool is_google_homepage, |
| 48 bool is_google_in_startpages); | 49 bool is_google_in_startpages); |
| 49 | 50 |
| 51 // Shortcut for InitRlzDelayed which retrieves parameters from |profile|. |
| 52 static bool InitRlzFromProfileDelayed(Profile* profile, |
| 53 bool first_run, |
| 54 int delay); |
| 55 |
| 50 // Records an RLZ event. Some events can be access point independent. | 56 // Records an RLZ event. Some events can be access point independent. |
| 51 // Returns false it the event could not be recorded. Requires write access | 57 // Returns false it the event could not be recorded. Requires write access |
| 52 // to the HKCU registry hive on windows. | 58 // to the HKCU registry hive on windows. |
| 53 static bool RecordProductEvent(rlz_lib::Product product, | 59 static bool RecordProductEvent(rlz_lib::Product product, |
| 54 rlz_lib::AccessPoint point, | 60 rlz_lib::AccessPoint point, |
| 55 rlz_lib::Event event_id); | 61 rlz_lib::Event event_id); |
| 56 | 62 |
| 57 // For the point parameter of RecordProductEvent. | 63 // For the point parameter of RecordProductEvent. |
| 58 static const rlz_lib::AccessPoint CHROME_OMNIBOX; | 64 static const rlz_lib::AccessPoint CHROME_OMNIBOX; |
| 59 static const rlz_lib::AccessPoint CHROME_HOME_PAGE; | 65 static const rlz_lib::AccessPoint CHROME_HOME_PAGE; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 bool homepage_used_; | 200 bool homepage_used_; |
| 195 | 201 |
| 196 content::NotificationRegistrar registrar_; | 202 content::NotificationRegistrar registrar_; |
| 197 | 203 |
| 198 DISALLOW_COPY_AND_ASSIGN(RLZTracker); | 204 DISALLOW_COPY_AND_ASSIGN(RLZTracker); |
| 199 }; | 205 }; |
| 200 | 206 |
| 201 #endif // defined(ENABLE_RLZ) | 207 #endif // defined(ENABLE_RLZ) |
| 202 | 208 |
| 203 #endif // CHROME_BROWSER_RLZ_RLZ_H_ | 209 #endif // CHROME_BROWSER_RLZ_RLZ_H_ |
| OLD | NEW |