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 | 10 |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "chrome/installer/util/browser_distribution.h" | 13 #include "chrome/installer/util/browser_distribution.h" |
14 #include "chrome/installer/util/util_constants.h" | 14 #include "chrome/installer/util/util_constants.h" |
15 | 15 |
16 class FilePath; | |
17 | |
18 namespace base { | 16 namespace base { |
19 class DictionaryValue; | 17 class DictionaryValue; |
| 18 class FilePath; |
20 } | 19 } |
21 | 20 |
22 class GoogleChromeDistribution : public BrowserDistribution { | 21 class GoogleChromeDistribution : public BrowserDistribution { |
23 public: | 22 public: |
24 // Opens the Google Chrome uninstall survey window. | 23 // Opens the Google Chrome uninstall survey window. |
25 // version refers to the version of Chrome being uninstalled. | 24 // version refers to the version of Chrome being uninstalled. |
26 // local_data_path is the path of the file containing json metrics that | 25 // local_data_path is the path of the file containing json metrics that |
27 // will be parsed. If this file indicates that the user has opted in to | 26 // will be parsed. If this file indicates that the user has opted in to |
28 // providing anonymous usage data, then some additional statistics will | 27 // providing anonymous usage data, then some additional statistics will |
29 // be added to the survey url. | 28 // be added to the survey url. |
30 // distribution_data contains Google Update related data that will be | 29 // distribution_data contains Google Update related data that will be |
31 // concatenated to the survey url if the file in local_data_path indicates | 30 // concatenated to the survey url if the file in local_data_path indicates |
32 // the user has opted in to providing anonymous usage data. | 31 // the user has opted in to providing anonymous usage data. |
33 virtual void DoPostUninstallOperations( | 32 virtual void DoPostUninstallOperations( |
34 const Version& version, | 33 const Version& version, |
35 const FilePath& local_data_path, | 34 const base::FilePath& local_data_path, |
36 const string16& distribution_data) OVERRIDE; | 35 const string16& distribution_data) OVERRIDE; |
37 | 36 |
38 virtual string16 GetActiveSetupGuid() OVERRIDE; | 37 virtual string16 GetActiveSetupGuid() OVERRIDE; |
39 | 38 |
40 virtual string16 GetAppGuid() OVERRIDE; | 39 virtual string16 GetAppGuid() OVERRIDE; |
41 | 40 |
42 virtual string16 GetBaseAppName() OVERRIDE; | 41 virtual string16 GetBaseAppName() OVERRIDE; |
43 | 42 |
44 virtual string16 GetAppShortCutName() OVERRIDE; | 43 virtual string16 GetAppShortCutName() OVERRIDE; |
45 | 44 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 84 |
86 virtual void UpdateInstallStatus( | 85 virtual void UpdateInstallStatus( |
87 bool system_install, | 86 bool system_install, |
88 installer::ArchiveType archive_type, | 87 installer::ArchiveType archive_type, |
89 installer::InstallStatus install_status) OVERRIDE; | 88 installer::InstallStatus install_status) OVERRIDE; |
90 | 89 |
91 virtual bool GetExperimentDetails(UserExperiment* experiment, | 90 virtual bool GetExperimentDetails(UserExperiment* experiment, |
92 int flavor) OVERRIDE; | 91 int flavor) OVERRIDE; |
93 | 92 |
94 virtual void LaunchUserExperiment( | 93 virtual void LaunchUserExperiment( |
95 const FilePath& setup_path, | 94 const base::FilePath& setup_path, |
96 installer::InstallStatus status, | 95 installer::InstallStatus status, |
97 const Version& version, | 96 const Version& version, |
98 const installer::Product& product, | 97 const installer::Product& product, |
99 bool system_level) OVERRIDE; | 98 bool system_level) OVERRIDE; |
100 | 99 |
101 // Assuming that the user qualifies, this function performs the inactive user | 100 // Assuming that the user qualifies, this function performs the inactive user |
102 // toast experiment. It will use chrome to show the UI and it will record the | 101 // toast experiment. It will use chrome to show the UI and it will record the |
103 // outcome in the registry. | 102 // outcome in the registry. |
104 virtual void InactiveUserToastExperiment( | 103 virtual void InactiveUserToastExperiment( |
105 int flavor, | 104 int flavor, |
106 const string16& experiment_group, | 105 const string16& experiment_group, |
107 const installer::Product& installation, | 106 const installer::Product& installation, |
108 const FilePath& application_path) OVERRIDE; | 107 const base::FilePath& application_path) OVERRIDE; |
109 | 108 |
110 virtual bool ShouldSetExperimentLabels() OVERRIDE; | 109 virtual bool ShouldSetExperimentLabels() OVERRIDE; |
111 | 110 |
112 const string16& product_guid() { return product_guid_; } | 111 const string16& product_guid() { return product_guid_; } |
113 | 112 |
114 protected: | 113 protected: |
115 void set_product_guid(const string16& guid) { product_guid_ = guid; } | 114 void set_product_guid(const string16& guid) { product_guid_ = guid; } |
116 | 115 |
117 // Disallow construction from others. | 116 // Disallow construction from others. |
118 GoogleChromeDistribution(); | 117 GoogleChromeDistribution(); |
119 | 118 |
120 private: | 119 private: |
121 friend class BrowserDistribution; | 120 friend class BrowserDistribution; |
122 | 121 |
123 FRIEND_TEST_ALL_PREFIXES(GoogleChromeDistTest, TestExtractUninstallMetrics); | 122 FRIEND_TEST_ALL_PREFIXES(GoogleChromeDistTest, TestExtractUninstallMetrics); |
124 | 123 |
125 // Extracts uninstall metrics from the JSON file located at file_path. | 124 // Extracts uninstall metrics from the JSON file located at file_path. |
126 // Returns them in a form suitable for appending to a url that already | 125 // Returns them in a form suitable for appending to a url that already |
127 // has GET parameters, i.e. &metric1=foo&metric2=bar. | 126 // has GET parameters, i.e. &metric1=foo&metric2=bar. |
128 // Returns true if uninstall_metrics has been successfully populated with | 127 // Returns true if uninstall_metrics has been successfully populated with |
129 // the uninstall metrics, false otherwise. | 128 // the uninstall metrics, false otherwise. |
130 virtual bool ExtractUninstallMetricsFromFile( | 129 virtual bool ExtractUninstallMetricsFromFile( |
131 const FilePath& file_path, string16* uninstall_metrics); | 130 const base::FilePath& file_path, string16* uninstall_metrics); |
132 | 131 |
133 // Extracts uninstall metrics from the given JSON value. | 132 // Extracts uninstall metrics from the given JSON value. |
134 virtual bool ExtractUninstallMetrics(const base::DictionaryValue& root, | 133 virtual bool ExtractUninstallMetrics(const base::DictionaryValue& root, |
135 string16* uninstall_metrics); | 134 string16* uninstall_metrics); |
136 | 135 |
137 // Given a DictionaryValue containing a set of uninstall metrics, | 136 // Given a DictionaryValue containing a set of uninstall metrics, |
138 // this builds a URL parameter list of all the contained metrics. | 137 // this builds a URL parameter list of all the contained metrics. |
139 // Returns true if at least one uninstall metric was found in | 138 // Returns true if at least one uninstall metric was found in |
140 // uninstall_metrics_dict, false otherwise. | 139 // uninstall_metrics_dict, false otherwise. |
141 virtual bool BuildUninstallMetricsString( | 140 virtual bool BuildUninstallMetricsString( |
142 const base::DictionaryValue* uninstall_metrics_dict, string16* metrics); | 141 const base::DictionaryValue* uninstall_metrics_dict, string16* metrics); |
143 | 142 |
144 // The product ID for Google Update. | 143 // The product ID for Google Update. |
145 string16 product_guid_; | 144 string16 product_guid_; |
146 }; | 145 }; |
147 | 146 |
148 #endif // CHROME_INSTALLER_UTIL_GOOGLE_CHROME_DISTRIBUTION_H_ | 147 #endif // CHROME_INSTALLER_UTIL_GOOGLE_CHROME_DISTRIBUTION_H_ |
OLD | NEW |