Refine API design: desktopCapturer.getSources.
This commit is contained in:
parent
36c0ad7fda
commit
dcb457e76e
7 changed files with 124 additions and 194 deletions
|
@ -14,7 +14,7 @@ class DesktopMediaListObserver {
|
|||
virtual void OnSourceMoved(int old_index, int new_index) = 0;
|
||||
virtual void OnSourceNameChanged(int index) = 0;
|
||||
virtual void OnSourceThumbnailChanged(int index) = 0;
|
||||
virtual void OnRefreshFinished() = 0;
|
||||
virtual bool OnRefreshFinished() = 0;
|
||||
|
||||
protected:
|
||||
virtual ~DesktopMediaListObserver() {}
|
||||
|
|
|
@ -358,10 +358,13 @@ void NativeDesktopMediaList::OnSourceThumbnail(
|
|||
}
|
||||
|
||||
void NativeDesktopMediaList::OnRefreshFinished() {
|
||||
observer_->OnRefreshFinished();
|
||||
BrowserThread::PostDelayedTask(
|
||||
BrowserThread::UI, FROM_HERE,
|
||||
base::Bind(&NativeDesktopMediaList::Refresh,
|
||||
weak_factory_.GetWeakPtr()),
|
||||
update_period_);
|
||||
// Give a chance to the observer to stop the refresh work.
|
||||
bool is_continue = observer_->OnRefreshFinished();
|
||||
if (is_continue) {
|
||||
BrowserThread::PostDelayedTask(
|
||||
BrowserThread::UI, FROM_HERE,
|
||||
base::Bind(&NativeDesktopMediaList::Refresh,
|
||||
weak_factory_.GetWeakPtr()),
|
||||
update_period_);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue