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

Search result ad view/click confirmation. #16179

Merged
merged 4 commits into from
Jan 31, 2023
Merged
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
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