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

Side by Side Diff: content/browser/android/render_widget_host_connector.h

Issue 2792063003: Factor out RenderWidgetHostConnector (Closed)
Patch Set: base::ObserverList 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/browser/renderer_host/render_widget_host_view_android.h"
10 #include "content/public/browser/web_contents_observer.h"
11
12 namespace content {
13
14 // A base class used to connect an object of the content layer lifecycle
15 // to |RenderWidgetHostViewAndroid|. The inherting class needs to
16 // override |UpdateRenderProcessConnection| to set itself to the RWHVA
17 // brought up foreground, and null out its reference in the RWHVA going
18 // away so it won't access the object any more.
19 // This class owns itself and gets deleted when WebContents is deleted.
20 class RenderWidgetHostConnector {
21 public:
22 explicit RenderWidgetHostConnector(WebContents* web_contents);
23 virtual ~RenderWidgetHostConnector();
24
25 // Method to set itself to the |new_rwhva|, and null out the reference
26 // in |old_rwvha|. Example:
27 //
28 // if (old_rwhva)
29 // old_rwhva->set_object(nullptr);
30 // if (new_rwhva)
31 // new_rwhva->set_object(this);
32 virtual void UpdateRenderProcessConnection(
33 RenderWidgetHostViewAndroid* old_rwhva,
34 RenderWidgetHostViewAndroid* new_rhwva) = 0;
35
36 RenderWidgetHostViewAndroid* GetRWHVAForTesting() const;
37
38 private:
39 class Observer;
40 std::unique_ptr<Observer> render_widget_observer_;
41
42 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostConnector);
43 };
44
45 } // namespace content
46
47 #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