| 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 // This file extends generic BrowserDistribution class to declare Google Chrome | 5 // This file extends generic BrowserDistribution class to declare Google Chrome |
| 6 // specific implementation. | 6 // specific implementation. |
| 7 | 7 |
| 8 #ifndef CHROME_INSTALLER_UTIL_GOOGLE_CHROME_DISTRIBUTION_H_ | 8 #ifndef CHROME_INSTALLER_UTIL_GOOGLE_CHROME_DISTRIBUTION_H_ |
| 9 #define CHROME_INSTALLER_UTIL_GOOGLE_CHROME_DISTRIBUTION_H_ | 9 #define CHROME_INSTALLER_UTIL_GOOGLE_CHROME_DISTRIBUTION_H_ |
| 10 #pragma once | 10 #pragma once |
| 11 | 11 |
| 12 #include <string> | 12 #include "base/string16.h" |
| 13 | |
| 14 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 15 #include "chrome/installer/util/browser_distribution.h" | 14 #include "chrome/installer/util/browser_distribution.h" |
| 16 #include "chrome/installer/util/util_constants.h" | 15 #include "chrome/installer/util/util_constants.h" |
| 17 | 16 |
| 18 class FilePath; | 17 class FilePath; |
| 19 | 18 |
| 20 namespace base { | 19 namespace base { |
| 21 class DictionaryValue; | 20 class DictionaryValue; |
| 22 } | 21 } |
| 23 | 22 |
| 24 class GoogleChromeDistribution : public BrowserDistribution { | 23 class GoogleChromeDistribution : public BrowserDistribution { |
| 25 public: | 24 public: |
| 26 // Opens the Google Chrome uninstall survey window. | 25 // Opens the Google Chrome uninstall survey window. |
| 27 // version refers to the version of Chrome being uninstalled. | 26 // version refers to the version of Chrome being uninstalled. |
| 28 // local_data_path is the path of the file containing json metrics that | 27 // local_data_path is the path of the file containing json metrics that |
| 29 // will be parsed. If this file indicates that the user has opted in to | 28 // will be parsed. If this file indicates that the user has opted in to |
| 30 // providing anonymous usage data, then some additional statistics will | 29 // providing anonymous usage data, then some additional statistics will |
| 31 // be added to the survey url. | 30 // be added to the survey url. |
| 32 // distribution_data contains Google Update related data that will be | 31 // distribution_data contains Google Update related data that will be |
| 33 // concatenated to the survey url if the file in local_data_path indicates | 32 // concatenated to the survey url if the file in local_data_path indicates |
| 34 // the user has opted in to providing anonymous usage data. | 33 // the user has opted in to providing anonymous usage data. |
| 35 virtual void DoPostUninstallOperations( | 34 virtual void DoPostUninstallOperations( |
| 36 const Version& version, | 35 const Version& version, |
| 37 const FilePath& local_data_path, | 36 const FilePath& local_data_path, |
| 38 const std::wstring& distribution_data) OVERRIDE; | 37 const string16& distribution_data) OVERRIDE; |
| 39 | 38 |
| 40 virtual std::wstring GetAppGuid() OVERRIDE; | 39 virtual string16 GetAppGuid() OVERRIDE; |
| 41 | 40 |
| 42 virtual std::wstring GetApplicationName() OVERRIDE; | 41 virtual string16 GetApplicationName() OVERRIDE; |
| 43 | 42 |
| 44 virtual std::wstring GetAlternateApplicationName() OVERRIDE; | 43 virtual string16 GetAppShortCutName() OVERRIDE; |
| 45 | 44 |
| 46 virtual std::wstring GetBrowserAppId() OVERRIDE; | 45 virtual string16 GetAlternateApplicationName() OVERRIDE; |
| 47 | 46 |
| 48 virtual std::wstring GetInstallSubDir() OVERRIDE; | 47 virtual string16 GetBrowserAppId() OVERRIDE; |
| 49 | 48 |
| 50 virtual std::wstring GetPublisherName() OVERRIDE; | 49 virtual string16 GetInstallSubDir() OVERRIDE; |
| 51 | 50 |
| 52 virtual std::wstring GetAppDescription() OVERRIDE; | 51 virtual string16 GetPublisherName() OVERRIDE; |
| 52 |
| 53 virtual string16 GetAppDescription() OVERRIDE; |
| 53 | 54 |
| 54 virtual std::string GetSafeBrowsingName() OVERRIDE; | 55 virtual std::string GetSafeBrowsingName() OVERRIDE; |
| 55 | 56 |
| 56 virtual std::wstring GetStateKey() OVERRIDE; | 57 virtual string16 GetStateKey() OVERRIDE; |
| 57 | 58 |
| 58 virtual std::wstring GetStateMediumKey() OVERRIDE; | 59 virtual string16 GetStateMediumKey() OVERRIDE; |
| 59 | 60 |
| 60 virtual std::wstring GetStatsServerURL() OVERRIDE; | 61 virtual string16 GetStatsServerURL() OVERRIDE; |
| 61 | 62 |
| 62 virtual std::string GetNetworkStatsServer() const OVERRIDE; | 63 virtual std::string GetNetworkStatsServer() const OVERRIDE; |
| 63 | 64 |
| 64 virtual std::string GetHttpPipeliningTestServer() const OVERRIDE; | 65 virtual std::string GetHttpPipeliningTestServer() const OVERRIDE; |
| 65 | 66 |
| 66 // This method reads data from the Google Update ClientState key for | 67 // This method reads data from the Google Update ClientState key for |
| 67 // potential use in the uninstall survey. It must be called before the | 68 // potential use in the uninstall survey. It must be called before the |
| 68 // key returned by GetVersionKey() is deleted. | 69 // key returned by GetVersionKey() is deleted. |
| 69 virtual std::wstring GetDistributionData(HKEY root_key) OVERRIDE; | 70 virtual string16 GetDistributionData(HKEY root_key) OVERRIDE; |
| 70 | 71 |
| 71 virtual std::wstring GetUninstallLinkName() OVERRIDE; | 72 virtual string16 GetUninstallLinkName() OVERRIDE; |
| 72 | 73 |
| 73 virtual std::wstring GetUninstallRegPath() OVERRIDE; | 74 virtual string16 GetUninstallRegPath() OVERRIDE; |
| 74 | 75 |
| 75 virtual std::wstring GetVersionKey() OVERRIDE; | 76 virtual string16 GetVersionKey() OVERRIDE; |
| 76 | 77 |
| 77 virtual bool GetDelegateExecuteHandlerData(string16* handler_class_uuid, | 78 virtual bool GetDelegateExecuteHandlerData(string16* handler_class_uuid, |
| 78 string16* type_lib_uuid, | 79 string16* type_lib_uuid, |
| 79 string16* type_lib_version, | 80 string16* type_lib_version, |
| 80 string16* interface_uuid) OVERRIDE; | 81 string16* interface_uuid) OVERRIDE; |
| 81 | 82 |
| 82 virtual void UpdateInstallStatus( | 83 virtual void UpdateInstallStatus( |
| 83 bool system_install, | 84 bool system_install, |
| 84 installer::ArchiveType archive_type, | 85 installer::ArchiveType archive_type, |
| 85 installer::InstallStatus install_status) OVERRIDE; | 86 installer::InstallStatus install_status) OVERRIDE; |
| 86 | 87 |
| 87 virtual bool GetExperimentDetails(UserExperiment* experiment, | 88 virtual bool GetExperimentDetails(UserExperiment* experiment, |
| 88 int flavor) OVERRIDE; | 89 int flavor) OVERRIDE; |
| 89 | 90 |
| 90 virtual void LaunchUserExperiment( | 91 virtual void LaunchUserExperiment( |
| 91 const FilePath& setup_path, | 92 const FilePath& setup_path, |
| 92 installer::InstallStatus status, | 93 installer::InstallStatus status, |
| 93 const Version& version, | 94 const Version& version, |
| 94 const installer::Product& product, | 95 const installer::Product& product, |
| 95 bool system_level) OVERRIDE; | 96 bool system_level) OVERRIDE; |
| 96 | 97 |
| 97 // Assuming that the user qualifies, this function performs the inactive user | 98 // Assuming that the user qualifies, this function performs the inactive user |
| 98 // toast experiment. It will use chrome to show the UI and it will record the | 99 // toast experiment. It will use chrome to show the UI and it will record the |
| 99 // outcome in the registry. | 100 // outcome in the registry. |
| 100 virtual void InactiveUserToastExperiment( | 101 virtual void InactiveUserToastExperiment( |
| 101 int flavor, | 102 int flavor, |
| 102 const std::wstring& experiment_group, | 103 const string16& experiment_group, |
| 103 const installer::Product& installation, | 104 const installer::Product& installation, |
| 104 const FilePath& application_path) OVERRIDE; | 105 const FilePath& application_path) OVERRIDE; |
| 105 | 106 |
| 106 const std::wstring& product_guid() { return product_guid_; } | 107 const string16& product_guid() { return product_guid_; } |
| 107 | 108 |
| 108 protected: | 109 protected: |
| 109 void set_product_guid(const std::wstring& guid) { product_guid_ = guid; } | 110 void set_product_guid(const string16& guid) { product_guid_ = guid; } |
| 110 | 111 |
| 111 // Disallow construction from others. | 112 // Disallow construction from others. |
| 112 GoogleChromeDistribution(); | 113 GoogleChromeDistribution(); |
| 113 | 114 |
| 114 private: | 115 private: |
| 115 friend class BrowserDistribution; | 116 friend class BrowserDistribution; |
| 116 | 117 |
| 117 FRIEND_TEST_ALL_PREFIXES(GoogleChromeDistTest, TestExtractUninstallMetrics); | 118 FRIEND_TEST_ALL_PREFIXES(GoogleChromeDistTest, TestExtractUninstallMetrics); |
| 118 | 119 |
| 119 // Extracts uninstall metrics from the JSON file located at file_path. | 120 // Extracts uninstall metrics from the JSON file located at file_path. |
| 120 // Returns them in a form suitable for appending to a url that already | 121 // Returns them in a form suitable for appending to a url that already |
| 121 // has GET parameters, i.e. &metric1=foo&metric2=bar. | 122 // has GET parameters, i.e. &metric1=foo&metric2=bar. |
| 122 // Returns true if uninstall_metrics has been successfully populated with | 123 // Returns true if uninstall_metrics has been successfully populated with |
| 123 // the uninstall metrics, false otherwise. | 124 // the uninstall metrics, false otherwise. |
| 124 virtual bool ExtractUninstallMetricsFromFile( | 125 virtual bool ExtractUninstallMetricsFromFile( |
| 125 const FilePath& file_path, std::wstring* uninstall_metrics); | 126 const FilePath& file_path, string16* uninstall_metrics); |
| 126 | 127 |
| 127 // Extracts uninstall metrics from the given JSON value. | 128 // Extracts uninstall metrics from the given JSON value. |
| 128 virtual bool ExtractUninstallMetrics(const base::DictionaryValue& root, | 129 virtual bool ExtractUninstallMetrics(const base::DictionaryValue& root, |
| 129 std::wstring* uninstall_metrics); | 130 string16* uninstall_metrics); |
| 130 | 131 |
| 131 // Given a DictionaryValue containing a set of uninstall metrics, | 132 // Given a DictionaryValue containing a set of uninstall metrics, |
| 132 // this builds a URL parameter list of all the contained metrics. | 133 // this builds a URL parameter list of all the contained metrics. |
| 133 // Returns true if at least one uninstall metric was found in | 134 // Returns true if at least one uninstall metric was found in |
| 134 // uninstall_metrics_dict, false otherwise. | 135 // uninstall_metrics_dict, false otherwise. |
| 135 virtual bool BuildUninstallMetricsString( | 136 virtual bool BuildUninstallMetricsString( |
| 136 base::DictionaryValue* uninstall_metrics_dict, std::wstring* metrics); | 137 base::DictionaryValue* uninstall_metrics_dict, string16* metrics); |
| 137 | 138 |
| 138 // The product ID for Google Update. | 139 // The product ID for Google Update. |
| 139 std::wstring product_guid_; | 140 string16 product_guid_; |
| 140 }; | 141 }; |
| 141 | 142 |
| 142 #endif // CHROME_INSTALLER_UTIL_GOOGLE_CHROME_DISTRIBUTION_H_ | 143 #endif // CHROME_INSTALLER_UTIL_GOOGLE_CHROME_DISTRIBUTION_H_ |
| OLD | NEW |