Index: chrome/installer/setup/persistent_histogram_storage.h |
diff --git a/chrome/common/origin_trials/chrome_origin_trial_policy.h b/chrome/installer/setup/persistent_histogram_storage.h |
similarity index 15% |
copy from chrome/common/origin_trials/chrome_origin_trial_policy.h |
copy to chrome/installer/setup/persistent_histogram_storage.h |
index 829c0f607fe327afc594944327bf45703d8357e3..c5b3dc5962245771d8659a3dc357e0eac1f05676 100644 |
--- a/chrome/common/origin_trials/chrome_origin_trial_policy.h |
+++ b/chrome/installer/setup/persistent_histogram_storage.h |
@@ -2,35 +2,42 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CHROME_COMMON_ORIGIN_TRIALS_CHROME_ORIGIN_TRIAL_POLICY_H_ |
-#define CHROME_COMMON_ORIGIN_TRIALS_CHROME_ORIGIN_TRIAL_POLICY_H_ |
- |
-#include <set> |
-#include <string> |
+#ifndef CHROME_INSTALLER_SETUP_PERSISTENT_HISTOGRAM_STORAGE_H_ |
+#define CHROME_INSTALLER_SETUP_PERSISTENT_HISTOGRAM_STORAGE_H_ |
+#include "base/files/file_path.h" |
#include "base/macros.h" |
-#include "base/strings/string_piece.h" |
-#include "content/public/common/origin_trial_policy.h" |
-// This class is instantiated on the main/ui thread, but its methods can be |
-// accessed from any thread. |
-class ChromeOriginTrialPolicy : public content::OriginTrialPolicy { |
+namespace installer { |
+ |
+// When a PersistentHistogramStorage is destructed, histograms recorded during |
+// its lifetime are persisted in the directory set by set_storage_dir(). |
+// Histograms are not persisted if set_storage_dir() has not been called or if |
+// the storage directory does not exist on destruction. |
+// PersistentHistogramStorage should be instantiated as early as possible in the |
+// process lifetime and should never be instantiated again. Persisted histograms |
+// will eventually be reported by the browser process. |
+class PersistentHistogramStorage { |
public: |
- ChromeOriginTrialPolicy(); |
- ~ChromeOriginTrialPolicy() override; |
+ PersistentHistogramStorage(); |
+ ~PersistentHistogramStorage(); |
- // OriginTrialPolicy interface |
- base::StringPiece GetPublicKey() const override; |
- bool IsFeatureDisabled(base::StringPiece feature) const override; |
+ // Sets |storage_dir| as the directory in which histograms will be persisted |
+ // when this PersistentHistogramStorage is destructed. |
+ void set_storage_dir(const base::FilePath& storage_dir) { |
bcwhite
2016/09/13 19:53:53
You have set_storage_dir and GetStorageDir, only o
fdoray
2016/09/13 20:18:25
Done.
|
+ storage_dir_ = storage_dir; |
+ } |
- bool SetPublicKeyFromASCIIString(const std::string& ascii_public_key); |
- bool SetDisabledFeatures(const std::string& disabled_feature_list); |
+ // Returns a directory from which a product installed in |target_path| reports |
+ // persisted histograms. Should be used as an argument to set_storage_dir(). |
+ static base::FilePath GetStorageDir(const base::FilePath& target_path); |
private: |
- std::string public_key_; |
- std::set<std::string> disabled_features_; |
+ base::FilePath storage_dir_; |
- DISALLOW_COPY_AND_ASSIGN(ChromeOriginTrialPolicy); |
+ DISALLOW_COPY_AND_ASSIGN(PersistentHistogramStorage); |
}; |
-#endif // CHROME_COMMON_ORIGIN_TRIALS_CHROME_ORIGIN_TRIAL_POLICY_H_ |
+} // namespace installer |
+ |
+#endif // CHROME_INSTALLER_SETUP_PERSISTENT_HISTOGRAM_STORAGE_H_ |