Skip to content

Commit

Permalink
Deleted GetStringFor() and use mojom enum direclty for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhong committed Apr 11, 2022
1 parent acf4230 commit e913c1e
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions components/brave_vpn/brave_vpn_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,6 @@ constexpr char kRegionNamePrettyKey[] = "name-pretty";

constexpr char kCreateSupportTicket[] = "api/v1.2/partners/support-ticket";

std::string GetStringFor(ConnectionState state) {
switch (state) {
case ConnectionState::CONNECTED:
return "Connected";
case ConnectionState::CONNECTING:
return "Connecting";
case ConnectionState::DISCONNECTED:
return "Disconnected";
case ConnectionState::DISCONNECTING:
return "Disconnecting";
case ConnectionState::CONNECT_FAILED:
return "Connect failed";
case ConnectionState::CONNECT_NOT_ALLOWED:
return "Connect not allowed";
default:
NOTREACHED();
}

return std::string();
}

bool IsValidRegionValue(const base::Value& value) {
if (!value.FindStringKey(kRegionContinentKey) ||
!value.FindStringKey(kRegionNameKey) ||
Expand Down Expand Up @@ -366,8 +345,7 @@ void BraveVpnService::Connect() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (connection_state_ == ConnectionState::DISCONNECTING ||
connection_state_ == ConnectionState::CONNECTING) {
VLOG(2) << __func__
<< ": Current state: " << GetStringFor(connection_state_)
VLOG(2) << __func__ << ": Current state: " << connection_state_
<< " : prevent connecting while previous operation is in-progress";
return;
}
Expand Down Expand Up @@ -764,8 +742,7 @@ void BraveVpnService::SetSelectedRegion(
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (connection_state_ == ConnectionState::DISCONNECTING ||
connection_state_ == ConnectionState::CONNECTING) {
VLOG(2) << __func__
<< ": Current state: " << GetStringFor(connection_state_)
VLOG(2) << __func__ << ": Current state: " << connection_state_
<< " : prevent changing selected region while previous operation "
"is in-progress";
return;
Expand Down

0 comments on commit e913c1e

Please sign in to comment.