OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ |
6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ |
7 | 7 |
8 #include "base/process/kill.h" | 8 #include "base/process/kill.h" |
9 #include "base/process/process_handle.h" | 9 #include "base/process/process_handle.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
11 #include "content/public/browser/navigation_controller.h" | 11 #include "content/public/browser/navigation_controller.h" |
12 #include "content/public/common/page_transition_types.h" | 12 #include "content/public/common/page_transition_types.h" |
13 #include "ipc/ipc_listener.h" | 13 #include "ipc/ipc_listener.h" |
14 #include "ipc/ipc_sender.h" | 14 #include "ipc/ipc_sender.h" |
15 #include "ui/base/window_open_disposition.h" | 15 #include "ui/base/window_open_disposition.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 class NavigationEntry; | 19 class NavigationEntry; |
| 20 class RenderFrameHost; |
20 class RenderViewHost; | 21 class RenderViewHost; |
21 class WebContents; | 22 class WebContents; |
22 class WebContentsImpl; | 23 class WebContentsImpl; |
23 struct FaviconURL; | 24 struct FaviconURL; |
24 struct FrameNavigateParams; | 25 struct FrameNavigateParams; |
25 struct LoadCommittedDetails; | 26 struct LoadCommittedDetails; |
26 struct LoadFromMemoryCacheDetails; | 27 struct LoadFromMemoryCacheDetails; |
27 struct Referrer; | 28 struct Referrer; |
28 struct ResourceRedirectDetails; | 29 struct ResourceRedirectDetails; |
29 struct ResourceRequestDetails; | 30 struct ResourceRequestDetails; |
30 | 31 |
31 // An observer API implemented by classes which are interested in various page | 32 // An observer API implemented by classes which are interested in various page |
32 // load events from WebContents. They also get a chance to filter IPC messages. | 33 // load events from WebContents. They also get a chance to filter IPC messages. |
33 // | 34 // |
34 // Since a WebContents can be a delegate to almost arbitrarily many | 35 // Since a WebContents can be a delegate to almost arbitrarily many |
35 // RenderViewHosts, it is important to check in those WebContentsObserver | 36 // RenderViewHosts, it is important to check in those WebContentsObserver |
36 // methods which take a RenderViewHost that the event came from the | 37 // methods which take a RenderViewHost that the event came from the |
37 // RenderViewHost the observer cares about. | 38 // RenderViewHost the observer cares about. |
38 // | 39 // |
39 // Usually, observers should only care about the current RenderViewHost as | 40 // Usually, observers should only care about the current RenderViewHost as |
40 // returned by GetRenderViewHost(). | 41 // returned by GetRenderViewHost(). |
41 // | 42 // |
42 // TODO(creis, jochen): Hide the fact that there are several RenderViewHosts | 43 // TODO(creis, jochen): Hide the fact that there are several RenderViewHosts |
43 // from the WebContentsObserver API. http://crbug.com/173325 | 44 // from the WebContentsObserver API. http://crbug.com/173325 |
44 class CONTENT_EXPORT WebContentsObserver : public IPC::Listener, | 45 class CONTENT_EXPORT WebContentsObserver : public IPC::Listener, |
45 public IPC::Sender { | 46 public IPC::Sender { |
46 public: | 47 public: |
| 48 // Called when a RenderFrameHost associated with this WebContents is created. |
| 49 virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) {} |
| 50 |
| 51 // Called whenever a RenderFrameHost associated with this WebContents is |
| 52 // deleted. |
| 53 virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) {} |
| 54 |
47 // Only one of the two methods below will be called when a RVH is created for | 55 // Only one of the two methods below will be called when a RVH is created for |
48 // a WebContents, depending on whether it's for an interstitial or not. | 56 // a WebContents, depending on whether it's for an interstitial or not. |
49 virtual void RenderViewCreated(RenderViewHost* render_view_host) {} | 57 virtual void RenderViewCreated(RenderViewHost* render_view_host) {} |
50 virtual void RenderViewForInterstitialPageCreated( | 58 virtual void RenderViewForInterstitialPageCreated( |
51 RenderViewHost* render_view_host) {} | 59 RenderViewHost* render_view_host) {} |
52 | 60 |
53 // This method is invoked when the RenderView of the current RenderViewHost | 61 // This method is invoked when the RenderView of the current RenderViewHost |
54 // is ready, e.g. because we recreated it after a crash. | 62 // is ready, e.g. because we recreated it after a crash. |
55 virtual void RenderViewReady() {} | 63 virtual void RenderViewReady() {} |
56 | 64 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 void WebContentsImplDestroyed(); | 350 void WebContentsImplDestroyed(); |
343 | 351 |
344 WebContentsImpl* web_contents_; | 352 WebContentsImpl* web_contents_; |
345 | 353 |
346 DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); | 354 DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); |
347 }; | 355 }; |
348 | 356 |
349 } // namespace content | 357 } // namespace content |
350 | 358 |
351 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ | 359 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ |
OLD | NEW |