|
16 | 16 | #include "brave/browser/component_updater/brave_component_updater_delegate.h"
|
17 | 17 | #include "brave/browser/profiles/brave_profile_manager.h"
|
18 | 18 | #include "brave/browser/tor/buildflags.h"
|
| 19 | +#include "brave/browser/ui/brave_browser_command_controller.h" |
19 | 20 | #include "brave/components/brave_component_updater/browser/local_data_files_service.h"
|
20 | 21 | #include "brave/components/brave_shields/browser/ad_block_custom_filters_service.h"
|
21 | 22 | #include "brave/components/brave_shields/browser/ad_block_regional_service_manager.h"
|
|
27 | 28 | #include "brave/components/p3a/buildflags.h"
|
28 | 29 | #include "brave/components/p3a/brave_histogram_rewrite.h"
|
29 | 30 | #include "brave/components/p3a/brave_p3a_service.h"
|
| 31 | +#include "chrome/browser/ui/browser_list.h" |
30 | 32 | #include "chrome/common/buildflags.h"
|
31 | 33 | #include "chrome/common/chrome_paths.h"
|
32 | 34 | #include "components/component_updater/component_updater_service.h"
|
|
57 | 59 |
|
58 | 60 | #if BUILDFLAG(ENABLE_TOR)
|
59 | 61 | #include "brave/browser/extensions/brave_tor_client_updater.h"
|
| 62 | +#include "brave/common/tor/pref_names.h" |
60 | 63 | #endif
|
61 | 64 |
|
62 | 65 | #if defined(OS_ANDROID)
|
63 | 66 | #include "chrome/browser/android/chrome_feature_list.h"
|
64 | 67 | #include "chrome/browser/android/component_updater/background_task_update_scheduler.h"
|
| 68 | +#else |
| 69 | +#include "chrome/browser/ui/browser.h" |
65 | 70 | #endif
|
66 | 71 |
|
67 | 72 | BraveBrowserProcessImpl* g_brave_browser_process = nullptr;
|
@@ -102,6 +107,17 @@ BraveBrowserProcessImpl::BraveBrowserProcessImpl(StartupData* startup_data)
|
102 | 107 | #endif // BUILDFLAG(BRAVE_P3A_ENABLED)
|
103 | 108 | }
|
104 | 109 |
|
| 110 | +void BraveBrowserProcessImpl::Init() { |
| 111 | + BrowserProcessImpl::Init(); |
| 112 | + |
| 113 | +#if BUILDFLAG(ENABLE_TOR) |
| 114 | + pref_change_registrar_.Add( |
| 115 | + tor::prefs::kTorDisabled, |
| 116 | + base::Bind(&BraveBrowserProcessImpl::OnTorEnabledChanged, |
| 117 | + base::Unretained(this))); |
| 118 | +#endif |
| 119 | +} |
| 120 | + |
105 | 121 | brave_component_updater::BraveComponent::Delegate*
|
106 | 122 | BraveBrowserProcessImpl::brave_component_updater_delegate() {
|
107 | 123 | if (!brave_component_updater_delegate_)
|
@@ -246,6 +262,14 @@ BraveBrowserProcessImpl::tor_client_updater() {
|
246 | 262 | brave_component_updater_delegate());
|
247 | 263 | return tor_client_updater_.get();
|
248 | 264 | }
|
| 265 | + |
| 266 | +void BraveBrowserProcessImpl::OnTorEnabledChanged() { |
| 267 | + // Update all browsers' tor command status. |
| 268 | + for (Browser* browser : *BrowserList::GetInstance()) { |
| 269 | + static_cast<chrome::BraveBrowserCommandController*>( |
| 270 | + browser->command_controller())->UpdateCommandForTor(); |
| 271 | + } |
| 272 | +} |
249 | 273 | #endif
|
250 | 274 |
|
251 | 275 | brave::BraveP3AService* BraveBrowserProcessImpl::brave_p3a_service() {
|
|
0 commit comments