Commit 461f6587 authored by Miyoung Shin's avatar Miyoung Shin Committed by Commit Bot

Clean up WebContentsObserver inheritance

This CL cleans up WebContentsObserver inheritance from classes
that had only overridden OnInterfaceRequestFromFrame but removed
during the conversion to BrowserInterfaceBroker.

Bug: 1030327
Change-Id: If38d1f96779bd7badd47712b059b7b05939f8c4b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1950263Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarTommy Nyquist <nyquist@chromium.org>
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Cr-Commit-Position: refs/heads/master@{#722411}
parent 8718da92
......@@ -7,8 +7,7 @@
namespace contextual_search {
UnhandledTapWebContentsObserver::UnhandledTapWebContentsObserver(
content::WebContents* web_contents)
: content::WebContentsObserver(web_contents) {}
content::WebContents* web_contents) {}
UnhandledTapWebContentsObserver::~UnhandledTapWebContentsObserver() {}
......
......@@ -6,7 +6,6 @@
#define CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_UNHANDLED_TAP_WEB_CONTENTS_OBSERVER_H_
#include "base/macros.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
namespace contextual_search {
......@@ -18,8 +17,7 @@ typedef base::RepeatingCallback<
// Binds a Mojo unhandled-tap notifier message-handler to the frame host
// observed by this observer.
class UnhandledTapWebContentsObserver
: public content::WebContentsObserver,
public content::WebContentsUserData<UnhandledTapWebContentsObserver> {
: public content::WebContentsUserData<UnhandledTapWebContentsObserver> {
public:
// Creates an observer for the given |web_contents| that binds a Mojo request
// for an endpoint to the UnhandledTapNotifier service. This will create an
......
......@@ -9,13 +9,11 @@
#include "chrome/test/base/web_ui_browser_test.h"
#include "chrome/test/data/webui/web_ui_test.mojom.h"
#include "content/public/browser/web_contents_observer.h"
// The runner of Mojo WebUI javascript based tests. The main difference between
// this and WebUIBrowserTest is that tests subclassing from this class use a
// mojo pipe to send the test result, so there is no reliance on chrome.send().
class MojoWebUIBrowserTest : public BaseWebUIBrowserTest,
public content::WebContentsObserver {
class MojoWebUIBrowserTest : public BaseWebUIBrowserTest {
public:
MojoWebUIBrowserTest();
~MojoWebUIBrowserTest() override;
......
......@@ -46,15 +46,12 @@ class DistillabilityServiceImpl : public mojom::DistillabilityService {
};
DistillabilityDriver::DistillabilityDriver(content::WebContents* web_contents)
: content::WebContentsObserver(web_contents),
latest_result_(base::nullopt) {
: latest_result_(base::nullopt) {
if (!web_contents)
return;
}
DistillabilityDriver::~DistillabilityDriver() {
content::WebContentsObserver::Observe(nullptr);
}
DistillabilityDriver::~DistillabilityDriver() = default;
void DistillabilityDriver::CreateDistillabilityService(
mojo::PendingReceiver<mojom::DistillabilityService> receiver) {
......
......@@ -13,7 +13,6 @@
#include "base/optional.h"
#include "components/dom_distiller/content/browser/distillable_page_utils.h"
#include "components/dom_distiller/content/common/mojom/distillability_service.mojom.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
......@@ -21,8 +20,7 @@ namespace dom_distiller {
// This is an IPC helper for determining whether a page should be distilled.
class DistillabilityDriver
: public content::WebContentsObserver,
public content::WebContentsUserData<DistillabilityDriver> {
: public content::WebContentsUserData<DistillabilityDriver> {
public:
~DistillabilityDriver() override;
void CreateDistillabilityService(
......
......@@ -45,8 +45,7 @@ namespace content {
// DateTimeChooserAndroid implementation
DateTimeChooserAndroid::DateTimeChooserAndroid(WebContents* web_contents)
: content::WebContentsObserver(web_contents),
date_time_chooser_receiver_(this) {}
: web_contents_(web_contents), date_time_chooser_receiver_(this) {}
DateTimeChooserAndroid::~DateTimeChooserAndroid() {
}
......@@ -86,7 +85,7 @@ void DateTimeChooserAndroid::OpenDateTimeDialog(
}
}
gfx::NativeWindow native_window = web_contents()->GetTopLevelNativeWindow();
gfx::NativeWindow native_window = web_contents_->GetTopLevelNativeWindow();
if (native_window && !(native_window->GetJavaObject()).is_null()) {
j_date_time_chooser_.Reset(
......
......@@ -11,7 +11,6 @@
#include "base/android/jni_weak_ref.h"
#include "base/macros.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "third_party/blink/public/mojom/choosers/date_time_chooser.mojom.h"
......@@ -23,7 +22,6 @@ namespace content {
// Android implementation for DateTimeChooser dialogs.
class DateTimeChooserAndroid
: public blink::mojom::DateTimeChooser,
public WebContentsObserver,
public WebContentsUserData<DateTimeChooserAndroid> {
public:
explicit DateTimeChooserAndroid(WebContents* web_contents);
......@@ -48,6 +46,8 @@ class DateTimeChooserAndroid
private:
friend class content::WebContentsUserData<DateTimeChooserAndroid>;
content::WebContents* web_contents_;
OpenDateTimeDialogCallback open_date_time_response_callback_;
base::android::ScopedJavaGlobalRef<jobject> j_date_time_chooser_;
......
......@@ -43,7 +43,6 @@ void TextSuggestionHostAndroid::Create(JNIEnv* env, WebContents* web_contents) {
TextSuggestionHostAndroid::TextSuggestionHostAndroid(JNIEnv* env,
WebContents* web_contents)
: RenderWidgetHostConnector(web_contents),
WebContentsObserver(web_contents),
rwhva_(nullptr),
suggestion_menu_timeout_(base::BindRepeating(
&TextSuggestionHostAndroid::OnSuggestionMenuTimeout,
......@@ -139,7 +138,7 @@ TextSuggestionHostAndroid::GetJavaTextSuggestionHost() {
ScopedJavaLocalRef<jobject> obj = java_text_suggestion_host_.get(env);
if (obj.is_null()) {
obj = Java_TextSuggestionHost_create(
env, WebContentsObserver::web_contents()->GetJavaWebContents(),
env, RenderWidgetHostConnector::web_contents()->GetJavaWebContents(),
reinterpret_cast<intptr_t>(this));
java_text_suggestion_host_ = JavaObjectWeakGlobalRef(env, obj);
}
......
......@@ -20,8 +20,7 @@ namespace content {
// Blink side code (these are separate classes due to lifecycle considerations;
// this class is created by ImeAdapterAndroid ctor and destroyed together with
// WebContents. Mojo code takes ownership of mojom::TextSuggestionHost).
class TextSuggestionHostAndroid : public RenderWidgetHostConnector,
public WebContentsObserver {
class TextSuggestionHostAndroid : public RenderWidgetHostConnector {
public:
static void Create(JNIEnv* env, WebContents* web_contents);
TextSuggestionHostAndroid(JNIEnv* env,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment