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

Unified Diff: content/browser/media/capture/web_contents_tracker.h

Issue 1135823004: Implement all resolution change policies for desktop and tab capture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@resolution_change_policy_constraints_ITEM1_CR1
Patch Set: Addressed Dale's comments. Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
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);
};

Powered by Google App Engine
This is Rietveld 408576698