Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desktop VPN updates and bug fixes (uplift to 1.45.x) #15581

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion browser/brave_vpn/brave_vpn_service_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include "brave/browser/brave_vpn/brave_vpn_service_factory.h"

#include "base/feature_list.h"
#include "brave/browser/brave_browser_process.h"
#include "brave/browser/profiles/profile_util.h"
#include "brave/browser/skus/skus_service_factory.h"
#include "brave/components/brave_vpn/brave_vpn_os_connection_api.h"
#include "brave/components/brave_vpn/brave_vpn_service.h"
#include "brave/components/brave_vpn/brave_vpn_utils.h"
#include "brave/components/skus/common/features.h"
Expand Down Expand Up @@ -50,6 +50,12 @@ BraveVpnServiceFactory::BraveVpnServiceFactory()
"BraveVpnService",
BrowserContextDependencyManager::GetInstance()) {
DependsOn(skus::SkusServiceFactory::GetInstance());
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
auto* connection_api = BraveVPNOSConnectionAPI::GetInstance();
connection_api->set_shared_url_loader_factory(
g_browser_process->shared_url_loader_factory());
connection_api->set_local_prefs(g_browser_process->local_state());
#endif
}

BraveVpnServiceFactory::~BraveVpnServiceFactory() = default;
Expand Down
2 changes: 1 addition & 1 deletion browser/ui/views/toolbar/brave_vpn_button.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ void BraveVPNButton::UpdateButtonState() {
}

bool BraveVPNButton::IsConnected() {
return service_->is_connected();
return service_->IsConnected();
}

void BraveVPNButton::OnButtonPressed(const ui::Event& event) {
Expand Down
2 changes: 1 addition & 1 deletion browser/ui/views/toolbar/brave_vpn_status_label.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ gfx::Size BraveVPNStatusLabel::CalculatePreferredSize() const {
}

void BraveVPNStatusLabel::UpdateState() {
const auto state = service_->connection_state();
const auto state = service_->GetConnectionState();

SetText(brave_l10n::GetLocalizedResourceUTF16String(
GetStringIdForConnectionState(state)));
Expand Down
2 changes: 1 addition & 1 deletion browser/ui/views/toolbar/brave_vpn_toggle_button.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void BraveVPNToggleButton::OnButtonPressed(const ui::Event& event) {
}

void BraveVPNToggleButton::UpdateState() {
const auto state = service_->connection_state();
const auto state = service_->GetConnectionState();
bool is_on = (state == ConnectionState::CONNECTING ||
state == ConnectionState::CONNECTED);
SetIsOn(is_on);
Expand Down
3 changes: 3 additions & 0 deletions components/brave_vpn/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ static_library("brave_vpn") {
"features.h",
"pref_names.cc",
"pref_names.h",
"vpn_response_parser.cc",
"vpn_response_parser.h",
]

deps = [
Expand Down Expand Up @@ -112,6 +114,7 @@ source_set("unit_tests") {
sources += [
"brave_vpn_unittest.cc",
"brave_vpn_utils_unittest.cc",
"vpn_response_parser_unittest.cc",
]
}

Expand Down
16 changes: 16 additions & 0 deletions components/brave_vpn/brave_vpn_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ constexpr char kRegionNamePrettyKey[] = "name-pretty";
constexpr char kRegionCountryIsoCodeKey[] = "country-iso-code";
constexpr char kCreateSupportTicket[] = "api/v1.2/partners/support-ticket";

constexpr char kVpnHost[] = "connect-api.guardianapp.com";
constexpr char kAllServerRegions[] = "api/v1/servers/all-server-regions";
constexpr char kTimezonesForRegions[] =
"api/v1.1/servers/timezones-for-regions";
constexpr char kHostnameForRegion[] = "api/v1.2/servers/hostnames-for-region";
constexpr char kProfileCredential[] = "api/v1.1/register-and-create";
constexpr char kCredential[] = "api/v1.3/device/";
constexpr char kVerifyPurchaseToken[] = "api/v1.1/verify-purchase-token";
constexpr char kCreateSubscriberCredentialV12[] =
"api/v1.2/subscriber-credential/create";
constexpr int kP3AIntervalHours = 24;

#if !BUILDFLAG(IS_ANDROID)
constexpr char kTokenNoLongerValid[] = "Token No Longer Valid";
#endif // !BUILDFLAG(IS_ANDROID)

} // namespace brave_vpn

#endif // BRAVE_COMPONENTS_BRAVE_VPN_BRAVE_VPN_CONSTANTS_H_
Loading