Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: content/browser/android/render_widget_host_connector.h

Issue 2792063003: Factor out RenderWidgetHostConnector (Closed)
Patch Set: composed connector Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/android/render_widget_host_connector.h
diff --git a/content/browser/android/render_widget_host_connector.h b/content/browser/android/render_widget_host_connector.h
new file mode 100644
index 0000000000000000000000000000000000000000..f50208150be0c3d25ad3c5a1f3b233bc56590b03
--- /dev/null
+++ b/content/browser/android/render_widget_host_connector.h
@@ -0,0 +1,50 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_ANDROID_RENDER_WIDGET_HOST_CONNECTOR_H_
+#define CONTENT_BROWSER_ANDROID_RENDER_WIDGET_HOST_CONNECTOR_H_
+
+#include "base/memory/weak_ptr.h"
+#include "content/public/browser/web_contents_observer.h"
+
+namespace content {
+
+class RenderWidgetHostViewAndroid;
+
+// An base class used to connect an object of the content layer lifecycle
+// to |RenderWidgetHostViewAndroid|. Observes RenderWidgetHostViewAndroid
+// updates and helps child classes keep it the up-to-date.
+// The inherting class needs to override |UpdateRenderProcessConnection|
+// to set itself to the RWHVA brought up foreground, and null out its
+// reference in the RWHVA going away so it won't access the object any more.
+class RenderWidgetHostConnector : public WebContentsObserver {
+ public:
+ explicit RenderWidgetHostConnector(WebContents* web_contents);
+ ~RenderWidgetHostConnector() override;
+
+ // Method to set itself to the |new_view|, and null out the reference
+ // in |old_view|. Example:
+ //
+ // if (old_rwhva)
+ // old_rwhva->set_object(nullptr);
+ // if (new_rwhva)
+ // new_rwhva->set_object(this);
+ virtual void UpdateRenderWidgetHostView(
+ RenderWidgetHostViewAndroid* old_rwhva,
+ RenderWidgetHostViewAndroid* new_rwhva) = 0;
boliu 2017/04/12 16:29:22 as discussed in chat, add a client interface so th
+
+ // WebContentsObserver implementation.
+ void RenderViewHostChanged(RenderViewHost* old_host,
+ RenderViewHost* new_host) override;
+ void WebContentsDestroyed() override;
+
+ private:
+ RenderWidgetHostViewAndroid* GetRenderWidgetHostView() const;
+
+ DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostConnector);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_ANDROID_RENDER_WIDGET_HOST_CONNECTOR_H_
« no previous file with comments | « content/browser/android/ime_adapter_android.cc ('k') | content/browser/android/render_widget_host_connector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698