OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 // Given a starting render_process_id and main_render_frame_id, the | 5 // Given a starting render_process_id and main_render_frame_id, the |
6 // WebContentsTracker tracks changes to the active RenderFrameHost tree during | 6 // WebContentsTracker tracks changes to the active RenderFrameHost tree during |
7 // the lifetime of a WebContents instance. This is used when mirroring tab | 7 // the lifetime of a WebContents instance. This is used when mirroring tab |
8 // video and audio so that user navigations, crashes, iframes, etc., during a | 8 // video and audio so that user navigations, crashes, iframes, etc., during a |
9 // tab's lifetime allow the capturing code to remain active on the | 9 // tab's lifetime allow the capturing code to remain active on the |
10 // current/latest render frame tree. | 10 // current/latest render frame tree. |
11 // | 11 // |
12 // Threading issues: Start(), Stop() and the ChangeCallback are invoked on the | 12 // Threading issues: Start(), Stop() and the ChangeCallback are invoked on the |
13 // same thread. This can be any thread, and the decision is locked-in by | 13 // same thread. This can be any thread, and the decision is locked-in by |
14 // WebContentsTracker when Start() is called. | 14 // WebContentsTracker when Start() is called. |
15 | 15 |
16 #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_TRACKER_H_ | 16 #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_TRACKER_H_ |
17 #define CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_TRACKER_H_ | 17 #define CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_TRACKER_H_ |
18 | 18 |
19 #include "base/callback.h" | 19 #include "base/callback.h" |
20 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
21 #include "content/common/content_export.h" | 21 #include "content/common/content_export.h" |
22 #include "content/public/browser/web_contents_observer.h" | 22 #include "content/public/browser/web_contents_observer.h" |
23 | 23 |
24 namespace base { | 24 namespace base { |
25 class MessageLoopProxy; | 25 class SingleThreadTaskRunner; |
26 } | 26 } |
27 | 27 |
28 namespace content { | 28 namespace content { |
29 | 29 |
30 class RenderWidgetHost; | 30 class RenderWidgetHost; |
31 | 31 |
32 class CONTENT_EXPORT WebContentsTracker | 32 class CONTENT_EXPORT WebContentsTracker |
33 : public base::RefCountedThreadSafe<WebContentsTracker>, | 33 : public base::RefCountedThreadSafe<WebContentsTracker>, |
34 public WebContentsObserver { | 34 public WebContentsObserver { |
35 public: | 35 public: |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 | 92 |
93 // WebContentsObserver overrides to notify the client that the capture target | 93 // WebContentsObserver overrides to notify the client that the capture target |
94 // may have changed due to a separate fullscreen widget shown/destroyed. | 94 // may have changed due to a separate fullscreen widget shown/destroyed. |
95 void DidShowFullscreenWidget(int routing_id) override; | 95 void DidShowFullscreenWidget(int routing_id) override; |
96 void DidDestroyFullscreenWidget(int routing_id) override; | 96 void DidDestroyFullscreenWidget(int routing_id) override; |
97 | 97 |
98 // If true, the client is interested in the showing/destruction of fullscreen | 98 // If true, the client is interested in the showing/destruction of fullscreen |
99 // RenderWidgetHosts. | 99 // RenderWidgetHosts. |
100 const bool track_fullscreen_rwh_; | 100 const bool track_fullscreen_rwh_; |
101 | 101 |
102 // MessageLoop corresponding to the thread that called Start(). | 102 // MessageLoop corresponding to the thread that called Start(). |
xhwang
2015/04/30 15:54:45
Update the comment.
anujsharma
2015/05/04 08:07:56
Done.
| |
103 scoped_refptr<base::MessageLoopProxy> message_loop_; | 103 scoped_refptr<base::SingleThreadTaskRunner> message_loop_; |
xhwang
2015/04/30 15:54:45
Also update the variable name please.
anujsharma
2015/05/04 08:07:56
Done.
| |
104 | 104 |
105 // Callback to run when the target RenderWidgetHost has changed. | 105 // Callback to run when the target RenderWidgetHost has changed. |
106 ChangeCallback callback_; | 106 ChangeCallback callback_; |
107 | 107 |
108 // Pointer to the RenderWidgetHost provided in the last run of |callback_|. | 108 // Pointer to the RenderWidgetHost provided in the last run of |callback_|. |
109 // This is used to eliminate duplicate callback runs. | 109 // This is used to eliminate duplicate callback runs. |
110 RenderWidgetHost* last_target_; | 110 RenderWidgetHost* last_target_; |
111 | 111 |
112 DISALLOW_COPY_AND_ASSIGN(WebContentsTracker); | 112 DISALLOW_COPY_AND_ASSIGN(WebContentsTracker); |
113 }; | 113 }; |
114 | 114 |
115 } // namespace content | 115 } // namespace content |
116 | 116 |
117 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_TRACKER_H_ | 117 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_TRACKER_H_ |
OLD | NEW |