Chromium change: https://chromium.googlesource.com/chromium/src/+/715ac48128b5de0e854c4233dbb922249b950e54 [Tabs] TabAndroid implements TabInterface In order to use tab_collection for Chrome Android a TabInterface implementation is required. The logical candidate for this is TabAndroid. This CL has TabAndroid implement TabInterface with most methods currently being stubbed out with NOTIMPLEMENTED until future CLs. Notable changes: - Some existing TabAndroid users wanted WeakPtr<TabAndroid> this collided with TabInterface::GetWeakPtr so a renamed GetTabAndroidWeakPtr is added and existing callers are migrated. - TabFeaturesAndroid is renamed to tabs::TabFeatures to fulfill the definition of the forward declaration of TabFeatures in TabInterface. While we could put in more effort to share a TabFeatures interface in components/tabs/ this would likely introduce lots of buildflags and has some blockers due to a dependency on chrome/... This is a possible follow-up. - SplitTabId is redefined in tab_android.h temporarily until it can be migrated to components/tabs/ in order to be shared. Bug: 409366905
30 lines
1.0 KiB
C++
30 lines
1.0 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/tab_features.h"
|
|
|
|
#include <memory>
|
|
|
|
#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 {
|
|
|
|
TabFeatures::TabFeatures(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);
|
|
}
|
|
}
|
|
|
|
TabFeatures::~TabFeatures() = default;
|
|
|
|
} // namespace tabs
|