Skip to content

Commit

Permalink
Merge pull request #16179 from brave/issues/23002_search_result_ad_ta…
Browse files Browse the repository at this point in the history
…b_helper

Search result ad view/click confirmation.
  • Loading branch information
aseren authored Jan 31, 2023
2 parents eef8766 + b32ae23 commit 83335a3
Show file tree
Hide file tree
Showing 47 changed files with 1,430 additions and 2,154 deletions.
18 changes: 0 additions & 18 deletions browser/brave_ads/ads_tab_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#include <string>

#include "brave/browser/brave_ads/ads_service_factory.h"
#include "brave/browser/brave_ads/search_result_ad/search_result_ad_service_factory.h"
#include "brave/components/brave_ads/content/browser/search_result_ad/search_result_ad_service.h"
#include "chrome/browser/profiles/profile.h"
#include "components/dom_distiller/content/browser/distiller_javascript_utils.h"
#include "components/dom_distiller/content/browser/distiller_page_web_contents.h"
Expand Down Expand Up @@ -45,9 +43,6 @@ AdsTabHelper::AdsTabHelper(content::WebContents* web_contents)
return;
}

search_result_ad_service_ =
SearchResultAdServiceFactory::GetForProfile(profile);

#if !BUILDFLAG(IS_ANDROID)
BrowserList::AddObserver(this);
OnBrowserSetLastActive(BrowserList::GetInstance()->GetLastActive());
Expand Down Expand Up @@ -128,10 +123,6 @@ void AdsTabHelper::DidFinishNavigation(
redirect_chain_ = navigation_handle->GetRedirectChain();

if (!navigation_handle->IsSameDocument()) {
if (search_result_ad_service_) {
search_result_ad_service_->OnDidFinishNavigation(tab_id_);
}

should_process_ = navigation_handle->GetRestoreType() ==
content::RestoreType::kNotRestored;

Expand All @@ -146,11 +137,6 @@ void AdsTabHelper::DidFinishNavigation(
void AdsTabHelper::DocumentOnLoadCompletedInPrimaryMainFrame() {
content::RenderFrameHost* render_frame_host =
web_contents()->GetPrimaryMainFrame();
if (search_result_ad_service_) {
search_result_ad_service_->MaybeRetrieveSearchResultAd(
render_frame_host, tab_id_, should_process_);
}

if (should_process_) {
RunIsolatedJavaScript(render_frame_host);
}
Expand Down Expand Up @@ -207,10 +193,6 @@ void AdsTabHelper::OnVisibilityChanged(content::Visibility visibility) {
}

void AdsTabHelper::WebContentsDestroyed() {
if (search_result_ad_service_) {
search_result_ad_service_->OnDidCloseTab(tab_id_);
}

if (!ads_service_) {
return;
}
Expand Down
3 changes: 0 additions & 3 deletions browser/brave_ads/ads_tab_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class DomDistillerResult;
namespace brave_ads {

class AdsService;
class SearchResultAdService;

class AdsTabHelper : public content::WebContentsObserver,
#if !BUILDFLAG(IS_ANDROID)
Expand Down Expand Up @@ -84,8 +83,6 @@ class AdsTabHelper : public content::WebContentsObserver,

SessionID tab_id_;
raw_ptr<AdsService> ads_service_ = nullptr; // NOT OWNED
raw_ptr<SearchResultAdService> search_result_ad_service_ =
nullptr; // NOT OWNED
bool is_active_ = false;
bool is_browser_active_ = true;
std::vector<GURL> redirect_chain_;
Expand Down
51 changes: 0 additions & 51 deletions browser/brave_ads/brave_ads_host.cc

This file was deleted.

48 changes: 0 additions & 48 deletions browser/brave_ads/brave_ads_host.h

This file was deleted.

Loading

0 comments on commit 83335a3

Please sign in to comment.