Skip to content

Commit

Permalink
fix: 130 sync is now fully merged, with all the features working
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterK0927 committed Dec 30, 2024
1 parent 8efa9ca commit 415e9d9
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 48 deletions.
5 changes: 0 additions & 5 deletions browser/ui/views/toolbar/brave_toolbar_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,6 @@ views::View* BraveToolbarView::GetAnchorView(
return ToolbarView::GetAnchorView(type);
}

views::View* BraveToolbarView::GetAnchorView(
std::optional<PageActionIconType> type) {
return ToolbarView::GetAnchorView(type);
}

void BraveToolbarView::OnProfileAdded(const base::FilePath& profile_path) {
Update(nullptr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void BraveCustomNotesPageHandler::EditNote(int32_t note_id,
std::optional<std::string> BraveCustomNotesPageHandler::ExtractContentFromJson(
const std::string& json_response) {
// Parse the JSON response
absl::optional<base::Value> parsed_json = base::JSONReader::Read(json_response);
std::optional<base::Value> parsed_json = base::JSONReader::Read(json_response);
if (!parsed_json || !parsed_json->is_dict()) {
LOG(ERROR) << "Failed to parse JSON or response is not a dictionary.";
return std::nullopt;
Expand Down
82 changes: 40 additions & 42 deletions browser/ui/webui/brave_web_ui_controller_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "brave/components/playlist/common/buildflags/buildflags.h"
#include "brave/components/skus/common/features.h"
#include "brave/components/tor/buildflags/buildflags.h"
#include "brave_web_ui_controller_factory.h"
#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/url_constants.h"
Expand Down Expand Up @@ -93,15 +94,12 @@ WebUIController* NewWebUI(WebUI* web_ui, const GURL& url) {
auto host = url.host_piece();
Profile* profile = Profile::FromBrowserContext(
web_ui->GetWebContents()->GetBrowserContext());
if (host == kAdblockHost) {
return new BraveAdblockUI(web_ui, url.host());
} else if (host == kAdblockInternalsHost) {
return new BraveAdblockInternalsUI(web_ui, url.host());
} else if (host == kBraveCustomNotesHost) {
return new BraveCustomNotesUI(web_ui, url.host());
} else if (host == kSkusInternalsHost) {
if (host == kSkusInternalsHost) {
return new SkusInternalsUI(web_ui, url.host());
} else if (host == kBraveCustomNotesHost) {
return new BraveCustomNotesUI(web_ui, url.host());
} else if (host == kSkusInternalsHost) {
return new SkusInternalsUI(web_ui, url.host());
#if !BUILDFLAG(IS_ANDROID)
} else if (host == kWalletPageHost &&
brave_wallet::IsAllowedForContext(profile)) {
Expand Down Expand Up @@ -219,44 +217,44 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return nullptr;
}

bool ChromeWebUIControllerFactory::IsWebUIAllowedToMakeNetworkRequests(
const GURL& url) {
std::string host = url.host_piece();
if (host == kBraveCustomNotesHost) {
return true;
}
return ChromeWebUIControllerFactory::IsWebUIAllowedToMakeNetworkRequests(url);
}
// bool ChromeWebUIControllerFactory::IsWebUIAllowedToMakeNetworkRequests(
// const url::Origin& url) {
// std::string host = url.host_piece();
// if (host == kBraveCustomNotesHost) {
// return true;
// }
// return ChromeWebUIControllerFactory::IsWebUIAllowedToMakeNetworkRequests(url);
// }


bool ShouldBlockRewardsWebUI(content::BrowserContext* browser_context,
const GURL& url) {
if (url.host_piece() != kRewardsPageHost &&
#if !BUILDFLAG(IS_ANDROID)
url.host_piece() != kBraveRewardsPanelHost &&
url.host_piece() != kBraveTipPanelHost &&
#endif // !BUILDFLAG(IS_ANDROID)
url.host_piece() != kRewardsInternalsHost) {
return false;
}
// bool ShouldBlockRewardsWebUI(content::BrowserContext* browser_context,
// const GURL& url) {
// if (url.host_piece() != kRewardsPageHost &&
// #if !BUILDFLAG(IS_ANDROID)
// url.host_piece() != kBraveRewardsPanelHost &&
// url.host_piece() != kBraveTipPanelHost &&
// #endif // !BUILDFLAG(IS_ANDROID)
// url.host_piece() != kRewardsInternalsHost) {
// return false;
// }

Profile* profile = Profile::FromBrowserContext(browser_context);
if (profile) {
if (!brave_rewards::IsSupportedForProfile(
profile, url.host_piece() == kRewardsPageHost
? brave_rewards::IsSupportedOptions::kSkipRegionCheck
: brave_rewards::IsSupportedOptions::kNone)) {
return true;
}
#if BUILDFLAG(IS_ANDROID)
auto* prefs = profile->GetPrefs();
if (prefs && prefs->GetBoolean(kSafetynetCheckFailed)) {
return true;
}
#endif // BUILDFLAG(IS_ANDROID)
}
return false;
}
// Profile* profile = Profile::FromBrowserContext(browser_context);
// if (profile) {
// if (!brave_rewards::IsSupportedForProfile(
// profile, url.host_piece() == kRewardsPageHost
// ? brave_rewards::IsSupportedOptions::kSkipRegionCheck
// : brave_rewards::IsSupportedOptions::kNone)) {
// return true;
// }
// #if BUILDFLAG(IS_ANDROID)
// auto* prefs = profile->GetPrefs();
// if (prefs && prefs->GetBoolean(kSafetynetCheckFailed)) {
// return true;
// }
// #endif // BUILDFLAG(IS_ANDROID)
// }
// return false;
// }

#if BUILDFLAG(IS_ANDROID)
bool ShouldBlockWalletWebUI(content::BrowserContext* browser_context,
Expand Down

0 comments on commit 415e9d9

Please sign in to comment.