From 6febc9dfb9a5c9c4e7589b5fb2a096fe884c95a1 Mon Sep 17 00:00:00 2001 From: Simon Hong Date: Fri, 27 May 2022 19:56:45 +0900 Subject: [PATCH] Check purchased state when service is launched Connection state is queried when purchased state is loaded and it's purchased user. fix https://github.com/brave/brave-browser/issues/22677 fix https://github.com/brave/brave-browser/issues/22726 fix https://github.com/brave/brave-browser/issues/23080 --- components/brave_vpn/brave_vpn_service.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/brave_vpn/brave_vpn_service.cc b/components/brave_vpn/brave_vpn_service.cc index d4734c0ef6c9..66ecdb671192 100644 --- a/components/brave_vpn/brave_vpn_service.cc +++ b/components/brave_vpn/brave_vpn_service.cc @@ -136,6 +136,8 @@ BraveVpnService::BraveVpnService( observed_.Observe(GetBraveVPNConnectionAPI()); GetBraveVPNConnectionAPI()->set_target_vpn_entry_name(kBraveVPNEntryName); + + LoadPurchasedState(); } #endif @@ -227,6 +229,12 @@ void BraveVpnService::UpdateAndNotifyConnectionStateChange( << state; connection_state_ = state; + + // Don't need to notify connection state change for non purchased state. + // This can be happened when user controls vpn settings via os. + if (!is_purchased_user()) + return; + for (const auto& obs : observers_) obs->OnConnectionStateChanged(connection_state_); }