1 // Copyright 2018 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_PUBLIC_BROWSER_RENDER_WIDGET_HOST_OBSERVER_H_
6 #define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_OBSERVER_H_
7 
8 #include "base/observer_list_types.h"
9 #include "content/common/content_export.h"
10 
11 namespace content {
12 
13 class RenderWidgetHost;
14 
15 // An observer API implemented by classes which are interested
16 // in RenderWidgetHost events.
17 class CONTENT_EXPORT RenderWidgetHostObserver : public base::CheckedObserver {
18  public:
19   // This method is invoked when the visibility of the RenderWidgetHost changes.
RenderWidgetHostVisibilityChanged(RenderWidgetHost * widget_host,bool became_visible)20   virtual void RenderWidgetHostVisibilityChanged(RenderWidgetHost* widget_host,
21                                                  bool became_visible) {}
22 
23   // This method is invoked when the observed RenderWidgetHost is destroyed.
24   // This is guaranteed to be the last call made to the observer, so if the
25   // observer is tied to the observed RenderWidgetHost, it is safe to delete it.
RenderWidgetHostDestroyed(RenderWidgetHost * widget_host)26   virtual void RenderWidgetHostDestroyed(RenderWidgetHost* widget_host) {}
27 
28  protected:
29   ~RenderWidgetHostObserver() override = default;
30 };
31 
32 }  // namespace content
33 
34 #endif  // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_OBSERVER_H_
35