-
Notifications
You must be signed in to change notification settings - Fork 920
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0c5300
commit 41bdb12
Showing
19 changed files
with
588 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* Copyright (c) 2023 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "brave/browser/misc_metrics/process_misc_metrics.h" | ||
|
||
#include "components/prefs/pref_registry_simple.h" | ||
#include "components/prefs/pref_service.h" | ||
|
||
#if !BUILDFLAG(IS_ANDROID) | ||
#include "brave/browser/misc_metrics/vertical_tab_metrics.h" | ||
#include "brave/components/misc_metrics/menu_metrics.h" | ||
#else | ||
#include "brave/components/misc_metrics/privacy_hub_metrics.h" | ||
#endif | ||
|
||
namespace misc_metrics { | ||
|
||
ProcessMiscMetrics::ProcessMiscMetrics(PrefService* local_state) { | ||
#if !BUILDFLAG(IS_ANDROID) | ||
menu_metrics_ = std::make_unique<MenuMetrics>(local_state); | ||
vertical_tab_metrics_ = std::make_unique<VerticalTabMetrics>(local_state); | ||
#else | ||
privacy_hub_metrics_ = | ||
std::make_unique<misc_metrics::PrivacyHubMetrics>(local_state); | ||
#endif | ||
} | ||
|
||
ProcessMiscMetrics::~ProcessMiscMetrics() = default; | ||
|
||
#if !BUILDFLAG(IS_ANDROID) | ||
MenuMetrics* ProcessMiscMetrics::menu_metrics() { | ||
return menu_metrics_.get(); | ||
} | ||
|
||
VerticalTabMetrics* ProcessMiscMetrics::vertical_tab_metrics() { | ||
return vertical_tab_metrics_.get(); | ||
} | ||
#else | ||
PrivacyHubMetrics* ProcessMiscMetrics::privacy_hub_metrics() { | ||
return privacy_hub_metrics_.get(); | ||
} | ||
#endif | ||
|
||
void ProcessMiscMetrics::RegisterPrefs(PrefRegistrySimple* registry) { | ||
#if !BUILDFLAG(IS_ANDROID) | ||
MenuMetrics::RegisterPrefs(registry); | ||
VerticalTabMetrics::RegisterPrefs(registry); | ||
#else | ||
PrivacyHubMetrics::RegisterPrefs(registry); | ||
#endif | ||
} | ||
|
||
} // namespace misc_metrics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* Copyright (c) 2023 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BRAVE_BROWSER_MISC_METRICS_PROCESS_MISC_METRICS_H_ | ||
#define BRAVE_BROWSER_MISC_METRICS_PROCESS_MISC_METRICS_H_ | ||
|
||
#include <memory> | ||
|
||
#include "build/build_config.h" | ||
|
||
class PrefRegistrySimple; | ||
class PrefService; | ||
|
||
namespace misc_metrics { | ||
|
||
#if !BUILDFLAG(IS_ANDROID) | ||
class MenuMetrics; | ||
class VerticalTabMetrics; | ||
#else | ||
class PrivacyHubMetrics; | ||
#endif | ||
|
||
class ProcessMiscMetrics { | ||
public: | ||
explicit ProcessMiscMetrics(PrefService* local_state); | ||
~ProcessMiscMetrics(); | ||
|
||
ProcessMiscMetrics(const ProcessMiscMetrics&) = delete; | ||
ProcessMiscMetrics& operator=(const ProcessMiscMetrics&) = delete; | ||
|
||
static void RegisterPrefs(PrefRegistrySimple* registry); | ||
|
||
#if !BUILDFLAG(IS_ANDROID) | ||
MenuMetrics* menu_metrics(); | ||
VerticalTabMetrics* vertical_tab_metrics(); | ||
#else | ||
PrivacyHubMetrics* privacy_hub_metrics(); | ||
#endif | ||
|
||
private: | ||
#if !BUILDFLAG(IS_ANDROID) | ||
std::unique_ptr<MenuMetrics> menu_metrics_; | ||
std::unique_ptr<VerticalTabMetrics> vertical_tab_metrics_; | ||
#else | ||
std::unique_ptr<PrivacyHubMetrics> privacy_hub_metrics_; | ||
#endif | ||
}; | ||
|
||
} // namespace misc_metrics | ||
|
||
#endif // BRAVE_BROWSER_MISC_METRICS_PROCESS_MISC_METRICS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.