Files
brave-core/browser/android/brave_tab_features.cc
T
Artem Samoilenko 96e0234f73 [cr143][Android] Migrate NewTabPagePreloadPipelineManager to TabFeatures
Error fixed:
../../chrome/browser/android/preloading/android_prerender_manager.cc:56:39: error: no member named 'new_tab_page_preload_pipeline_manager' in 'tabs::TabFeatures'
   56 |   return tab ? tab->GetTabFeatures()->new_tab_page_preload_pipeline_manager()

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/8965a614fb0e5c650f888a8644bbbfa9ae433635

commit 8965a614fb0e5c650f888a8644bbbfa9ae433635
Author: Robert Lin <robertlin@chromium.org>
Date:   Wed Oct 1 20:18:36 2025 -0700

    Migrate NewTabPagePreloadPipelineManager to TabFeatures

    According to `docs/chrome_browser_design_principles.md`, TabFeatures
    is preferred for all tab-centric features. This CL migrates
    NewTabPagePreloadPipelineManager to TabFeatures

    Bug: 421941586
    Change-Id: Id48373979e7b6750e24c3bc60365a0760bf252ea
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6980603
    Reviewed-by: Tom Lukaszewicz <tluk@chromium.org>
    Commit-Queue: Huanpo Lin <robertlin@chromium.org>
    Reviewed-by: Sky Malice <skym@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1523984}
2025-11-18 11:18:39 -05:00

46 lines
1.6 KiB
C++

// Copyright (c) 2025 The Brave Authors. All rights reserved.
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at https://mozilla.org/MPL/2.0/.
#include "brave/browser/android/brave_tab_features.h"
#include "brave/browser/ai_chat/ai_chat_utils.h"
#include "brave/browser/ai_chat/tab_data_web_contents_observer.h"
#include "chrome/browser/android/tab_android.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/web_contents.h"
namespace tabs {
BraveTabFeatures::BraveTabFeatures(content::WebContents* web_contents,
Profile* profile)
: TabFeatures_Chromium(web_contents, profile) {
if (ai_chat::IsAllowedForContext(profile)) {
tab_data_observer_ = std::make_unique<ai_chat::TabDataWebContentsObserver>(
TabAndroid::FromWebContents(web_contents)->GetAndroidId(),
web_contents);
}
}
BraveTabFeatures::~BraveTabFeatures() = default;
TabFeatures::TabFeatures(content::WebContents* web_contents, Profile* profile)
: brave_tab_features_(
std::make_unique<BraveTabFeatures>(web_contents, profile)) {}
TabFeatures::~TabFeatures() = default;
NewTabPagePreloadPipelineManager*
TabFeatures::new_tab_page_preload_pipeline_manager() {
return brave_tab_features_->new_tab_page_preload_pipeline_manager();
}
// static
BraveTabFeatures* BraveTabFeatures::FromTabFeatures(TabFeatures* tab_features) {
return static_cast<BraveTabFeatures*>(
tab_features->brave_tab_features_.get());
}
} // namespace tabs