diff --git a/app/brave_generated_resources.grd b/app/brave_generated_resources.grd index a184c1a419b2..1ae27993c63c 100644 --- a/app/brave_generated_resources.grd +++ b/app/brave_generated_resources.grd @@ -334,6 +334,9 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U Open in Tor + + Onion Available + New Private Window with Tor diff --git a/browser/tor/onion_location_navigation_throttle.cc b/browser/tor/onion_location_navigation_throttle.cc index 6098e9c72103..b899fe6337b3 100644 --- a/browser/tor/onion_location_navigation_throttle.cc +++ b/browser/tor/onion_location_navigation_throttle.cc @@ -75,10 +75,8 @@ OnionLocationNavigationThrottle::WillProcessResponse() { std::string onion_location; if (headers && GetOnionLocation(headers, &onion_location) && !navigation_handle()->GetURL().DomainIs("onion")) { - // If we are in tor window, open onion site directly or user prefers - // opening it automatically - if (brave::IsTorProfile(profile_) || - profile_->GetPrefs()->GetBoolean(prefs::kAutoOnionLocation)) { + // If user prefers opening it automatically + if (profile_->GetPrefs()->GetBoolean(prefs::kAutoOnionLocation)) { profiles::SwitchToTorProfile( base::BindRepeating(&OnTorProfileCreated, GURL(onion_location))); } else { diff --git a/browser/ui/views/brave_actions/brave_actions_container.cc b/browser/ui/views/brave_actions/brave_actions_container.cc index 69019e84e4f0..322de738c41d 100644 --- a/browser/ui/views/brave_actions/brave_actions_container.cc +++ b/browser/ui/views/brave_actions/brave_actions_container.cc @@ -137,7 +137,7 @@ void BraveActionsContainer::Init() { SetLayoutManager(std::move(vertical_container_layout)); // children - onion_location_view_ = new OnionLocationView(); + onion_location_view_ = new OnionLocationView(browser_->profile()); AddChildViewAt(onion_location_view_, 0); RoundedSeparator* brave_button_separator_ = new RoundedSeparator(); diff --git a/browser/ui/views/location_bar/onion_location_view.cc b/browser/ui/views/location_bar/onion_location_view.cc index 549f4dce45ee..2254fdab6b1a 100644 --- a/browser/ui/views/location_bar/onion_location_view.cc +++ b/browser/ui/views/location_bar/onion_location_view.cc @@ -40,9 +40,11 @@ void OnTorProfileCreated(GURL onion_location, } // namespace -OnionLocationView::OnionLocationView() +OnionLocationView::OnionLocationView(Profile* profile) : LabelButton(this, - l10n_util::GetStringUTF16((IDS_LOCATION_BAR_OPEN_IN_TOR))) { + l10n_util::GetStringUTF16(IDS_LOCATION_BAR_OPEN_IN_TOR)) { + if (brave::IsTorProfile(profile)) + SetText(l10n_util::GetStringUTF16(IDS_LOCATION_BAR_ONION_AVAILABLE)); SetBackground(views::CreateSolidBackground(kOpenInTorBg)); ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); gfx::ImageSkia image; diff --git a/browser/ui/views/location_bar/onion_location_view.h b/browser/ui/views/location_bar/onion_location_view.h index 103b8523abf6..0bebbb775bbf 100644 --- a/browser/ui/views/location_bar/onion_location_view.h +++ b/browser/ui/views/location_bar/onion_location_view.h @@ -9,6 +9,8 @@ #include "chrome/browser/profiles/profile.h" #include "ui/views/controls/button/label_button.h" +class Profile; + namespace content { class WebContents; } // namespace content @@ -16,7 +18,7 @@ class WebContents; class OnionLocationView : public views::LabelButton, public views::ButtonListener { public: - OnionLocationView(); + explicit OnionLocationView(Profile* profile); ~OnionLocationView() override; void Update(content::WebContents* web_contents);