Index: content/browser/media/capture/web_contents_tracker.h |
diff --git a/content/browser/media/capture/web_contents_tracker.h b/content/browser/media/capture/web_contents_tracker.h |
index 613c971d44531c1d47aa3d7c125357e59cea21d7..4020a7ee06bf6c395e5f2917a913a59a529c2c6c 100644 |
--- a/content/browser/media/capture/web_contents_tracker.h |
+++ b/content/browser/media/capture/web_contents_tracker.h |
@@ -59,6 +59,12 @@ class CONTENT_EXPORT WebContentsTracker |
// Current target. This must only be called on the UI BrowserThread. |
RenderWidgetHost* GetTargetRenderWidgetHost() const; |
+ // Set a callback that is run whenever the main frame of the WebContents is |
+ // resized. The callback will be invoked on the same thread that called this |
+ // method, which should be the same thread that calls Start()/Stop(). Calling |
Wez
2015/05/14 01:44:55
nit: Suggest clarifying that this must be called f
miu
2015/05/14 21:12:27
Done.
|
+ // the Stop() method guarantees the callback will never be invoked again. |
+ void SetResizeChangeCallback(const ChangeCallback& callback); |
+ |
protected: |
friend class base::RefCountedThreadSafe<WebContentsTracker>; |
~WebContentsTracker() override; |
@@ -74,6 +80,11 @@ class CONTENT_EXPORT WebContentsTracker |
// callback is still valid and, if so, runs it. |
void MaybeDoCallback(RenderWidgetHost* rwh); |
+ // Called on the thread that Start()/Stop() are called on. Checks whether the |
+ // callback is still valid and, if so, runs it to indicate the main frame has |
+ // changed in size. |
+ void MaybeDoResizeCallback(RenderWidgetHost* rwh); |
+ |
// Look-up the current WebContents instance associated with the given |
// |render_process_id| and |main_render_frame_id| and begin observing it. |
void StartObservingWebContents(int render_process_id, |
@@ -86,6 +97,10 @@ class CONTENT_EXPORT WebContentsTracker |
void RenderFrameHostChanged(RenderFrameHost* old_host, |
RenderFrameHost* new_host) override; |
+ // WebContentsObserver override to notify the client that the source size has |
+ // changed. |
+ void MainFrameWasResized(bool width_changed) override; |
+ |
// WebContentsObserver override to notify the client that the capture target |
// has been permanently lost. |
void WebContentsDestroyed() override; |
@@ -109,6 +124,9 @@ class CONTENT_EXPORT WebContentsTracker |
// This is used to eliminate duplicate callback runs. |
RenderWidgetHost* last_target_; |
+ // Callback to run when the target RenderWidgetHost has resized. |
+ ChangeCallback resize_callback_; |
+ |
DISALLOW_COPY_AND_ASSIGN(WebContentsTracker); |
}; |