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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_ANDROID_RENDER_WIDGET_HOST_CONNECTOR_H_
6 #define CONTENT_BROWSER_ANDROID_RENDER_WIDGET_HOST_CONNECTOR_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "content/public/browser/web_contents_observer.h"
10
11 namespace content {
12
13 class RenderWidgetHostViewAndroid;
14
15 // An base class used to connect an object of the content layer lifecycle
16 // to |RenderWidgetHostViewAndroid|. Observes RenderWidgetHostViewAndroid
17 // updates and helps child classes keep it the up-to-date.
18 // The inherting class needs to override |UpdateRenderProcessConnection|
19 // to set itself to the RWHVA brought up foreground, and null out its
20 // reference in the RWHVA going away so it won't access the object any more.
21 class RenderWidgetHostConnector : public WebContentsObserver {
22 public:
23 explicit RenderWidgetHostConnector(WebContents* web_contents);
24 ~RenderWidgetHostConnector() override;
25
26 // Method to set itself to the |new_view|, and null out the reference
27 // in |old_view|. Example:
28 //
29 // if (old_rwhva)
30 // old_rwhva->set_object(nullptr);
31 // if (new_rwhva)
32 // new_rwhva->set_object(this);
33 virtual void UpdateRenderWidgetHostView(
34 RenderWidgetHostViewAndroid* old_rwhva,
35 RenderWidgetHostViewAndroid* new_rwhva) = 0;
boliu 2017/04/12 16:29:22 as discussed in chat, add a client interface so th
36
37 // WebContentsObserver implementation.
38 void RenderViewHostChanged(RenderViewHost* old_host,
39 RenderViewHost* new_host) override;
40 void WebContentsDestroyed() override;
41
42 private:
43 RenderWidgetHostViewAndroid* GetRenderWidgetHostView() const;
44
45 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostConnector);
46 };
47
48 } // namespace content
49
50 #endif // CONTENT_BROWSER_ANDROID_RENDER_WIDGET_HOST_CONNECTOR_H_
OLDNEW
« 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